Imports System.IO Imports System.Net.NetworkInformation Imports System.Text Imports WeebDoorCreator.SDK Public Class Form1 ' caricamento del NEXT STACK da redis (come oggetto) ' PROD http : https://iis01.egalware.com/WDC/SRV/ ' DEV: https : https://localhost:7043/ Dim baseIp As String = "iis01.steamware.net" Dim baseUrl As String = "https://iis01.egalware.com/WDC/SRV/" Dim codPost As String = "WRK001" ' nome macchina calcolo Dim risultatoPing As PingReply = Nothing Dim currWDC As WDC = New WDC(baseIp, baseUrl, codPost) Private Sub btnTestPing_Click(sender As Object, e As EventArgs) Handles btnTestPing.Click ' chiamo test ping... risultatoPing = currWDC.testPing lblpingTest.Text = risultatoPing.Status.ToString() End Sub Private Sub btnTestAlive_Click(sender As Object, e As EventArgs) Handles btnTestAlive.Click Dim answ As String = "" If (currWDC.testAlive) Then lblTestAlive.Text = "Server Alive!!!" Else lblTestAlive.Text = "Alive test failed!" End If End Sub Dim idxSim As Integer = 0 Private Sub btnFullTest_Click(sender As Object, e As EventArgs) Handles btnFullTest.Click Dim num2proc As Integer Dim queueStatus As New Dictionary(Of String, Long) Dim queueList As New Dictionary(Of String, String) Dim procResults As New List(Of CalcResultDTO) Dim respPut As String Dim fileName As String Dim fileCont As String queueStatus = currWDC.queueStatus Dim sb As StringBuilder sb = New StringBuilder sb.AppendLine("----------------------------") For Each item As KeyValuePair(Of String, Long) In queueStatus sb.AppendLine($"{item.Key} | Found {item.Value} items") Next sb.AppendLine("----------------------------") sb.AppendLine() txtOut.Text = sb.ToString() ' recupero numero da processare num2proc = currWDC.numTask2proc If (num2proc > 0) Then sb.AppendLine("----------------------------") ' mi prendo la lista dei primi 10 max e processo... queueList = currWDC.queueList(10) For Each item As KeyValuePair(Of String, String) In queueList fileCont = "" idxSim = idxSim + 1 If (idxSim > 3) Then idxSim = 0 End If fileName = Path.Combine("temp", $"Logo{idxSim:00}.svg") If (File.Exists(fileName)) Then fileCont = File.ReadAllText(fileName) End If ' mi limito a mostrare codice + contenuto DDF... dovrebbe processare invero... sb.AppendLine("--------------------------------------------------------") sb.AppendLine($"DoorId.Vers: {item.Key}") sb.AppendLine("DDF:") sb.AppendLine("--------") sb.AppendLine(item.Value) sb.AppendLine("--------------------------------------------------------") sb.AppendLine() ' costruisco risposta finta di processing con esito true + SVG Dim currRes As New CalcResultDTO currRes.Validated = True currRes.DoorIdVers = $"{item.Key}.{item.Value}" currRes.SvgGen = fileCont procResults.Add(currRes) Next sb.AppendLine("----------------------------") sb.AppendLine() ' rendo la risposta... respPut = currWDC.SendProcResults(procResults) sb.AppendLine() sb.AppendLine("----------------------------") sb.AppendLine("Esito invio risposta al server:") sb.AppendLine() sb.AppendLine(respPut) sb.AppendLine("----------------------------") txtOut.Text = sb.ToString() End If End Sub Private Sub btnResetQueue_Click(sender As Object, e As EventArgs) Handles btnResetQueue.Click currWDC.ResetQueue() txtOut.Text = "Queue Resetted!" End Sub Private Sub btnQueueStatus_Click(sender As Object, e As EventArgs) Handles btnQueueStatus.Click Dim queueStatus As New Dictionary(Of String, Long) queueStatus = currWDC.queueStatus Dim sb As StringBuilder sb = New StringBuilder sb.AppendLine("----------------------------") For Each item As KeyValuePair(Of String, Long) In queueStatus sb.AppendLine($"{item.Key} | Found {item.Value} items") Next sb.AppendLine("----------------------------") sb.AppendLine() txtOut.Text = sb.ToString() End Sub End Class