Inizio rename progetto

This commit is contained in:
Samuele Locatelli
2023-05-12 15:55:55 +02:00
parent 59d6bc1205
commit 8b13765bfc
16 changed files with 471 additions and 538 deletions
+4 -3
View File
@@ -1,14 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
<probing privatePath="lib;libs" xmlns="" />
</assemblyBinding>
</runtime>
</configuration>
+40 -4
View File
@@ -32,6 +32,10 @@ Partial Class Form1
Me.btnQueueStatus = New System.Windows.Forms.Button()
Me.StartProcess = New System.Windows.Forms.Button()
Me.StopProcess = New System.Windows.Forms.Button()
Me.StatusStrip1 = New System.Windows.Forms.StatusStrip()
Me.tsProgBar = New System.Windows.Forms.ToolStripProgressBar()
Me.txtQueue = New System.Windows.Forms.TextBox()
Me.StatusStrip1.SuspendLayout()
Me.SuspendLayout()
'
'btnTestPing
@@ -81,11 +85,11 @@ Partial Class Form1
'
'btnResetQueue
'
Me.btnResetQueue.Location = New System.Drawing.Point(13, 228)
Me.btnResetQueue.Location = New System.Drawing.Point(13, 93)
Me.btnResetQueue.Name = "btnResetQueue"
Me.btnResetQueue.Size = New System.Drawing.Size(75, 23)
Me.btnResetQueue.TabIndex = 6
Me.btnResetQueue.Text = "Reset Queue"
Me.btnResetQueue.Text = "Reset Q"
Me.btnResetQueue.UseVisualStyleBackColor = True
'
'txtOut
@@ -99,7 +103,7 @@ Partial Class Form1
Me.txtOut.Multiline = True
Me.txtOut.Name = "txtOut"
Me.txtOut.ScrollBars = System.Windows.Forms.ScrollBars.Vertical
Me.txtOut.Size = New System.Drawing.Size(650, 400)
Me.txtOut.Size = New System.Drawing.Size(650, 430)
Me.txtOut.TabIndex = 7
Me.txtOut.Text = "---"
'
@@ -130,11 +134,38 @@ Partial Class Form1
Me.StopProcess.Text = "Stop"
Me.StopProcess.UseVisualStyleBackColor = True
'
'StatusStrip1
'
Me.StatusStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.tsProgBar})
Me.StatusStrip1.Location = New System.Drawing.Point(0, 497)
Me.StatusStrip1.Name = "StatusStrip1"
Me.StatusStrip1.Size = New System.Drawing.Size(764, 22)
Me.StatusStrip1.TabIndex = 11
Me.StatusStrip1.Text = "StatusStrip1"
'
'tsProgBar
'
Me.tsProgBar.Name = "tsProgBar"
Me.tsProgBar.Size = New System.Drawing.Size(100, 16)
'
'txtQueue
'
Me.txtQueue.BackColor = System.Drawing.SystemColors.ControlDarkDark
Me.txtQueue.ForeColor = System.Drawing.SystemColors.Window
Me.txtQueue.Location = New System.Drawing.Point(13, 123)
Me.txtQueue.Multiline = True
Me.txtQueue.Name = "txtQueue"
Me.txtQueue.Size = New System.Drawing.Size(90, 64)
Me.txtQueue.TabIndex = 12
Me.txtQueue.Text = "Q Status:"
'
'Form1
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(764, 472)
Me.ClientSize = New System.Drawing.Size(764, 519)
Me.Controls.Add(Me.txtQueue)
Me.Controls.Add(Me.StatusStrip1)
Me.Controls.Add(Me.StopProcess)
Me.Controls.Add(Me.StartProcess)
Me.Controls.Add(Me.btnQueueStatus)
@@ -147,6 +178,8 @@ Partial Class Form1
Me.Controls.Add(Me.btnTestPing)
Me.Name = "Form1"
Me.Text = "Form1"
Me.StatusStrip1.ResumeLayout(False)
Me.StatusStrip1.PerformLayout()
Me.ResumeLayout(False)
Me.PerformLayout()
@@ -162,4 +195,7 @@ Partial Class Form1
Friend WithEvents btnQueueStatus As Button
Friend WithEvents StartProcess As Button
Friend WithEvents StopProcess As Button
Friend WithEvents StatusStrip1 As StatusStrip
Friend WithEvents tsProgBar As ToolStripProgressBar
Friend WithEvents txtQueue As TextBox
End Class
+3
View File
@@ -117,4 +117,7 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="StatusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>
+354 -470
View File
@@ -1,41 +1,149 @@
Imports System.Globalization
Imports System.IO
Imports System.IO
Imports System.Net.NetworkInformation
Imports System.Runtime.CompilerServices
Imports System.Runtime.InteropServices
Imports System.Text
Imports System.Threading
Imports System.Windows.Forms.VisualStyles.VisualStyleElement.ToolTip
Imports WeebDoorCreator.SDK
Public Class Form1
#Region "Public Methods"
' 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.egalware.com"
Dim baseUrl As String = "https://iis01.egalware.com/WDC/SRV/"
Dim codPost As String = "WRK001" ' nome macchina calcolo
Dim risultatoPing As PingReply = Nothing
Public Sub DisplayQueueStatus()
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
Dim currWDC As WDC = New WDC(baseIp, baseUrl, codPost)
Dim m_bStopProcess As Boolean = False
Private m_MaxCamInstances As Integer = 1
'Private m_MaxCamInstances As Integer = 8
Public Sub SetMaxCamInstances(value As Integer)
m_MaxCamInstances = value
End Sub
Dim m_ExecutionThread As Thread
Dim m_bExecutionThreadStoped As Boolean = False
#End Region
Private Sub btnTestPing_Click(sender As Object, e As EventArgs) Handles btnTestPing.Click
' chiamo test ping...
risultatoPing = currWDC.testPing
lblpingTest.Text = risultatoPing.Status.ToString()
Private ReadOnly synchronizationContext As SynchronizationContext
Private Sub performBarAdvance()
synchronizationContext.Post(New SendOrPostCallback(Function(o)
tsProgBar.PerformStep()
If tsProgBar.Value >= tsProgBar.Maximum Then
tsProgBar.Value = 0
End If
tsProgBar.Invalidate()
End Function), "")
End Sub
#Region "Private Fields"
' 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.egalware.com"
Dim baseUrl As String = "https://iis01.egalware.com/WDC/SRV/"
Dim codPost As String = "WRK001" ' nome macchina calcolo
Dim currWDC As WDC = New WDC(baseIp, baseUrl, codPost)
Dim idxSim As Integer = 0
Dim m_bExecutionThreadStoped As Boolean = False
Dim m_bStopProcess As Boolean = False
Dim m_ExecutionThread As Thread
'Private m_MaxCamInstances As Integer = 8
Private m_MaxCamInstances As Integer = 1
Dim risultatoPing As PingReply = Nothing
Dim ThreadList As Thread()
#End Region
#Region "Private Methods"
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 btnQueueStatus_Click(sender As Object, e As EventArgs) Handles btnQueueStatus.Click
DisplayQueueStatus()
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 btnTestAlive_Click(sender As Object, e As EventArgs) Handles btnTestAlive.Click
@@ -47,127 +155,12 @@ Public Class Form1
End If
End Sub
Dim idxSim As Integer = 0
Private Sub StopProcess_Click(sender As Object, e As EventArgs) Handles StopProcess.Click
m_bStopProcess = True
' fix colori
StartProcess.BackColor = ButtonBase.DefaultBackColor
StartProcess.ForeColor = ButtonBase.DefaultForeColor
While Not m_bExecutionThreadStoped
Thread.Sleep(10)
End While
m_ExecutionThread = Nothing
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 Structure MyProc
Public bEnable As Boolean
Public Proc As Process
Public Thread As Thread
Public nBar As Integer
End Structure
Dim ThreadList As Thread()
Private Sub ThreadFunction(caller As Form1)
Dim sExePath As String = "c:\EgtProg\EgtEngine\EgtEngineR32.exe"
Dim sCurrDdfDir As String = "c:\EgtData\WebDoor\Ddf"
Dim ParentForm As Form1
ParentForm = caller
While Not m_bStopProcess
' se c'e' qualcosa da processare
If currWDC.numTask2proc > 0 Then
Dim LastRequest As Dictionary(Of String, String) = currWDC.queueList(1)
If LastRequest.Count > 0 Then
Dim Item As KeyValuePair(Of String, String) = LastRequest.First()
Dim bOk As Boolean = Not IsNothing(Item)
If bOk Then
' svuoto vecchio set file della porta richiesta
Dim fileList As String() = Directory.GetFiles(sCurrDdfDir, Item.Key + ".*")
' elimino vecchi
If Not IsNothing(fileList) Then
For Each sFile In fileList
File.Delete(sFile)
Next
End If
' scrivo ddf
Dim sDdfPath As String = sCurrDdfDir & "\" & Item.Key & ".ddf"
Try
File.WriteAllText(sDdfPath, Item.Value)
Catch ex As Exception
bOk = False
End Try
If bOk Then
' eseguo calcolo
Dim Proc As New Process()
Proc.StartInfo.FileName = sExePath
Proc.StartInfo.Arguments = """C:\EgtData\WebDoor\Main.lua""" & " """ & sDdfPath & """"
Proc.StartInfo.UseShellExecute = False
If Proc.Start() Then
While Not Proc.HasExited
Thread.Sleep(1)
End While
Dim procResults As New List(Of CalcResultDTO)
Dim currRes As New CalcResultDTO
Dim fContent As String = ""
' verifico esistenza file svg e lo carico
bOk = GetFileContent(Path.ChangeExtension(sDdfPath, "svg"), fContent)
' invio risposta
currRes.Validated = Proc.ExitCode = 0 AndAlso bOk
currRes.DoorIdVers = Item.Key
' se NON fosse validato --> messo il messaggio...
If (currRes.Validated) Then
currRes.SvgGen = fContent
Else
bOk = GetFileContent(Path.ChangeExtension(sDdfPath, "txt"), fContent)
currRes.ErrorMsg = fContent
End If
procResults.Add(currRes)
Dim respPut As String = currWDC.SendProcResults(procResults)
' chiedo update della coda...
' ParentForm.DisplayQueueStatus()
End If
End If
End If
End If
End If
End While
End Sub
Private Function GetFileContent(ByVal filePath As String, ByRef fileContent As String) As Boolean
Dim bOk As Boolean = File.Exists(filePath)
If bOk Then
Try
fileContent = File.ReadAllText(filePath)
Catch ex As Exception
bOk = False
fileContent = ""
End Try
End If
Return bOk
End Function
Private Sub ExecutionProcess()
' recupero Id dei DDF
Dim sDdfRoot As String = "c:\EgtData\WebDoor\Ddf"
@@ -224,7 +217,7 @@ Public Class Form1
ThreadList = New Thread(nMaxThread - 1) {}
For nThreadIndex = 0 To nMaxThread - 1
ThreadList(nThreadIndex) = New Thread(Sub()
ThreadFunction(Me)
ThreadFunction()
End Sub)
ThreadList(nThreadIndex).SetApartmentState(ApartmentState.STA)
' avvio thread di gestione della macchina che avvia la connessione
@@ -242,6 +235,20 @@ Public Class Form1
End Sub
Private Function GetFileContent(ByVal filePath As String, ByRef fileContent As String) As Boolean
Dim bOk As Boolean = File.Exists(filePath)
If bOk Then
Try
fileContent = File.ReadAllText(filePath)
Catch ex As Exception
bOk = False
fileContent = ""
End Try
End If
Return bOk
End Function
Private Sub StartProcess_Click(sender As Object, e As EventArgs) Handles StartProcess.Click
m_bStopProcess = False
' fix colori
@@ -346,116 +353,67 @@ Public Class Form1
' End If
'End If
' ' Lancio in parallelo più processi (senza superare il numero di core logici presenti) Dim
' vProc As MyProc() = New MyProc(nMaxThread - 1) {} For j As Integer = 0 To nMaxThread - 1
' vProc(j).nBar = -1 vProc(j).bEnable = True Next
' While Not m_bStopProcess
' For j As Integer = 0 To nMaxThread - 1 If Not vProc(j).bEnable Then Continue For Dim bDone
' As Boolean = False
' ' Lancio in parallelo più processi (senza superare il numero di core logici presenti)
' Dim vProc As MyProc() = New MyProc(nMaxThread - 1) {}
' For j As Integer = 0 To nMaxThread - 1
' vProc(j).nBar = -1
' vProc(j).bEnable = True
' Next
' If vProc(j).nBar = -1 Then
' While Not m_bStopProcess
' ' se c'e' qualcosa da processare If currWDC.numTask2proc > 0 Then
' For j As Integer = 0 To nMaxThread - 1
' If Not vProc(j).bEnable Then Continue For
' Dim bDone As Boolean = False
' Dim LastRequest As Dictionary(Of String, String) = currWDC.queueList(1)
' If vProc(j).nBar = -1 Then
' If vBar(nCurrBar).bBarOk Then vProc(j).Proc = New Process()
' vProc(j).Proc.StartInfo.FileName = ExePath If bIsEdit Then
' vProc(j).Proc.StartInfo.Arguments = """" & vBar(nCurrBar).sBarPath & """" Else
' vProc(j).Proc.StartInfo.Arguments = """" & vBar(nCurrBar).sBarPath & """ " & """" &
' vBar(nCurrBar).nProjType & """ " & """" & vBar(nCurrBar).nMachineName & """ " &
' vBar(nCurrBar).nCmdType End If vProc(j).Proc.StartInfo.UseShellExecute = False
' ' se c'e' qualcosa da processare
' If currWDC.numTask2proc > 0 Then
' If vProc(j).Proc.Start() Then vProc(j).nBar = nCurrBar nCurrBar += 1 nActProc += 1 End If
' Else If vBar(nCurrBar).nCmdType = CmdTypes.CHECK OrElse vBar(nCurrBar).nCmdType =
' CmdTypes.CHECKGEN Then RaiseEvent Calc_ProcessResult(Nothing, New
' CalcResultEventArgs(vBar(nCurrBar))) 'ProcessResults(vBar(nCurrBar)) ElseIf
' vBar(nCurrBar).nCmdType = CmdTypes.GENERATE Then RaiseEvent Calc_ProcessResult(Nothing,
' New CalcResultEventArgs(vBar(nCurrBar))) 'ProcessResults(vBar(nCurrBar)) 'RaiseEvent
' Calc_ProcessEnd(Nothing, New CalcProcessEndEventArgs(vBar(nCurrBar)))
' 'ProcessResults(vBar(nCurrBar)) End If bDone = True nCurrBar += 1 End If End If Else
' Dim LastRequest As Dictionary(Of String, String) = currWDC.queueList(1)
' If vProc(j).Proc.HasExited Then ' se terminato con successo If vProc(j).Proc.ExitCode = 0
' Then ' salvo il risultato If vBar(vProc(j).nBar).nCmdType = CmdTypes.CHECK OrElse
' vBar(vProc(j).nBar).nCmdType = CmdTypes.CHECKGEN Then RaiseEvent
' Calc_ProcessResult(Nothing, New CalcResultEventArgs(vBar(vProc(j).nBar))) '
' ProcessResults(vBar(vProc(j).nBar)) ElseIf vBar(vProc(j).nBar).nCmdType =
' CmdTypes.GENERATE Then RaiseEvent Calc_ProcessResult(Nothing, New
' CalcResultEventArgs(vBar(vProc(j).nBar))) ' ProcessResults(vBar(vProc(j).nBar))
' 'RaiseEvent Calc_ProcessEnd(Nothing, New CalcProcessEndEventArgs(vBar(vProc(j).nBar)))
' 'ProcessResults(vBar(nCurrBar)) End If bDone = True vProc(j).nBar = -1 nActProc -= 1 ' se
' superato il numero di processi eseguibili in parallelo ElseIf vProc(j).Proc.ExitCode = 1
' Then ' aggiungo il pezzo in coda If numBars + nShiftBar < numBars + nMaxThread Then
' vBar(numBars + nShiftBar) = vBar(vProc(j).nBar) nShiftBar += 1 End If ' disabilito il
' processo vProc(j).bEnable = False vProc(j).nBar = -1 nActProc -= 1 ' altrimenti (errore
' generico di esecuzione) Else ' salvo il risultato If vBar(vProc(j).nBar).nCmdType =
' CmdTypes.CHECK OrElse vBar(vProc(j).nBar).nCmdType = CmdTypes.CHECKGEN Then RaiseEvent
' Calc_ProcessResult(Nothing, New CalcResultEventArgs(vBar(vProc(j).nBar))) '
' ProcessResults(vBar(vProc(j).nBar)) ElseIf vBar(vProc(j).nBar).nCmdType =
' CmdTypes.GENERATE Then RaiseEvent Calc_ProcessResult(Nothing, New
' CalcResultEventArgs(vBar(vProc(j).nBar))) ' ProcessResults(vBar(vProc(j).nBar))
' 'RaiseEvent Calc_ProcessEnd(Nothing, New CalcProcessEndEventArgs(vBar(vProc(j).nBar)))
' 'ProcessResults(vBar(nCurrBar)) End If bDone = True vProc(j).nBar = -1 nActProc -= 1 End
' If Else vProc(j).Proc.Refresh() End If End If
' If bDone Then ' se sono in simulazione If bIsSimulation Then Dim sOriPath As String =
' Path.ChangeExtension(vBar(0).sBarPath, ".ori.bwe") ' se file modificato a mano If
' File.GetLastWriteTime(sOriPath) < File.GetLastWriteTime(vBar(0).sBarPath) Then ' aggiorno
' progetto If File.Exists(vBar(0).sBarPath) Then File.Copy(vBar(0).sBarPath, sOriPath, True)
' If vBar(nCurrBar).bBarOk Then
' vProc(j).Proc = New Process()
' vProc(j).Proc.StartInfo.FileName = ExePath
' If bIsEdit Then
' vProc(j).Proc.StartInfo.Arguments = """" & vBar(nCurrBar).sBarPath & """"
' Else
' vProc(j).Proc.StartInfo.Arguments = """" & vBar(nCurrBar).sBarPath & """ " &
' """" & vBar(nCurrBar).nProjType & """ " &
' """" & vBar(nCurrBar).nMachineName & """ " & vBar(nCurrBar).nCmdType
' End If
' vProc(j).Proc.StartInfo.UseShellExecute = False
' If vProc(j).Proc.Start() Then
' vProc(j).nBar = nCurrBar
' nCurrBar += 1
' nActProc += 1
' End If
' Else
' If vBar(nCurrBar).nCmdType = CmdTypes.CHECK OrElse vBar(nCurrBar).nCmdType = CmdTypes.CHECKGEN Then
' RaiseEvent Calc_ProcessResult(Nothing, New CalcResultEventArgs(vBar(nCurrBar))) 'ProcessResults(vBar(nCurrBar))
' ElseIf vBar(nCurrBar).nCmdType = CmdTypes.GENERATE Then
' RaiseEvent Calc_ProcessResult(Nothing, New CalcResultEventArgs(vBar(nCurrBar))) 'ProcessResults(vBar(nCurrBar))
' 'RaiseEvent Calc_ProcessEnd(Nothing, New CalcProcessEndEventArgs(vBar(nCurrBar))) 'ProcessResults(vBar(nCurrBar))
' End If
' bDone = True
' nCurrBar += 1
' End If
' End If
' Else
' If vProc(j).Proc.HasExited Then
' ' se terminato con successo
' If vProc(j).Proc.ExitCode = 0 Then
' ' salvo il risultato
' If vBar(vProc(j).nBar).nCmdType = CmdTypes.CHECK OrElse vBar(vProc(j).nBar).nCmdType = CmdTypes.CHECKGEN Then
' RaiseEvent Calc_ProcessResult(Nothing, New CalcResultEventArgs(vBar(vProc(j).nBar))) ' ProcessResults(vBar(vProc(j).nBar))
' ElseIf vBar(vProc(j).nBar).nCmdType = CmdTypes.GENERATE Then
' RaiseEvent Calc_ProcessResult(Nothing, New CalcResultEventArgs(vBar(vProc(j).nBar))) ' ProcessResults(vBar(vProc(j).nBar))
' 'RaiseEvent Calc_ProcessEnd(Nothing, New CalcProcessEndEventArgs(vBar(vProc(j).nBar))) 'ProcessResults(vBar(nCurrBar))
' End If
' bDone = True
' vProc(j).nBar = -1
' nActProc -= 1
' ' se superato il numero di processi eseguibili in parallelo
' ElseIf vProc(j).Proc.ExitCode = 1 Then
' ' aggiungo il pezzo in coda
' If numBars + nShiftBar < numBars + nMaxThread Then
' vBar(numBars + nShiftBar) = vBar(vProc(j).nBar)
' nShiftBar += 1
' End If
' ' disabilito il processo
' vProc(j).bEnable = False
' vProc(j).nBar = -1
' nActProc -= 1
' ' altrimenti (errore generico di esecuzione)
' Else
' ' salvo il risultato
' If vBar(vProc(j).nBar).nCmdType = CmdTypes.CHECK OrElse vBar(vProc(j).nBar).nCmdType = CmdTypes.CHECKGEN Then
' RaiseEvent Calc_ProcessResult(Nothing, New CalcResultEventArgs(vBar(vProc(j).nBar))) ' ProcessResults(vBar(vProc(j).nBar))
' ElseIf vBar(vProc(j).nBar).nCmdType = CmdTypes.GENERATE Then
' RaiseEvent Calc_ProcessResult(Nothing, New CalcResultEventArgs(vBar(vProc(j).nBar))) ' ProcessResults(vBar(vProc(j).nBar))
' 'RaiseEvent Calc_ProcessEnd(Nothing, New CalcProcessEndEventArgs(vBar(vProc(j).nBar))) 'ProcessResults(vBar(nCurrBar))
' End If
' bDone = True
' vProc(j).nBar = -1
' nActProc -= 1
' End If
' Else
' vProc(j).Proc.Refresh()
' End If
' End If
' If bDone Then
' ' se sono in simulazione
' If bIsSimulation Then
' Dim sOriPath As String = Path.ChangeExtension(vBar(0).sBarPath, ".ori.bwe")
' ' se file modificato a mano
' If File.GetLastWriteTime(sOriPath) < File.GetLastWriteTime(vBar(0).sBarPath) Then
' ' aggiorno progetto
' If File.Exists(vBar(0).sBarPath) Then File.Copy(vBar(0).sBarPath, sOriPath, True)
' ' messaggio di lancio verifica
' callback(50, "Verifying modifications...", bCancel)
' ' lancio verifica
' System.Threading.Thread.Sleep(500)
' ' messaggio di lancio verifica callback(50, "Verifying modifications...", bCancel) '
' lancio verifica System.Threading.Thread.Sleep(500)
' Dim Proc As New Process()
' Proc.StartInfo.FileName = ExePath
@@ -464,254 +422,180 @@ Public Class Form1
'"""" & vBar(0).nMachineName & """ " & CmdTypes.CHECKGEN
' Proc.StartInfo.UseShellExecute = False
' If Proc.Start() Then
' Dim ProgressValue As Integer = 50
' While Not Proc.HasExited
' Proc.Refresh()
' If ProgressValue < 90 Then ProgressValue += 0.001
' callback(ProgressValue, "Verifying modifications...", bCancel)
' Thread.Sleep(1)
' End While
' ' se terminato con successo
' If Proc.ExitCode = 0 Then
' ' salvo il risultato
' RaiseEvent Calc_ProcessResult(Nothing, New CalcResultEventArgs(vBar(0)))
' Thread.Sleep(500)
' End If
' End If
' End If
' ' messaggio di completamento simulazione
' callback(0, "Simulation closing", bCancel)
' ElseIf bIsEdit Then
' ' ricarico il progetto
' Dim Result As CalcEndEventArgs.Results
' If bAllKO Then
' Result = CalcEndEventArgs.Results.ERROR_
' ElseIf bIsEdit Then
' Result = CalcEndEventArgs.Results.EDIT
' Else
' Result = CalcEndEventArgs.Results.OK
' End If
' RaiseEvent Calc_Ended(Nothing, New CalcEndEventArgs(CmdTypes.EDIT, Result))
' Return
' Else
' ' Dialog con Progress Bar
' nDoneBar += 1
' dProgress = 1 / numBars * nDoneBar
' Dim sProg As String = (dProgress * 100).ToString("F1", CultureInfo.InvariantCulture)
' callback(dProgress, " Progress: " & sProg & "% Count: " & nDoneBar & " / " & numBars, bCancel)
' End If
' If bCancel Then
' ' fine
' callback(1, "", bCancel)
' ' riabilito interfaccia
' RaiseEvent Calc_Ended(Nothing, New CalcEndEventArgs(CmdTypes.CHECKGEN, CalcEndEventArgs.Results.OK))
' Return
' End If
' nPgsCurrBar = 0
' nPgsClock = 0
' Else
' ' se non sono in simulazione
' If Not bIsSimulation AndAlso Not bIsEdit Then
' ' aggiorno conteggio
' If nPgsClock >= 100 AndAlso nPgsCurrBar < 149 Then
' nPgsCurrBar += 1
' dProgress = 1 / numBars * nDoneBar + 1 / numBars / 150 * nPgsCurrBar
' Dim sProg As String = (dProgress * 100).ToString("F1", CultureInfo.InvariantCulture)
' callback(dProgress, " Progress: " & sProg & "% Count: " & nDoneBar & " / " & numBars, bCancel)
' nPgsClock = 0
' End If
' End If
' End If
' nPgsClock += 1
' Thread.Sleep(1)
' Next
' If Proc.Start() Then Dim ProgressValue As Integer = 50 While Not Proc.HasExited
' Proc.Refresh() If ProgressValue < 90 Then ProgressValue += 0.001 callback(ProgressValue,
' "Verifying modifications...", bCancel) Thread.Sleep(1) End While ' se terminato con
' successo If Proc.ExitCode = 0 Then ' salvo il risultato RaiseEvent
' Calc_ProcessResult(Nothing, New CalcResultEventArgs(vBar(0))) Thread.Sleep(500) End If End
' If End If ' messaggio di completamento simulazione callback(0, "Simulation closing",
' bCancel) ElseIf bIsEdit Then ' ricarico il progetto Dim Result As CalcEndEventArgs.Results
' If bAllKO Then Result = CalcEndEventArgs.Results.ERROR_ ElseIf bIsEdit Then Result =
' CalcEndEventArgs.Results.EDIT Else Result = CalcEndEventArgs.Results.OK End If RaiseEvent
' Calc_Ended(Nothing, New CalcEndEventArgs(CmdTypes.EDIT, Result)) Return Else ' Dialog con
' Progress Bar nDoneBar += 1 dProgress = 1 / numBars * nDoneBar Dim sProg As String =
' (dProgress * 100).ToString("F1", CultureInfo.InvariantCulture) callback(dProgress, "
' Progress: " & sProg & "% Count: " & nDoneBar & " / " & numBars, bCancel) End If If bCancel
' Then ' fine callback(1, "", bCancel) ' riabilito interfaccia RaiseEvent
' Calc_Ended(Nothing, New CalcEndEventArgs(CmdTypes.CHECKGEN, CalcEndEventArgs.Results.OK))
' Return End If nPgsCurrBar = 0 nPgsClock = 0 Else ' se non sono in simulazione If Not
' bIsSimulation AndAlso Not bIsEdit Then ' aggiorno conteggio If nPgsClock >= 100 AndAlso
' nPgsCurrBar < 149 Then nPgsCurrBar += 1 dProgress = 1 / numBars * nDoneBar + 1 / numBars /
' 150 * nPgsCurrBar Dim sProg As String = (dProgress * 100).ToString("F1",
' CultureInfo.InvariantCulture) callback(dProgress, " Progress: " & sProg & "% Count: " &
' nDoneBar & " / " & numBars, bCancel) nPgsClock = 0 End If End If End If nPgsClock += 1
' Thread.Sleep(1) Next
' End While
' m_bStopProcess = False
' 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.Append(txtOut.Text) 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()
' End While
' ' scrivo ddf File.WriteAllText(sCurrDdfDir & "\" & nDdfId, item.Value)
' m_bStopProcess = False
' ' eseguo calcolo
' ' costruisco risposta finta di processing con esito true + SVG Dim currRes As New
' CalcResultDTO currRes.Validated = True currRes.DoorIdVers = item.Key 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()
' 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.Append(txtOut.Text)
' 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()
' ' scrivo ddf
' File.WriteAllText(sCurrDdfDir & "\" & nDdfId, item.Value)
' ' eseguo calcolo
' ' costruisco risposta finta di processing con esito true + SVG
' Dim currRes As New CalcResultDTO
' currRes.Validated = True
' currRes.DoorIdVers = item.Key
' 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 If
End Sub
Private Sub btnFullTest_Click(sender As Object, e As EventArgs) Handles btnFullTest.Click
Private Sub StopProcess_Click(sender As Object, e As EventArgs) Handles StopProcess.Click
m_bStopProcess = True
' fix colori
StartProcess.BackColor = ButtonBase.DefaultBackColor
StartProcess.ForeColor = ButtonBase.DefaultForeColor
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
While Not m_bExecutionThreadStoped
Thread.Sleep(10)
End While
m_ExecutionThread = Nothing
End Sub
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
Private Sub ThreadFunction()
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
Dim sExePath As String = "c:\EgtProg\EgtEngine\EgtEngineR32.exe"
Dim sCurrDdfDir As String = "c:\EgtData\WebDoor\Ddf"
While Not m_bStopProcess
' se c'e' qualcosa da processare
If currWDC.numTask2proc > 0 Then
Dim LastRequest As Dictionary(Of String, String) = currWDC.queueList(1)
If LastRequest.Count > 0 Then
Dim Item As KeyValuePair(Of String, String) = LastRequest.First()
Dim bOk As Boolean = Not IsNothing(Item)
If bOk Then
' svuoto vecchio set file della porta richiesta
Dim fileList As String() = Directory.GetFiles(sCurrDdfDir, Item.Key + ".*")
' elimino vecchi
If Not IsNothing(fileList) Then
For Each sFile In fileList
File.Delete(sFile)
Next
End If
' scrivo ddf
Dim sDdfPath As String = sCurrDdfDir & "\" & Item.Key & ".ddf"
Try
File.WriteAllText(sDdfPath, Item.Value)
Catch ex As Exception
bOk = False
End Try
If bOk Then
' eseguo calcolo
Dim Proc As New Process()
Proc.StartInfo.FileName = sExePath
Proc.StartInfo.Arguments = """C:\EgtData\WebDoor\Main.lua""" & " """ & sDdfPath & """"
Proc.StartInfo.UseShellExecute = False
If Proc.Start() Then
While Not Proc.HasExited
Thread.Sleep(1)
End While
Dim procResults As New List(Of CalcResultDTO)
Dim currRes As New CalcResultDTO
Dim fContent As String = ""
' verifico esistenza file svg e lo carico
bOk = GetFileContent(Path.ChangeExtension(sDdfPath, "svg"), fContent)
' invio risposta
currRes.Validated = Proc.ExitCode = 0 AndAlso bOk
currRes.DoorIdVers = Item.Key
' se NON fosse validato --> messo il messaggio...
If (currRes.Validated) Then
currRes.SvgGen = fContent
Else
bOk = GetFileContent(Path.ChangeExtension(sDdfPath, "txt"), fContent)
currRes.ErrorMsg = fContent
End If
procResults.Add(currRes)
Dim respPut As String = currWDC.SendProcResults(procResults)
End If
End If
End If
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 If
End While
End Sub
Private Sub btnResetQueue_Click(sender As Object, e As EventArgs) Handles btnResetQueue.Click
currWDC.ResetQueue()
txtOut.Text = "Queue Resetted!"
End Sub
#End Region
Private Sub btnQueueStatus_Click(sender As Object, e As EventArgs) Handles btnQueueStatus.Click
DisplayQueueStatus()
End Sub
#Region "Private Structs"
Public Sub DisplayQueueStatus()
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
Private Structure MyProc
#Region "Public Fields"
Public bEnable As Boolean
Public nBar As Integer
Public Proc As Process
Public Thread As Thread
#End Region
End Structure
#End Region
End Class
+6 -6
View File
@@ -13,15 +13,15 @@ Option Explicit On
Namespace My
'NOTE: This file is auto-generated; do not modify it directly. To make changes,
' or if you encounter build errors in this file, go to the Project Designer
' (go to Project Properties or double-click the My Project node in
' Solution Explorer), and make changes on the Application tab.
'
Partial Friend Class MyApplication
<Global.System.Diagnostics.DebuggerStepThroughAttribute()> _
<Global.System.Diagnostics.DebuggerStepThroughAttribute()> _
Public Sub New()
MyBase.New(Global.Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows)
Me.IsSingleInstance = false
@@ -29,10 +29,10 @@ Namespace My
Me.SaveMySettingsOnExit = true
Me.ShutDownStyle = Global.Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses
End Sub
<Global.System.Diagnostics.DebuggerStepThroughAttribute()> _
<Global.System.Diagnostics.DebuggerStepThroughAttribute()> _
Protected Overrides Sub OnCreateMainForm()
Me.MainForm = Global.DemoVB.Form1
Me.MainForm = Global.WebDoorSrv.Form1
End Sub
End Class
End Namespace
+14 -13
View File
@@ -11,9 +11,10 @@
Option Strict On
Option Explicit On
Imports System
Namespace My.Resources
'This class was auto-generated by the StronglyTypedResourceBuilder
'class via a tool like ResGen or Visual Studio.
'To add or remove a member, edit your .ResX file then rerun ResGen
@@ -21,40 +22,40 @@ Namespace My.Resources
'''<summary>
''' A strongly-typed resource class, for looking up localized strings, etc.
'''</summary>
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0"), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0"), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _
Friend Module Resources
Private resourceMan As Global.System.Resources.ResourceManager
Private resourceCulture As Global.System.Globalization.CultureInfo
'''<summary>
''' Returns the cached ResourceManager instance used by this class.
'''</summary>
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
Get
If Object.ReferenceEquals(resourceMan, Nothing) Then
Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("DemoVB.Resources", GetType(Resources).Assembly)
Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("WebDoorSrv.Resources", GetType(Resources).Assembly)
resourceMan = temp
End If
Return resourceMan
End Get
End Property
'''<summary>
''' Overrides the current thread's CurrentUICulture property for all
''' resource lookups using this strongly typed resource class.
'''</summary>
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Friend Property Culture() As Global.System.Globalization.CultureInfo
Get
Return resourceCulture
End Get
Set(ByVal value As Global.System.Globalization.CultureInfo)
Set
resourceCulture = value
End Set
End Property
+33 -33
View File
@@ -13,42 +13,42 @@ Option Explicit On
Namespace My
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0"), _
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.5.0.0"), _
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Partial Friend NotInheritable Class MySettings
Inherits Global.System.Configuration.ApplicationSettingsBase
Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings), MySettings)
Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()),MySettings)
#Region "My.Settings Auto-Save Functionality"
#If _MyType = "WindowsForms" Then
Private Shared addedHandler As Boolean
Private Shared addedHandler As Boolean
Private Shared addedHandlerLockObject As New Object
Private Shared addedHandlerLockObject As New Object
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs)
If My.Application.SaveMySettingsOnExit Then
My.Settings.Save()
End If
End Sub
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Private Shared Sub AutoSaveSettings(sender As Global.System.Object, e As Global.System.EventArgs)
If My.Application.SaveMySettingsOnExit Then
My.Settings.Save()
End If
End Sub
#End If
#End Region
Public Shared ReadOnly Property [Default]() As MySettings
Get
#If _MyType = "WindowsForms" Then
If Not addedHandler Then
SyncLock addedHandlerLockObject
If Not addedHandler Then
AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
addedHandler = True
End If
End SyncLock
End If
If Not addedHandler Then
SyncLock addedHandlerLockObject
If Not addedHandler Then
AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
addedHandler = True
End If
End SyncLock
End If
#End If
Return defaultInstance
End Get
@@ -57,16 +57,16 @@ Namespace My
End Namespace
Namespace My
<Global.Microsoft.VisualBasic.HideModuleNameAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute()> _
<Global.Microsoft.VisualBasic.HideModuleNameAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute()> _
Friend Module MySettingsProperty
<Global.System.ComponentModel.Design.HelpKeywordAttribute("My.Settings")> _
Friend ReadOnly Property Settings() As Global.DemoVB.My.MySettings
<Global.System.ComponentModel.Design.HelpKeywordAttribute("My.Settings")> _
Friend ReadOnly Property Settings() As Global.WebDoorSrv.My.MySettings
Get
Return Global.DemoVB.My.MySettings.Default
Return Global.WebDoorSrv.My.MySettings.Default
End Get
End Property
End Module
@@ -6,9 +6,9 @@
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{96266312-9739-4F12-A6C2-16C1CAFDDA6E}</ProjectGuid>
<OutputType>WinExe</OutputType>
<StartupObject>DemoVB.My.MyApplication</StartupObject>
<RootNamespace>DemoVB</RootNamespace>
<AssemblyName>DemoVB</AssemblyName>
<StartupObject>WebDoorSrv.My.MyApplication</StartupObject>
<RootNamespace>WebDoorSrv</RootNamespace>
<AssemblyName>WebDoorSrv</AssemblyName>
<FileAlignment>512</FileAlignment>
<MyType>WindowsForms</MyType>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
@@ -22,7 +22,7 @@
<DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace>
<OutputPath>bin\Debug\</OutputPath>
<DocumentationFile>DemoVB.xml</DocumentationFile>
<DocumentationFile>WebDoorSrv.xml</DocumentationFile>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
@@ -32,7 +32,7 @@
<DefineTrace>true</DefineTrace>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DocumentationFile>DemoVB.xml</DocumentationFile>
<DocumentationFile>WebDoorSrv.xml</DocumentationFile>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
</PropertyGroup>
<PropertyGroup>
@@ -113,6 +113,7 @@
<Compile Include="My Project\Application.Designer.vb">
<AutoGen>True</AutoGen>
<DependentUpon>Application.myapp</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<Compile Include="My Project\Resources.Designer.vb">
<AutoGen>True</AutoGen>
@@ -150,9 +151,9 @@
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\WeebDoorCreator.SDK\WeebDoorCreator.SDK.csproj">
<ProjectReference Include="..\WebDoorCreator.SDK\WebDoorCreator.SDK.csproj">
<Project>{4A07ADFC-CA24-4135-BA97-3B8E5D49BC09}</Project>
<Name>WeebDoorCreator.SDK</Name>
<Name>WebDoorCreator.SDK</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
@@ -170,4 +171,10 @@
</Content>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
<Target Name="AfterBuild">
<ItemGroup>
<MoveToLibFolder Include="$(OutputPath)*.dll ; $(OutputPath)*.pdb ; $(OutputPath)*.xml" />
</ItemGroup>
<Move SourceFiles="@(MoveToLibFolder)" DestinationFolder="$(OutputPath)lib" OverwriteReadOnlyFiles="true" />
</Target>
</Project>
+1
View File
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Bcl.AsyncInterfaces" version="7.0.0" targetFramework="net472" />
<package id="PrettyBin" version="1.1.0" targetFramework="net472" />
<package id="System.Buffers" version="4.5.1" targetFramework="net472" />
<package id="System.Memory" version="4.5.5" targetFramework="net472" />
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net472" />
+2 -2
View File
@@ -3,9 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.5.33530.505
MinimumVisualStudioVersion = 10.0.40219.1
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "DemoVB", "DemoVB\DemoVB.vbproj", "{96266312-9739-4F12-A6C2-16C1CAFDDA6E}"
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "WebDoorSrv", "DemoVB\WebDoorSrv.vbproj", "{96266312-9739-4F12-A6C2-16C1CAFDDA6E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WeebDoorCreator.SDK", "WeebDoorCreator.SDK\WeebDoorCreator.SDK.csproj", "{4A07ADFC-CA24-4135-BA97-3B8E5D49BC09}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebDoorCreator.SDK", "WebDoorCreator.SDK\WebDoorCreator.SDK.csproj", "{4A07ADFC-CA24-4135-BA97-3B8E5D49BC09}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution