diff --git a/CSharpLibrary/obj/x64/Debug/CSharpLibrary.csproj.AssemblyReference.cache b/CSharpLibrary/obj/x64/Debug/CSharpLibrary.csproj.AssemblyReference.cache index c48813d..386888d 100644 Binary files a/CSharpLibrary/obj/x64/Debug/CSharpLibrary.csproj.AssemblyReference.cache and b/CSharpLibrary/obj/x64/Debug/CSharpLibrary.csproj.AssemblyReference.cache differ diff --git a/CSharpLibrary/obj/x64/Debug/CSharpLibrary.csproj.CoreCompileInputs.cache b/CSharpLibrary/obj/x64/Debug/CSharpLibrary.csproj.CoreCompileInputs.cache index c13d0ed..f8e794a 100644 --- a/CSharpLibrary/obj/x64/Debug/CSharpLibrary.csproj.CoreCompileInputs.cache +++ b/CSharpLibrary/obj/x64/Debug/CSharpLibrary.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -d2b932f18ef2e5c798fd58426e0d24aa6cf31e94f0a9380c5153e4ca9c7312e0 +e95e89768799aa70174d795dd6cd51d4394677f14b86bcd305000d17f87ae1d9 diff --git a/CSharpLibrary/obj/x64/Debug/CSharpLibrary.csproj.GenerateResource.cache b/CSharpLibrary/obj/x64/Debug/CSharpLibrary.csproj.GenerateResource.cache index a7e7c1e..15ddacf 100644 Binary files a/CSharpLibrary/obj/x64/Debug/CSharpLibrary.csproj.GenerateResource.cache and b/CSharpLibrary/obj/x64/Debug/CSharpLibrary.csproj.GenerateResource.cache differ diff --git a/CSharpLibrary/obj/x64/Release/CSharpLibrary.csproj.AssemblyReference.cache b/CSharpLibrary/obj/x64/Release/CSharpLibrary.csproj.AssemblyReference.cache index 1a1d7c4..386888d 100644 Binary files a/CSharpLibrary/obj/x64/Release/CSharpLibrary.csproj.AssemblyReference.cache and b/CSharpLibrary/obj/x64/Release/CSharpLibrary.csproj.AssemblyReference.cache differ diff --git a/CSharpLibrary/obj/x64/Release/CSharpLibrary.csproj.GenerateResource.cache b/CSharpLibrary/obj/x64/Release/CSharpLibrary.csproj.GenerateResource.cache index 0b3f110..15ddacf 100644 Binary files a/CSharpLibrary/obj/x64/Release/CSharpLibrary.csproj.GenerateResource.cache and b/CSharpLibrary/obj/x64/Release/CSharpLibrary.csproj.GenerateResource.cache differ diff --git a/CameraMng/FrmMain.designer.vb b/CameraMng/FrmMain.designer.vb index 74805fd..e3d451c 100644 --- a/CameraMng/FrmMain.designer.vb +++ b/CameraMng/FrmMain.designer.vb @@ -30,54 +30,55 @@ Partial Class FrmMain Me.LbFocalLenght = New System.Windows.Forms.Label() Me.TimerZoom = New System.Windows.Forms.Timer(Me.components) Me.GBImgFromCam = New System.Windows.Forms.GroupBox() - Me.BtnDefAree = New System.Windows.Forms.Button() - Me.BtnCorrLens = New System.Windows.Forms.Button() - Me.BtnCorrCompleta = New System.Windows.Forms.Button() - Me.GBCorrected = New System.Windows.Forms.GroupBox() - Me.BtnSave = New System.Windows.Forms.Button() - Me.GBCalibration = New System.Windows.Forms.GroupBox() - Me.Label3 = New System.Windows.Forms.Label() - Me.Label2 = New System.Windows.Forms.Label() - Me.Label1 = New System.Windows.Forms.Label() - Me.lbYmm = New System.Windows.Forms.Label() - Me.lbXmm = New System.Windows.Forms.Label() - Me.PictureBox2 = New System.Windows.Forms.PictureBox() - Me.LbAltRif = New System.Windows.Forms.Label() - Me.LbAltCali = New System.Windows.Forms.Label() - Me.PictureBox1 = New System.Windows.Forms.PictureBox() - Me.BtnAbortCal = New System.Windows.Forms.Button() - Me.BtnSaveCal = New System.Windows.Forms.Button() - Me.ToolStrip1 = New System.Windows.Forms.ToolStrip() - Me.BtnLoad = New System.Windows.Forms.ToolStripButton() - Me.cmdZoomAll = New System.Windows.Forms.ToolStripButton() - Me.BtnZoom11 = New System.Windows.Forms.ToolStripButton() - Me.BtnZoomPan = New System.Windows.Forms.ToolStripButton() - Me.BtnCorrProsp = New System.Windows.Forms.ToolStripButton() - Me.BtnCfg = New System.Windows.Forms.ToolStripButton() - Me.BtnBackG = New System.Windows.Forms.ToolStripButton() - Me.BtnEdgeFinder = New System.Windows.Forms.ToolStripButton() - Me.BtnChangeThreshold = New System.Windows.Forms.ToolStripButton() - Me.BtnIncrTh = New System.Windows.Forms.ToolStripButton() - Me.lbThreshold = New System.Windows.Forms.ToolStripLabel() - Me.btnSearch = New System.Windows.Forms.ToolStripButton() - Me.RefreshCameras = New System.Windows.Forms.ToolStripButton() - Me.StatusStrip1 = New System.Windows.Forms.StatusStrip() - Me.TStatus = New System.Windows.Forms.ToolStripStatusLabel() - Me.ProgressBar = New System.Windows.Forms.ToolStripProgressBar() - Me.lbMousePosmm = New System.Windows.Forms.ToolStripStatusLabel() - Me.TimerMain = New System.Windows.Forms.Timer(Me.components) - Me.GBDefAree = New System.Windows.Forms.GroupBox() - Me.BtnVentosa = New System.Windows.Forms.Button() - Me.BtnExpT = New System.Windows.Forms.Button() - Me.BtnStone = New System.Windows.Forms.Button() - Me.BtnAbortDefAree = New System.Windows.Forms.Button() - Me.BtnSaveAree = New System.Windows.Forms.Button() - Me.ComboBoxCameras = New System.Windows.Forms.ComboBox() - Me.ComboBoxCameraCfg = New System.Windows.Forms.ComboBox() - Me.ImageControl1 = New ImageControl() - Me.Button1 = New System.Windows.Forms.Button() + Me.BtnDefAree = New System.Windows.Forms.Button() + Me.BtnCorrLens = New System.Windows.Forms.Button() + Me.BtnCorrCompleta = New System.Windows.Forms.Button() + Me.GBCorrected = New System.Windows.Forms.GroupBox() + Me.BtnSave = New System.Windows.Forms.Button() + Me.GBCalibration = New System.Windows.Forms.GroupBox() + Me.Label3 = New System.Windows.Forms.Label() + Me.Label2 = New System.Windows.Forms.Label() + Me.Label1 = New System.Windows.Forms.Label() + Me.lbYmm = New System.Windows.Forms.Label() + Me.lbXmm = New System.Windows.Forms.Label() + Me.PictureBox2 = New System.Windows.Forms.PictureBox() + Me.LbAltRif = New System.Windows.Forms.Label() + Me.LbAltCali = New System.Windows.Forms.Label() + Me.PictureBox1 = New System.Windows.Forms.PictureBox() + Me.BtnAbortCal = New System.Windows.Forms.Button() + Me.BtnSaveCal = New System.Windows.Forms.Button() + Me.ToolStrip1 = New System.Windows.Forms.ToolStrip() + Me.BtnLoad = New System.Windows.Forms.ToolStripButton() + Me.cmdZoomAll = New System.Windows.Forms.ToolStripButton() + Me.BtnZoom11 = New System.Windows.Forms.ToolStripButton() + Me.BtnZoomPan = New System.Windows.Forms.ToolStripButton() + Me.BtnCorrProsp = New System.Windows.Forms.ToolStripButton() + Me.BtnCfg = New System.Windows.Forms.ToolStripButton() + Me.BtnBackG = New System.Windows.Forms.ToolStripButton() + Me.BtnEdgeFinder = New System.Windows.Forms.ToolStripButton() + Me.BtnChangeThreshold = New System.Windows.Forms.ToolStripButton() + Me.BtnIncrTh = New System.Windows.Forms.ToolStripButton() + Me.lbThreshold = New System.Windows.Forms.ToolStripLabel() + Me.btnSearch = New System.Windows.Forms.ToolStripButton() + Me.RefreshCameras = New System.Windows.Forms.ToolStripButton() + Me.StatusStrip1 = New System.Windows.Forms.StatusStrip() + Me.TStatus = New System.Windows.Forms.ToolStripStatusLabel() + Me.ProgressBar = New System.Windows.Forms.ToolStripProgressBar() + Me.lbMousePosmm = New System.Windows.Forms.ToolStripStatusLabel() + Me.TimerMain = New System.Windows.Forms.Timer(Me.components) + Me.GBDefAree = New System.Windows.Forms.GroupBox() + Me.BtnVentosa = New System.Windows.Forms.Button() + Me.BtnExpT = New System.Windows.Forms.Button() + Me.BtnStone = New System.Windows.Forms.Button() + Me.BtnAbortDefAree = New System.Windows.Forms.Button() + Me.BtnSaveAree = New System.Windows.Forms.Button() + Me.ComboBoxCameras = New System.Windows.Forms.ComboBox() + Me.ComboBoxCameraCfg = New System.Windows.Forms.ComboBox() Me.BtnEnd = New System.Windows.Forms.Button() Me.BtnTakeFoto = New System.Windows.Forms.Button() + Me.BtnShowMsg = New System.Windows.Forms.Button() + Me.ImageList2 = New System.Windows.Forms.ImageList(Me.components) + Me.ImageControl1 = New ImageControl() Me.GBImgFromCam.SuspendLayout() Me.GBCorrected.SuspendLayout() Me.GBCalibration.SuspendLayout() @@ -414,6 +415,35 @@ Partial Class FrmMain resources.ApplyResources(Me.ComboBoxCameraCfg, "ComboBoxCameraCfg") Me.ComboBoxCameraCfg.Name = "ComboBoxCameraCfg" ' + 'BtnEnd + ' + Me.BtnEnd.Image = Global.My.Resources.Resources._exit + resources.ApplyResources(Me.BtnEnd, "BtnEnd") + Me.BtnEnd.Name = "BtnEnd" + Me.BtnEnd.UseVisualStyleBackColor = True + ' + 'BtnTakeFoto + ' + resources.ApplyResources(Me.BtnTakeFoto, "BtnTakeFoto") + Me.BtnTakeFoto.ImageList = Me.ImageList1 + Me.BtnTakeFoto.Name = "BtnTakeFoto" + Me.BtnTakeFoto.UseVisualStyleBackColor = True + ' + 'BtnShowMsg + ' + resources.ApplyResources(Me.BtnShowMsg, "BtnShowMsg") + Me.BtnShowMsg.ImageList = Me.ImageList2 + Me.BtnShowMsg.Name = "BtnShowMsg" + Me.BtnShowMsg.UseVisualStyleBackColor = True + ' + 'ImageList2 + ' + Me.ImageList2.ImageStream = CType(resources.GetObject("ImageList2.ImageStream"), System.Windows.Forms.ImageListStreamer) + Me.ImageList2.TransparentColor = System.Drawing.Color.Transparent + Me.ImageList2.Images.SetKeyName(0, "accept.png") + Me.ImageList2.Images.SetKeyName(1, "cross.png") + Me.ImageList2.Images.SetKeyName(2, "warning.png") + ' 'ImageControl1 ' resources.ApplyResources(Me.ImageControl1, "ImageControl1") @@ -431,31 +461,12 @@ Partial Class FrmMain Me.ImageControl1.ZoomFactor = 1.0R Me.ImageControl1.ZoomOnMouseWheel = True ' - 'Button1 - ' - resources.ApplyResources(Me.Button1, "Button1") - Me.Button1.Name = "Button1" - Me.Button1.UseVisualStyleBackColor = True - ' - 'BtnEnd - ' - Me.BtnEnd.Image = Global.My.Resources.Resources._exit - resources.ApplyResources(Me.BtnEnd, "BtnEnd") - Me.BtnEnd.Name = "BtnEnd" - Me.BtnEnd.UseVisualStyleBackColor = True - ' - 'BtnTakeFoto - ' - resources.ApplyResources(Me.BtnTakeFoto, "BtnTakeFoto") - Me.BtnTakeFoto.ImageList = Me.ImageList1 - Me.BtnTakeFoto.Name = "BtnTakeFoto" - Me.BtnTakeFoto.UseVisualStyleBackColor = True - ' 'FrmMain ' resources.ApplyResources(Me, "$this") Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font - Me.Controls.Add(Me.Button1) + Me.BackColor = System.Drawing.SystemColors.Control + Me.Controls.Add(Me.BtnShowMsg) Me.Controls.Add(Me.ComboBoxCameraCfg) Me.Controls.Add(Me.ComboBoxCameras) Me.Controls.Add(Me.GBDefAree) @@ -538,5 +549,6 @@ Partial Class FrmMain Friend WithEvents ComboBoxCameras As ComboBox Friend WithEvents ComboBoxCameraCfg As ComboBox Friend WithEvents RefreshCameras As ToolStripButton - Friend WithEvents Button1 As Button + Friend WithEvents BtnShowMsg As Button + Friend WithEvents ImageList2 As ImageList End Class diff --git a/CameraMng/FrmMain.resx b/CameraMng/FrmMain.resx index 1621497..b0afe68 100644 --- a/CameraMng/FrmMain.resx +++ b/CameraMng/FrmMain.resx @@ -128,7 +128,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAAS - TwAAAk1TRnQBSQFMAgEBCQEAAUwBAgFMAQIBMgEAATIBAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo + TwAAAk1TRnQBSQFMAgEBCQEAAZwBAgGcAQIBMgEAATIBAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo AwAByAMAAZYDAAEBAQABCAUAATABdRgAAYACAAGAAwACgAEAAYADAAGAAQABgAEAAoACAAPAAQABwAHc AcABAAHwAcoBpgEAATMFAAEzAQABMwEAATMBAAIzAgADFgEAAxwBAAMiAQADKQEAA1UBAANNAQADQgEA AzkBAAGAAXwB/wEAAlAB/wEAAZMBAAHWAQAB/wHsAcwBAAHGAdYB7wEAAdYC5wEAAZABqQGtAgAB/wEz @@ -478,10 +478,13 @@ - 109, 519 + 145, 639 + + + 4, 0, 4, 0 - 0, 13 + 0, 16 25 @@ -505,10 +508,13 @@ NoControl - 381, 13 + 508, 16 + + + 4, 0, 4, 0 - 0, 13 + 0, 16 31 @@ -532,10 +538,13 @@ NoControl - 10, 175 + 13, 215 + + + 4, 4, 4, 4 - 60, 50 + 80, 62 43 @@ -556,10 +565,13 @@ NoControl - 10, 109 + 13, 134 + + + 4, 4, 4, 4 - 60, 50 + 80, 62 42 @@ -580,10 +592,13 @@ NoControl - 10, 28 + 13, 34 + + + 4, 4, 4, 4 - 60, 50 + 80, 62 39 @@ -601,10 +616,16 @@ 2 - 500, 140 + 667, 172 + + + 4, 4, 4, 4 + + + 4, 4, 4, 4 - 80, 302 + 107, 372 44 @@ -690,10 +711,13 @@ NoControl - 14, 240 + 19, 295 + + + 4, 4, 4, 4 - 60, 50 + 80, 62 22 @@ -711,10 +735,16 @@ 0 - 598, 140 + 797, 172 + + + 4, 4, 4, 4 + + + 4, 4, 4, 4 - 80, 302 + 107, 372 45 @@ -738,10 +768,13 @@ NoControl - 27, 172 + 36, 212 + + + 4, 0, 4, 0 - 69, 13 + 88, 16 56 @@ -768,10 +801,13 @@ NoControl - 6, 218 + 8, 268 + + + 4, 0, 4, 0 - 14, 13 + 16, 16 55 @@ -798,10 +834,13 @@ NoControl - 6, 190 + 8, 234 + + + 4, 0, 4, 0 - 14, 13 + 15, 16 54 @@ -828,10 +867,13 @@ NoControl - 24, 217 + 32, 267 + + + 4, 0, 4, 0 - 76, 21 + 101, 26 53 @@ -855,10 +897,13 @@ NoControl - 24, 187 + 32, 230 + + + 4, 0, 4, 0 - 76, 21 + 101, 26 52 @@ -879,10 +924,13 @@ NoControl - 12, 100 + 16, 123 + + + 4, 4, 4, 4 - 65, 40 + 87, 49 51 @@ -906,10 +954,13 @@ NoControl - 12, 143 + 16, 176 + + + 4, 0, 4, 0 - 65, 21 + 87, 26 50 @@ -933,10 +984,13 @@ NoControl - 12, 53 + 16, 65 + + + 4, 0, 4, 0 - 65, 21 + 87, 26 49 @@ -957,10 +1011,13 @@ NoControl - 12, 23 + 16, 28 + + + 4, 4, 4, 4 - 65, 27 + 87, 33 48 @@ -981,10 +1038,13 @@ NoControl - 14, 266 + 19, 327 + + + 4, 4, 4, 4 - 60, 37 + 80, 46 24 @@ -1073,10 +1133,13 @@ NoControl - 12, 309 + 16, 380 + + + 4, 4, 4, 4 - 60, 50 + 80, 62 23 @@ -1094,10 +1157,16 @@ 10 - 684, 114 + 912, 140 + + + 4, 4, 4, 4 + + + 4, 4, 4, 4 - 108, 365 + 144, 449 46 @@ -1120,7 +1189,7 @@ iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAABlSURBVDhPxZBRCsAwCEM9uufZJTdkWrpoaToKDbyvmodW + YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAABlSURBVDhPxZBRCsAwCEM9uufZJTdkWrpoaToKDbyvmodW ZGdU9UZwZhgbrkJJWvmSjEsqOIFLMC54JVNBQRPgWgxJwCZKA4HdOsdKsUn+g6KARPG3wEiCVUlX/gpW SAJP/8ByOA85jMsZFmo5BQAAAABJRU5ErkJggg== @@ -1129,7 +1198,7 @@ Magenta - 24, 42 + 29, 42 Open picture @@ -1137,7 +1206,7 @@ iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAADjSURBVFhHxZTRDcIwDAU9Avv/MAojMBIoFQ+Vw2nslJiT + YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAADjSURBVFhHxZTRDcIwDAU9Avv/MAojMBIoFQ+Vw2nslJiT nkQF9jupIWbzXMzsbmZXflGByh+vlEqwvFSiV14iMSpfKhEtXypBWFpOmQCLspmivXPBhdmk0YETs4s4 FzqY+9MuuCgK59rnoUT7gTf4K4FDiX25N5iFc/vdXxIs95KF88xbIlLekoXzXjaJ6BWbhfNeNoHoPZ+F 88zHOfAkBJ+jcK5bLigh+ByFc4fl4u8XUeOvV7GHFs3mNFyYzTLKinqUCvAvOsr0gTsiKrGkXIwklpaL @@ -1148,7 +1217,7 @@ Magenta - 24, 42 + 29, 42 Zoom All @@ -1156,7 +1225,7 @@ iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIFSURBVDhPpZLtS1NhGMbPPxJmmlYSgqHiKzGU1EDxg4iK + YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAAIFSURBVDhPpZLtS1NhGMbPPxJmmlYSgqHiKzGU1EDxg4iK YKyG2WBogqMYJQOtCEVRFBGdTBCJfRnkS4VaaWNT5sqx1BUxRXxDHYxAJLvkusEeBaPAB+5z4Jzn+t3X /aLhnEfjo8m+dCoa+7/C3O2Hqe0zDC+8KG+cRZHZhdzaaWTVTCLDMIY0vfM04Nfh77/G/sEhwpEDbO3t I7TxE8urEVy99fT/AL5gWDLrTB/hnF4XsW0khCu5ln8DmJliT2AXrcNBsU1gj/MH4nMeKwBrPktM28xM @@ -1172,7 +1241,7 @@ Magenta - 26, 42 + 32, 42 1:1 @@ -1181,7 +1250,7 @@ Magenta - 24, 42 + 29, 42 ToolStripButton1 @@ -1189,7 +1258,7 @@ iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAJcEhZcwAAD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397,7 @@ Magenta - 24, 42 + 29, 42 ToolStripButton1 @@ -1340,7 +1409,7 @@ 0, 0 - 795, 45 + 1060, 45 101 @@ -1364,7 +1433,7 @@ 479, 12 - 67, 17 + 86, 20 Not Started @@ -1373,19 +1442,22 @@ No - 150, 16 + 200, 18 - 30, 17 + 38, 20 X Y - 0, 550 + 0, 678 + + + 1, 0, 19, 0 - 795, 22 + 1060, 26 102 @@ -1412,10 +1484,13 @@ NoControl - 18, 111 + 24, 137 + + + 4, 4, 4, 4 - 60, 37 + 80, 46 29 @@ -1439,10 +1514,13 @@ NoControl - 18, 23 + 24, 28 + + + 4, 4, 4, 4 - 60, 37 + 80, 46 28 @@ -1466,10 +1544,13 @@ NoControl - 18, 66 + 24, 81 + + + 4, 4, 4, 4 - 60, 37 + 80, 46 27 @@ -1493,10 +1574,13 @@ NoControl - 16, 201 + 21, 247 + + + 4, 4, 4, 4 - 60, 37 + 80, 46 26 @@ -1585,10 +1669,13 @@ NoControl - 16, 251 + 21, 309 + + + 4, 4, 4, 4 - 60, 50 + 80, 62 25 @@ -1606,10 +1693,16 @@ 4 - 586, 48 + 781, 59 + + + 4, 4, 4, 4 + + + 4, 4, 4, 4 - 97, 317 + 129, 390 103 @@ -1627,13 +1720,13 @@ 3 - 465, 10 + 620, 12 - 2, 2, 2, 2 + 3, 2, 3, 2 - 129, 21 + 171, 24 1 @@ -1651,13 +1744,13 @@ 2 - 598, 11 + 797, 14 - 2, 2, 2, 2 + 3, 2, 3, 2 - 81, 21 + 107, 24 0 @@ -1674,68 +1767,17 @@ 1 - - Top, Bottom, Left, Right - - - 15, 70 - - - 4, 4, 4, 4 - - - 546, 554 - - - 35 - - - ImageControl1 - - - ImageControl, CameraMng, Version=2.7.7.1, Culture=neutral, PublicKeyToken=null - - - $this - - - 10 - - - NoControl - - - 693, 11 - - - 87, 23 - - - 104 - - - Configurazione - - - Button1 - - - System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 0 - NoControl - 724, 504 + 965, 620 + + + 4, 4, 4, 4 - 60, 50 + 80, 62 22 @@ -1759,10 +1801,13 @@ NoControl - 696, 58 + 928, 71 + + + 4, 4, 4, 4 - 60, 50 + 80, 62 4 @@ -1779,6 +1824,120 @@ 13 + + 0 + + + 585, 9 + + + + AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w + LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 + ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAB+ + CwAAAk1TRnQBSQFMAgEBAwEAAUgBAAFIAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo + AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA + AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5 + AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA + AWYDAAGZAwABzAIAATMDAAIzAgABMwFmAgABMwGZAgABMwHMAgABMwH/AgABZgMAAWYBMwIAAmYCAAFm + AZkCAAFmAcwCAAFmAf8CAAGZAwABmQEzAgABmQFmAgACmQIAAZkBzAIAAZkB/wIAAcwDAAHMATMCAAHM + AWYCAAHMAZkCAALMAgABzAH/AgAB/wFmAgAB/wGZAgAB/wHMAQABMwH/AgAB/wEAATMBAAEzAQABZgEA + ATMBAAGZAQABMwEAAcwBAAEzAQAB/wEAAf8BMwIAAzMBAAIzAWYBAAIzAZkBAAIzAcwBAAIzAf8BAAEz + AWYC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BBAABgAEBAYAFAAGAAQABgBkAAYAHAAGAAQEGAAGAAQEGAAHAAQMGAAHg + AQcGAAHwAQ8CAAGAAQABgAEAAfABDwIAAYABAQGAAQAB+AEPAgABwAEDAYABAQH4AR8CAAHwAQ8B8AEP + AfwBPwIACw== + + + + NoControl + + + 912, 14 + + + 24, 24 + + + 105 + + + BtnShowMsg + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 0 + + + Top, Bottom, Left, Right + + + 20, 86 + + + 5, 5, 5, 5 + + + 727, 681 + + + 35 + + + ImageControl1 + + + ImageControl, CameraMng, Version=2.7.8.1, Culture=neutral, PublicKeyToken=null + + + $this + + + 10 + True @@ -1786,10 +1945,13 @@ 25 - 6, 13 + 8, 16 - 795, 572 + 1060, 704 + + + 4, 4, 4, 4 CenterScreen @@ -1917,6 +2079,12 @@ System.Windows.Forms.Timer, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + ImageList2 + + + System.Windows.Forms.ImageList, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + FrmMain diff --git a/CameraMng/FrmMain.vb b/CameraMng/FrmMain.vb index 6fb9f21..0c48b72 100644 --- a/CameraMng/FrmMain.vb +++ b/CameraMng/FrmMain.vb @@ -23,6 +23,7 @@ Public Class FrmMain DefVentosa End Enum + ' Inn sequenza in funzione della gravità dell'errore Private Enum ReadCfgResult OK WARNING @@ -42,6 +43,8 @@ Public Class FrmMain m_sDataRoot = GetIniValue("Data", "DataRoot", Application.StartupPath & "\DataRoot.ini") End Sub + Private sMsgErr As String = String.Empty + Private m_Image As System.Drawing.Image Private m_ZoomFactor As Double ' Permette di aggiornare la pagina principale del programma 'SetFormStatus()' @@ -85,7 +88,7 @@ Public Class FrmMain End If Else BtnTakeFoto.ImageIndex = 1 - TStatus.Text = "--" + TStatus.Text = " --- " End If BtnCfg.Visible = bExtended @@ -93,6 +96,8 @@ Public Class FrmMain BtnVentosa.Visible = VacuumCheckEnable btnSearch.Visible = VacuumCheckEnable + ComboBoxCameras.Visible = False + Select Case status Case en_status.NoImage GBCalibration.Visible = False @@ -194,11 +199,11 @@ Public Class FrmMain Dim sTextMsg As String = String.Format("L'identificativo della camera della configurazione corrente non è disponibile. " & "Verificare che sia accessa oppure che esista. ") MessageBox.Show(sTextMsg, "Avvertenza", MessageBoxButtons.OK, MessageBoxIcon.Warning) - ComboBoxCameras.SelectedIndex = 0 + ComboBoxCameras.SelectedIndex = -1 End If ' Attivo la If Not ModalitaNascosta Then - Camera.Connect(ComboBoxCameras.SelectedItem) + If ComboBoxCameras.SelectedIndex > -1 Then Camera.Connect(ComboBoxCameras.SelectedItem) Else Camera.Connect(CameraID) End If @@ -224,18 +229,22 @@ Public Class FrmMain End If Next If Not IsCfgValid Then + 'If Not ModalitaNascosta Then ' Non esiste una configurazione Dim sTextMsg As String = String.Format("Nessuna configurazione presenta una connessione alla camera valida. " & - "Nel file 'CamaeraMng.cgf' il campo 'CameraID' è vuoto o non assente. ") - MessageBox.Show(sTextMsg, "Avvertenza", MessageBoxButtons.OK, MessageBoxIcon.Warning) - ComboBoxCameraCfg.SelectedIndex = 0 - End If + "Nel file 'CamaeraMng.cgf' il campo 'CameraID' è vuoto o assente. ") + MessageBox.Show(sTextMsg, "Avvertenza", MessageBoxButtons.OK, MessageBoxIcon.Warning) + ComboBoxCameraCfg.SelectedIndex = 0 + 'End If + End If Else + 'If Not ModalitaNascosta Then ' Non esiste una configurazione Dim sTextMsg As String = String.Format("Nella cartella '{0}' non sono state trovate configurazioni valide. " & "(CameraMng, CameraMng1, CameraMng2..)", sDataRoot) - MessageBox.Show(sTextMsg, "Avvertenza", MessageBoxButtons.OK, MessageBoxIcon.Warning) - Return False + MessageBox.Show(sTextMsg, "Avvertenza", MessageBoxButtons.OK, MessageBoxIcon.Warning) + Return False + 'End If End If Return True End Function @@ -264,7 +273,6 @@ Public Class FrmMain ProgressBar.Maximum = 100 ProgressBar.Value = 0 - SetFormStatus() ' carico elenco camere attive è creo la connessione LoadCamerasList() @@ -274,11 +282,6 @@ Public Class FrmMain SpessLastra = ImageMng.ZCali FrmStart.Close() - 'If Camera.Connected And RichiestaFoto Then - ' Camera.TakeFoto() - ' RichiestaFoto = False - 'End If - If VacuumCheckEnable Then TimerMain.Enabled = True End If @@ -399,36 +402,37 @@ Public Class FrmMain Next End Sub - ' Costruisco il percorso del file letto da configurazione - Private Sub IsCorrectFilePathReadFromCfg(DirToReadCfg As String, ByRef sStringPath As String, ByRef sMsg As String) - Dim bOk As ReadCfgResult = ReadCfgResult.OK - + ' Costruisco il percorso del file letto da configurazione: restituisco l'esito dell'operazione (Nel riferimento restituisco la sintesi dell'operazione di lettura) + Private Function IsCorrectFilePathReadFromCfg(DirToReadCfg As String, ByRef sStringPath As String, ByRef sMsg As String, ByRef CfgResult As ReadCfgResult) As ReadCfgResult + Dim CurrCfgResult As ReadCfgResult = ReadCfgResult.OK sStringPath = sStringPath.Trim If Not sStringPath.StartsWith("\") And Not sStringPath.StartsWith(".\") Then ' Warning! il percorso potrebbe non essere relativo If sStringPath.Contains("CameraMng") Then ' Errore! il percorso contiene un riferimento alla cartella - bOk = ReadCfgResult.ERR0 + CurrCfgResult = ReadCfgResult.ERR0 Else - bOk = ReadCfgResult.WARNING + CurrCfgResult = ReadCfgResult.WARNING sStringPath = DirToReadCfg & "\" & sStringPath End If Else ' OK! il percorso è potenzialmente correto If sStringPath.Contains("\CameraMng") Then ' Errore! il percorso contiene un riferimento alla cartella - bOk = ReadCfgResult.ERR1 + CurrCfgResult = ReadCfgResult.ERR1 Else ' rimuovo il primo carattere se è il punto (".") If sStringPath.StartsWith(".") Then sStringPath.Remove(0, 1) ' Ok! il percorso è accettato - bOk = ReadCfgResult.OK + CurrCfgResult = ReadCfgResult.OK sStringPath = DirToReadCfg & sStringPath End If End If - CreateMsgTextErr(bOk, sStringPath, sMsg) - - End Sub + CreateMsgTextErr(CurrCfgResult, sStringPath, sMsg) + ' Valuto se il risultato restituito deve modificare il + CfgResult = SetIcoResultCfg(CfgResult, CurrCfgResult) + Return CurrCfgResult + End Function Private Sub CreateMsgTextErr(ReadCfg As ReadCfgResult, sStringPath As String, ByRef sMsg As String) Select Case ReadCfg @@ -441,6 +445,13 @@ Public Class FrmMain End Select End Sub + Private Function SetIcoResultCfg(ResultCfg As ReadCfgResult, CurrResultCfg As ReadCfgResult) As ReadCfgResult + If CurrResultCfg > ResultCfg Then + ResultCfg = CurrResultCfg + End If + Return ResultCfg + End Function + ' procedo alla lettura del file *.cfg Private Sub LeggiFileConfigurazione() @@ -462,7 +473,8 @@ Public Class FrmMain DirToReadCfg = DirToReadCfg & MainModule.IndexProc End If - Dim sMsgErr As String = String.Empty + Dim CfgResult As ReadCfgResult = ReadCfgResult.OK + sMsgErr = String.Empty ' Console.WriteLine("LETTURA CONFIGURAZIONE: " & MainModule.IndexProc & " -- " & DirToReadCfg) @@ -493,6 +505,7 @@ Public Class FrmMain VacDirModels = "" bExtended = False bBtnLoad = False + CameraID = "" reader = New StreamReader(NomeFileCfg) nfi.NumberDecimalSeparator = "." @@ -503,15 +516,15 @@ Public Class FrmMain TmpString = reader.ReadLine() If TmpString.StartsWith("FileCali=") Then FileLensCalib = Mid(TmpString, 10) - IsCorrectFilePathReadFromCfg(DirToReadCfg, FileLensCalib, sMsgErr) + IsCorrectFilePathReadFromCfg(DirToReadCfg, FileLensCalib, sMsgErr, CfgResult) ElseIf TmpString.StartsWith("LensCalibType=") Then LensCalibType = Convert.ToInt16(Mid(TmpString, 15)) ElseIf TmpString.StartsWith("FileCaliProsp=") Then FileCalibProsp = Mid(TmpString, 15) - IsCorrectFilePathReadFromCfg(DirToReadCfg, FileCalibProsp, sMsgErr) + IsCorrectFilePathReadFromCfg(DirToReadCfg, FileCalibProsp, sMsgErr, CfgResult) ElseIf TmpString.StartsWith("FileCaliRes=") Then FileCalibRes = Mid(TmpString, 13) - IsCorrectFilePathReadFromCfg(DirToReadCfg, FileCalibRes, sMsgErr) + IsCorrectFilePathReadFromCfg(DirToReadCfg, FileCalibRes, sMsgErr, CfgResult) ElseIf TmpString.StartsWith("Extended=") Then bExtended = CInt(TmpString.Substring(9)) > 0 'lascio vedere tutti i bottoni BtnCfg.Visible = bExtended @@ -521,10 +534,10 @@ Public Class FrmMain BtnLoad.Visible = bExtended ElseIf TmpString.StartsWith("SaveDir=") Then SaveDir = Mid(TmpString, 9) - IsCorrectFilePathReadFromCfg(DirToReadCfg, SaveDir, sMsgErr) + IsCorrectFilePathReadFromCfg(DirToReadCfg, SaveDir, sMsgErr, CfgResult) ElseIf TmpString.StartsWith("TmpDir=") Then DirTmp = Mid(TmpString, 8) - IsCorrectFilePathReadFromCfg(DirToReadCfg, DirTmp, sMsgErr) + IsCorrectFilePathReadFromCfg(DirToReadCfg, DirTmp, sMsgErr, CfgResult) ElseIf TmpString.StartsWith("MaxPxWidth=") Then TmpInt = Convert.ToInt16(Mid(TmpString, 12)) If TmpInt > 0 Then ImageMng.MaxPxWidthOutImage = TmpInt @@ -532,7 +545,7 @@ Public Class FrmMain _visione.ReduceImage = CInt(TmpString.Substring(11)) 'pyr_down nel riconoscimento bordi ElseIf TmpString.StartsWith("LogDir=") Then SaveLogDir = Mid(TmpString, 8) - IsCorrectFilePathReadFromCfg(DirToReadCfg, SaveLogDir, sMsgErr) + IsCorrectFilePathReadFromCfg(DirToReadCfg, SaveLogDir, sMsgErr, CfgResult) ElseIf TmpString.StartsWith("CameraID=") Then CameraID = Mid(TmpString, 10) CfgForm.LbCfgCameraID.Text = CameraID @@ -574,16 +587,16 @@ Public Class FrmMain VacuumCheckEnable = TmpInt > 0 ElseIf TmpString.StartsWith("VacFileStart=") Then VacFileStart = Mid(TmpString, Len("StartVacFile=") + 1) - IsCorrectFilePathReadFromCfg(DirToReadCfg, VacFileStart, sMsgErr) + IsCorrectFilePathReadFromCfg(DirToReadCfg, VacFileStart, sMsgErr, CfgResult) ElseIf TmpString.StartsWith("VacFilePos=") Then VacFilePos = Mid(TmpString, Len("VacFilePos=") + 1) - IsCorrectFilePathReadFromCfg(DirToReadCfg, VacFilePos, sMsgErr) + IsCorrectFilePathReadFromCfg(DirToReadCfg, VacFilePos, sMsgErr, CfgResult) ElseIf TmpString.StartsWith("VacFileEnd=") Then VacFileEnd = Mid(TmpString, Len("VacFileEnd=") + 1) - IsCorrectFilePathReadFromCfg(DirToReadCfg, VacFileEnd, sMsgErr) + IsCorrectFilePathReadFromCfg(DirToReadCfg, VacFileEnd, sMsgErr, CfgResult) ElseIf TmpString.StartsWith("VacDirModels=") Then VacDirModels = Mid(TmpString, Len("VacDirModels=") + 1) - IsCorrectFilePathReadFromCfg(DirToReadCfg, VacDirModels, sMsgErr) + IsCorrectFilePathReadFromCfg(DirToReadCfg, VacDirModels, sMsgErr, CfgResult) ElseIf TmpString.StartsWith("VacMinScore=") Then VacMinScore = Convert.ToDouble(Mid(TmpString, Len("VacMinScore=") + 1), nfi) ElseIf TmpString.StartsWith("VacTolmm=") Then @@ -593,10 +606,29 @@ Public Class FrmMain reader.Close() reader.Dispose() - If Not String.IsNullOrEmpty(sMsgErr) And Not ModalitaNascosta Then - MessageBox.Show(sMsgErr, NomeFileCfg, MessageBoxButtons.OK, MessageBoxIcon.Hand) + ' Gestione dell'icone del bottone per esito lettura configurazione + Dim nIndexIcoCfg As Integer = 0 + Select Case CfgResult + Case ReadCfgResult.OK + nIndexIcoCfg = 0 + Case ReadCfgResult.WARNING + nIndexIcoCfg = 2 + Case ReadCfgResult.ERR0, ReadCfgResult.ERR1 + nIndexIcoCfg = 1 + End Select + + If Not String.IsNullOrEmpty(sMsgErr) Then + If Not ModalitaNascosta Then + BtnShowMsg.ImageIndex = nIndexIcoCfg + BtnShowMsg.Visible = True + Else + Console.WriteLine("ERRORE LETTURA CONFIGURAZIONE: " & MainModule.IndexProc & " -- " & sMsgErr) + End If Else - Console.WriteLine("ERRORE LETTURA CONFIGURAZIONE: " & MainModule.IndexProc & " -- " & sMsgErr) + If Not ModalitaNascosta Then + BtnShowMsg.ImageIndex = nIndexIcoCfg + BtnShowMsg.Visible = False + End If End If Catch ex As Exception @@ -1148,14 +1180,18 @@ Public Class FrmMain #If WinXp Then strWinXP = " (WinXP)" #End If + Dim ver As String = My.Application.Info.Version.Major.ToString() & "." & + My.Application.Info.Version.Minor.ToString() & + (ChrW(97 - 1 + My.Application.Info.Version.Build)).ToString() & + My.Application.Info.Version.Revision.ToString() - Me.Text = "EgalTech Camera Manager" & strWinXP & " v" & System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString() + Me.Text = "EgalTech Camera Manager" & strWinXP & " v" & ver BtnLoad.Visible = bExtended ImageControl1.PanMode = True ' Carico la configurazione corrente Inizializza() - TStatus.Text = "Initialized" + ' TStatus.Text = "Initialized" If ModalitaNascosta Then Me.Visible = False ' Avvio su un nuvo processo la comunicazione con il programma OmagCUT @@ -1232,7 +1268,10 @@ Public Class FrmMain CfgForm.LbDeviceStatus.Text = If(Camera.Connected, "Connected", "Disconnected") ' assegnato solo dall'evento connessione, perciò lo ribadisco CfgForm.LbCameraID.Text = Camera.CameraID - CfgForm.ShowDialog() + ' CfgForm.ShowDialog() + + ' Nuova gestione della pagina delle configurazioni + SetConfigForm.ShowDialog() End Sub Private Sub BtnEnd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnEnd.Click @@ -1825,9 +1864,9 @@ Public Class FrmMain Private Sub ComboBoxCameras_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBoxCameras.SelectedIndexChanged If Not ModalitaNascosta Then - LeggiFileConfigurazione() - SetFormStatus() + ' LeggiFileConfigurazione() Camera.Connect(ComboBoxCameras.SelectedItem) + SetFormStatus() End If End Sub @@ -1847,6 +1886,7 @@ Public Class FrmMain sTextMsg &= ": " & CameraID & "' non è valido." End If MessageBox.Show(sTextMsg, "Avvertenza", MessageBoxButtons.OK, MessageBoxIcon.Error) + ComboBoxCameras.SelectedIndex = -1 End If End If ImageMng.m_fileCaliLensRead = False @@ -1860,8 +1900,9 @@ Public Class FrmMain LoadCamerasList() End Sub - Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click - SetConfigForm.ShowDialog() + Private Sub BtnShowMsg_Click(sender As Object, e As EventArgs) Handles BtnShowMsg.Click + Dim sTitle As String = "Esito lettura configurazione " & ComboBoxCameraCfg.SelectedItem + MessageBox.Show(sMsgErr, sTitle, MessageBoxButtons.OK, MessageBoxIcon.Exclamation) End Sub #End Region ' Events diff --git a/CameraMng/My Project/AssemblyInfo.vb b/CameraMng/My Project/AssemblyInfo.vb index fd841b5..ad11cb8 100644 --- a/CameraMng/My Project/AssemblyInfo.vb +++ b/CameraMng/My Project/AssemblyInfo.vb @@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices ' by using the '*' as shown below: ' - - + + diff --git a/CameraMng/SetConfigForm.Designer.vb b/CameraMng/SetConfigForm.Designer.vb index 6010a9d..daf9558 100644 --- a/CameraMng/SetConfigForm.Designer.vb +++ b/CameraMng/SetConfigForm.Designer.vb @@ -57,7 +57,7 @@ Partial Class SetConfigForm Me.DataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize Me.DataGridView1.Columns.AddRange(New System.Windows.Forms.DataGridViewColumn() {Me.Config, Me.ImageConfig, Me.ComboCamera, Me.ImageCamera, Me.SaveConfig, Me.ApplyConfig}) Me.DataGridView1.Location = New System.Drawing.Point(47, 31) - Me.DataGridView1.Margin = New System.Windows.Forms.Padding(4, 4, 4, 4) + Me.DataGridView1.Margin = New System.Windows.Forms.Padding(4) Me.DataGridView1.Name = "DataGridView1" Me.DataGridView1.RowHeadersWidth = 51 Me.DataGridView1.Size = New System.Drawing.Size(788, 196) @@ -68,7 +68,7 @@ Partial Class SetConfigForm ' Me.PictureBox1.Image = Global.My.Resources.Resources.accept Me.PictureBox1.Location = New System.Drawing.Point(39, 59) - Me.PictureBox1.Margin = New System.Windows.Forms.Padding(4, 4, 4, 4) + Me.PictureBox1.Margin = New System.Windows.Forms.Padding(4) Me.PictureBox1.Name = "PictureBox1" Me.PictureBox1.Size = New System.Drawing.Size(39, 33) Me.PictureBox1.TabIndex = 1 @@ -78,7 +78,7 @@ Partial Class SetConfigForm ' Me.PictureBox2.Image = Global.My.Resources.Resources.warning Me.PictureBox2.Location = New System.Drawing.Point(39, 102) - Me.PictureBox2.Margin = New System.Windows.Forms.Padding(4, 4, 4, 4) + Me.PictureBox2.Margin = New System.Windows.Forms.Padding(4) Me.PictureBox2.Name = "PictureBox2" Me.PictureBox2.Size = New System.Drawing.Size(39, 33) Me.PictureBox2.TabIndex = 2 @@ -88,7 +88,7 @@ Partial Class SetConfigForm ' Me.PictureBox3.Image = Global.My.Resources.Resources.cross Me.PictureBox3.Location = New System.Drawing.Point(39, 153) - Me.PictureBox3.Margin = New System.Windows.Forms.Padding(4, 4, 4, 4) + Me.PictureBox3.Margin = New System.Windows.Forms.Padding(4) Me.PictureBox3.Name = "PictureBox3" Me.PictureBox3.Size = New System.Drawing.Size(39, 32) Me.PictureBox3.TabIndex = 3 @@ -120,9 +120,9 @@ Partial Class SetConfigForm Me.GroupBox1.Controls.Add(Me.PictureBox2) Me.GroupBox1.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.GroupBox1.Location = New System.Drawing.Point(47, 245) - Me.GroupBox1.Margin = New System.Windows.Forms.Padding(4, 4, 4, 4) + Me.GroupBox1.Margin = New System.Windows.Forms.Padding(4) Me.GroupBox1.Name = "GroupBox1" - Me.GroupBox1.Padding = New System.Windows.Forms.Padding(4, 4, 4, 4) + Me.GroupBox1.Padding = New System.Windows.Forms.Padding(4) Me.GroupBox1.Size = New System.Drawing.Size(788, 209) Me.GroupBox1.TabIndex = 5 Me.GroupBox1.TabStop = False @@ -216,6 +216,7 @@ Partial Class SetConfigForm ' Me.ImageConfig.FillWeight = 53.93283! Me.ImageConfig.HeaderText = "Result Cfg" + Me.ImageConfig.Image = Global.My.Resources.Resources.warning Me.ImageConfig.MinimumWidth = 6 Me.ImageConfig.Name = "ImageConfig" ' @@ -255,7 +256,7 @@ Partial Class SetConfigForm Me.ClientSize = New System.Drawing.Size(884, 469) Me.Controls.Add(Me.GroupBox1) Me.Controls.Add(Me.DataGridView1) - Me.Margin = New System.Windows.Forms.Padding(4, 4, 4, 4) + Me.Margin = New System.Windows.Forms.Padding(4) Me.Name = "SetConfigForm" Me.Text = "SetConfigForm" CType(Me.DataGridView1, System.ComponentModel.ISupportInitialize).EndInit() diff --git a/CameraMng/SetConfigForm.vb b/CameraMng/SetConfigForm.vb index be7fefe..0499769 100644 --- a/CameraMng/SetConfigForm.vb +++ b/CameraMng/SetConfigForm.vb @@ -1,17 +1,48 @@ Imports System.Globalization Imports System.IO +Imports Emgu.CV.Flann Public Class SetConfigForm - Private CameraListCfg As New List(Of String) - Private myImage As Image + Private Const IdCamEmpty As String = " --- " - Private CurrIndexRow As Integer = 0 - Private CurrAppliedConfig As String = 0 - Private bIsSavedAll As Boolean = True - Private IDConfig As String = String.Empty - Private IDCamera As String = String.Empty - Private IndexCurrentRow As Integer = 0 + Private m_myImage As Image + + Private m_UpdatingDataSource As Boolean = False + + ' Indice della riga correntemente selezionata + Private m_nCurrIndexRow As Integer = 0 + ' Nome della configurazione corrente del programma + Private m_sCurrAppliedIdCfg As String = 0 + + Private Enum ICO + ERR_ = -1 + WARNING_ = 0 + OK_ = 2 + End Enum + + Private Enum COLUMN + ID_CFG = 0 + CFG_ICO = 1 + ID_CAM = 2 + CAM_ICO = 3 + SAVE_CMD = 4 + APPLY_CMD = 5 + End Enum + + ' Elementi che popolano la lista delle camere disponibili + Private Structure EbnableCamItem + ' Indica l'Id della camera + Public IdCam As String + ' Indica se l'Id è già stato assegnato ad una configurazione + Public IsEnable As Boolean + ' Indice se l'Id della camera è connessa + Public IsConnected As Boolean + ' Indica l'id della configurazione in cui è in uso + Public IdCfg As List(Of String) + End Structure + ' Lista degli Id REALMENTE disponibili + Private EnableCamList As New List(Of EbnableCamItem) Sub New() @@ -21,192 +52,177 @@ Public Class SetConfigForm ' Aggiungere le eventuali istruzioni di inizializzazione dopo la chiamata a InitializeComponent(). End Sub + ' OK: popolo la datagrid all'avvio del programma Private Sub LoadWindows() Handles Me.Load - PopolateDataGrid() + EnableCamList.Clear() + ' Preparo lisra EnableCamList + LoadListOfEnableCamItem() + ' Popola la DataGridView e al caricamento seleziono la riga del'IdCfg impostato + PopolateDataGrid(True) + ' recupero il nome della configurazione impostata + m_sCurrAppliedIdCfg = If(FrmMain.ComboBoxCameraCfg.SelectedItem.Equals("Default"), "0", FrmMain.ComboBoxCameraCfg.SelectedItem) + End Sub - CurrAppliedConfig = If(FrmMain.ComboBoxCameraCfg.SelectedItem.Equals("Default"), "0", FrmMain.ComboBoxCameraCfg.SelectedItem) +#Region "METODI GESTIONE COMBOBOX" + ' ------- INIZIO ------- gestione EnableCamList ---------------------------- - ' Deseleziona tutte le righe attualmente selezionate (opzionale ma consigliato) - DataGridView1.ClearSelection() - ' Verifica che la griglia non sia vuota - If DataGridView1.Rows.Count > 0 Then - ' Imposta la cella corrente alla prima cella della prima riga - DataGridView1.CurrentCell = DataGridView1.Rows(CurrAppliedConfig).Cells(0) - DataGridView1.Rows(CurrAppliedConfig).Selected = True + ' OK: Costruisco la lista EnableCamList sulla base delle configurazioni salvate + Private Sub LoadListOfEnableCamItem() + Dim DirToReadCfg As String = FrmMain.sDataRoot + + ' Assegnno di defualt una camera VUOTA + Dim NOCam As EbnableCamItem + NOCam.IdCam = IdCamEmpty + NOCam.IsEnable = True + NOCam.IsConnected = False + NOCam.IdCfg = New List(Of String) + EnableCamList.Add(NOCam) + ' Inizializzo la lista con le camere realmente disponibili (IsEnable=true) + For Each CameraItem As String In FrmMain.ComboBoxCameras.Items + Dim ItemCam As EbnableCamItem + ItemCam.IdCam = CameraItem + ItemCam.IsEnable = True + ItemCam.IsConnected = True + ItemCam.IdCfg = New List(Of String) + EnableCamList.Add(ItemCam) + Next + + ' Per ogni camera disponibile assegno l'ID della configuraione associata + For Each CfgItem As String In FrmMain.ComboBoxCameraCfg.Items + CfgItem = If(CfgItem = "Default", String.Empty, CfgItem) + Dim NomeFileCfg As String = DirToReadCfg & CfgItem & "\CameraMng.cfg" + ' Recupero l'Id della camera configurata nel file Cfg + Dim IDCameraFromCgf As String = ReadIdCameraFromCfg(NomeFileCfg) + ' Se esiste l'Id + If Not String.IsNullOrEmpty(IDCameraFromCgf) Then + + ' Verifico se l'Id della camera è connessa + Dim IndID As Integer = EnableCamList.FindIndex(Function(x) x.IdCam = IDCameraFromCgf) + If IndID < 0 Then + ' l'Id della camera non è nell'elenco delle camere connesse: lo aggiungo + Dim ItemCam As EbnableCamItem + ItemCam.IdCam = IDCameraFromCgf + ItemCam.IsEnable = False + ItemCam.IsConnected = False + ItemCam.IdCfg = New List(Of String)({CfgItem}) + EnableCamList.Add(ItemCam) + Else + ' Recupero l'oggetto associato alla camera corrente + Dim CurrCam As EbnableCamItem = EnableCamList(IndID) + ' l'Id della camera è connessa: aggiorno l'Id dalla configurazione + CurrCam.IsEnable = False + CurrCam.IdCfg.Add(CfgItem) + ' Riassegno alla lista (solo la lista IdCfg viene aggiornata veramente...) + EnableCamList(IndID) = CurrCam + End If + Else + ' l'Id della camera non esiste (recupero la prima camera), ma una configurazione si + Dim IndID As Integer = 0 + Dim CurrCam As EbnableCamItem = EnableCamList(IndID) + CurrCam.IdCfg.Add(CfgItem) + End If + Next + End Sub + + ' OK: Data la config e il nuvo IDCam mi occupo di aggiornare la lista EnableCamList (NON DataGridView) + Private Sub UpdateListOfEnableCamItem(CfgItem As String, NewIdCam As String) + ' Recupero la camera assegnata alla configurazione + Dim IndIDCam As Integer = GetCurrCamIndFromCfg(CfgItem) + If IndIDCam > EnableCamList.Count - 1 Then Return + Dim CurrCam As EbnableCamItem = EnableCamList(IndIDCam) + If IsNothing(CurrCam) Then Return + ' Verifico che sia presente in elenco + If CurrCam.IdCfg.FindIndex((Function(x) x = CfgItem)) < 0 Then Return + ' Rimuovo questo elemento dalla lista delle configurazioni (per rifereminto si aggiorna anche la lista) + CurrCam.IdCfg.Remove(CfgItem) + ' Se la camera non ha nessun assegnamento allora aggiorno lo stato + If CurrCam.IdCfg.Count < 1 Then + CurrCam.IsEnable = True + EnableCamList(IndIDCam) = CurrCam + End If + + IndIDCam = EnableCamList.FindIndex((Function(x) x.IdCam = NewIdCam)) + If IndIDCam > -1 Then + CurrCam = EnableCamList(IndIDCam) + ' verifico che non sia già inserito in elenco (se la grafica non fosse allineata...) + If CurrCam.IdCfg.FindIndex((Function(x) x = CfgItem)) < 0 Then + CurrCam.IdCfg.Add(CfgItem) + ' Aggiorno anche lo stato + If CurrCam.IdCam <> IdCamEmpty And CurrCam.IsEnable Then + CurrCam.IsEnable = False + EnableCamList(IndIDCam) = CurrCam + End If + End If End If End Sub - Private Sub PopolateDataGrid() + ' ------- FINE ------- gestione EnableCamList ---------------------------- + + ' OK: Carico gli elementi della tabella (n_CurrIndex: indice selezionato); bFirstRun: set la config applicata + Private Sub PopolateDataGrid(Optional bFirstRun As Boolean = False) + ' Ripulisco tutti i dati della datagrid DataGridView1.Rows.Clear() - CameraListCfg.Clear() - ComboCamera.Items.Clear() - Dim DirToReadCfg As String = FrmMain.sDataRoot - ' Popolo combobox con idcamera - For Each CameraItem As String In FrmMain.ComboBoxCameras.Items - ComboCamera.Items.Add(CameraItem) - Next - ' Popolo text con configurazione + + ' Per ogni configurazione genero una riga della datagrid For Each CfgItem As String In FrmMain.ComboBoxCameraCfg.Items - Dim NomeFileCfg As String = DirToReadCfg & If(CfgItem = "Default", String.Empty, CfgItem) & "\CameraMng.cfg" + CfgItem = If(CfgItem = "Default", String.Empty, CfgItem) + ' Creo una nuova riga della tabella Dim riga As New DataGridViewRow() ' Crea le celle corrispondenti alle colonne riga.CreateCells(DataGridView1) - riga.Cells(0).Value = CfgItem - Dim id As String = ReadIdCameraFromCfg(NomeFileCfg) - If Not String.IsNullOrEmpty(id) Then - ' Icone CFG - If CameraListCfg.IndexOf(id) < 0 Then - CameraListCfg.Add(id) - riga.Cells(1).Value = GetCurrIco(2) - Else - riga.Cells(1).Value = GetCurrIco(0) - End If - ' Icone CAMERA - If ComboCamera.Items.IndexOf(id) > -1 Then - riga.Cells(3).Value = GetCurrIco(2) - riga.Cells(2).Value = id - Else - riga.Cells(3).Value = GetCurrIco(0) - End If - Else - riga.Cells(1).Value = GetCurrIco(-1) - riga.Cells(3).Value = GetCurrIco(-1) - End If - riga.Cells(4).Value = "Save" - riga.Cells(5).Value = "Apply" + + ' Popolo text con configurazione: assegno Indice della configurazione + riga.Cells(COLUMN.ID_CFG).Value = CfgItem + + ' Aggiorno le icone (leggendo la lista EnableCamList) + RefreshIcoAndComboBox(riga) + + riga.Cells(COLUMN.SAVE_CMD).Value = "Save" + riga.Cells(COLUMN.APPLY_CMD).Value = "Apply" ' Aggiungi la riga completa al DataGridView DataGridView1.Rows.Add(riga) - If CfgItem = FrmMain.ComboBoxCameraCfg.SelectedItem Then - DataGridView1.ClearSelection() - ' Mantengo la selezione sulla riga corrente - DataGridView1.Rows(DataGridView1.Rows.Count - 1).Selected = True - ' Indico in grassetto il comando Apply - ' Mi assicuro che la cella sia del tipo corretto - If TypeOf riga.Cells(5) Is DataGridViewButtonCell Then - ' Ottiengo la cella specifica - Dim cellaBottone As DataGridViewButtonCell = CType(riga.Cells(5), DataGridViewButtonCell) - ' Recupero il font attuale della cella per non perdere le altre proprietà (come la dimensione) - Dim fontAttuale As Font = cellaBottone.Style.Font - ' Se non è stato impostato un font, usane uno di default per sicurezza - If fontAttuale Is Nothing Then - fontAttuale = Me.DataGridView1.Font ' Usa il font del DataGridView come base - End If - ' Assegno un NUOVO oggetto Font con lo stile Bold - cellaBottone.Style.Font = New Font(fontAttuale, FontStyle.Bold) - End If + ' Imposto la configurazione corrente come attiva + If bFirstRun And CfgItem = FrmMain.ComboBoxCameraCfg.SelectedItem Then + ' --> DataGridView1.ClearSelection() + ' Recupero l'indice della riga corrente che deve rimanere selezionata + Dim LastIndexRow As Integer = DataGridView1.Rows.Count - 1 + ' --> DataGridView1.Rows(DataGridView1.Rows.Count - 1).Selected = True + ' Imposto la selezione sulla riga corrente + SelectCurrIndexRow(LastIndexRow) + ' Indico in grassetto il comando Apply della configurazione corrente + SetStatusApplyFont(LastIndexRow, True) End If Next + + ' Seleziono la riga associata alla configurazione impostata + + End Sub + + ' OK: Assegna le nuove combobox per ogni configurazione + Private Sub UpdateDataGridView() + ' Aggiorno le lista degli ID camera per ogni riga della tabella + For IndexRow As Integer = 0 To DataGridView1.Rows.Count - 1 + ' recupero la riga corrente della tabella + Dim riga As DataGridViewRow = DataGridView1.Rows(IndexRow) + ' Aggiorno la lista della combobox e le icone + RefreshIcoAndComboBox(riga) + Next End Sub - Private Sub RefreshDataGrid(IndexRawDataGrid As Integer) - DataGridView1.ClearSelection() - - Dim CfgItem As String = DataGridView1.Rows(IndexRawDataGrid).Cells("Config").Value.ToString() - ' Aggiorno lo stato delle icone della lista - - Dim DirToReadCfg As String = FrmMain.sDataRoot - Dim NomeFileCfg As String = DirToReadCfg & If(CfgItem = "Default", String.Empty, CfgItem) & "\CameraMng.cfg" - ' Creo la nuova riga che sostituirà quella precedente - Dim riga As DataGridViewRow = DataGridView1.Rows(IndexRawDataGrid) - ' Crea le celle corrispondenti alle colonne - riga.Cells(0).Value = CfgItem - Dim id As String = ReadIdCameraFromCfg(NomeFileCfg) - If Not String.IsNullOrEmpty(id) Then - ' Icone CFG - If CameraListCfg.IndexOf(id) < 0 Then - riga.Cells(1).Value = GetCurrIco(2) - Else - riga.Cells(1).Value = GetCurrIco(0) + ' OK: Recupero l'INDICE (della lista EnableCmaList) della camera associata a CfgItem + Private Function GetCurrCamIndFromCfg(CfgItem As String) As Integer + Dim IndIDCam As Integer = 0 + For Ind As Integer = 0 To EnableCamList.Count - 1 + If EnableCamList(Ind).IdCfg.FindIndex((Function(y) y = CfgItem)) > -1 Then + IndIDCam = Ind + Exit For End If - ' Icone CAMERA - If ComboCamera.Items.IndexOf(id) > -1 Then - riga.Cells(3).Value = GetCurrIco(2) - riga.Cells(2).Value = id - Else - riga.Cells(3).Value = GetCurrIco(0) - End If - Else - riga.Cells(1).Value = GetCurrIco(-1) - riga.Cells(3).Value = GetCurrIco(-1) - End If - riga.Cells(4).Value = "Save" - riga.Cells(5).Value = "Apply" - - ' Sostituisco la riga corrente: rimuovo la precedente riga e ne inserisco una nuova - DataGridView1.Rows.RemoveAt(IndexRawDataGrid) - DataGridView1.Rows.Insert(IndexRawDataGrid, riga) - ' Mantengo la selezione sulla riga corrente - DataGridView1.CurrentCell = riga.Cells(0) - DataGridView1.Rows(IndexRawDataGrid).Selected = True - End Sub - - Private Sub RefreshSelectedItemCfg(IndexRawDataGrid As Integer) - ' 1. RIPRISTINA IL FONT DELLA RIGA PRECEDENTE - ' Controlla se c'era una riga precedente valida e se non è la stessa che stiamo per modificare - If CurrAppliedConfig > -1 AndAlso CurrAppliedConfig <> IndexRawDataGrid Then - ' Assicurati che l'indice sia ancora nel range del DataGridView - If CurrAppliedConfig < DataGridView1.Rows.Count Then - Dim lastRow As DataGridViewRow = DataGridView1.Rows(CurrAppliedConfig) - Dim lastCellButton As DataGridViewButtonCell = CType(lastRow.Cells(5), DataGridViewButtonCell) - Dim lastFont As Font = lastCellButton.Style.Font - ' Crea un nuovo font basato su quello esistente, ma con stile Regular - If lastFont IsNot Nothing Then - lastCellButton.Style.Font = New Font(lastFont, FontStyle.Regular) - End If - End If - End If - - DataGridView1.ClearSelection() - - ' 2. AGGIORNA I DATI DELLA RIGA ESISTENTE - Dim CfgItem As String = DataGridView1.Rows(IndexRawDataGrid).Cells("Config").Value.ToString() - ' Aggiorno lo stato delle icone della lista - Dim DirToReadCfg As String = FrmMain.sDataRoot - Dim NomeFileCfg As String = DirToReadCfg & If(CfgItem = "Default", String.Empty, CfgItem) & "\CameraMng.cfg" - ' Creo la nuova riga che sostituirà quella precedente - Dim riga As DataGridViewRow = DataGridView1.Rows(IndexRawDataGrid) - ' Crea le celle corrispondenti alle colonne - riga.Cells(0).Value = CfgItem - Dim id As String = ReadIdCameraFromCfg(NomeFileCfg) - If Not String.IsNullOrEmpty(id) Then - ' Icone CFG - If CameraListCfg.IndexOf(id) < 0 Then - riga.Cells(1).Value = GetCurrIco(2) - Else - riga.Cells(1).Value = GetCurrIco(0) - End If - ' Icone CAMERA - If ComboCamera.Items.IndexOf(id) > -1 Then - riga.Cells(3).Value = GetCurrIco(2) - riga.Cells(2).Value = id - Else - riga.Cells(3).Value = GetCurrIco(0) - End If - Else - riga.Cells(1).Value = GetCurrIco(-1) - riga.Cells(3).Value = GetCurrIco(-1) - End If - riga.Cells(4).Value = "Save" - riga.Cells(5).Value = "Apply" - - ' 3. APPLICA IL GRASSETTO ALLA RIGA CORRENTE - Dim currentCellButton As DataGridViewButtonCell = CType(riga.Cells(5), DataGridViewButtonCell) - Dim currentFont As Font = currentCellButton.Style.Font - If currentFont Is Nothing Then - currentFont = Me.DataGridView1.Font ' Usa il font del DataGridView come base - End If - ' Assegna un NUOVO oggetto Font con lo stile Bold - currentCellButton.Style.Font = New Font(currentFont, FontStyle.Bold) - - ' 4. AGGIORNA L'INDICE DA RICORDARE - CurrAppliedConfig = IndexRawDataGrid - - ' Mantengo la selezione sulla riga corrente - DataGridView1.CurrentCell = riga.Cells(0) - DataGridView1.Rows(IndexRawDataGrid).Selected = True - End Sub + Next + Return IndIDCam + End Function + ' OK: Lettura dell'IDCam dal file di configurazione Private Function ReadIdCameraFromCfg(NomeFileCfg As String) As String Dim IDCamera As String = String.Empty Dim reader As New StreamReader(NomeFileCfg) @@ -229,18 +245,20 @@ Public Class SetConfigForm Return IDCamera End Function + ' OK: Restituisce l'immagine associata all'Enum indicato Private Function GetCurrIco(Index As Integer) As Image Select Case Index - Case -1 - myImage = My.Resources.cross - Case 0 - myImage = My.Resources.warning + Case ICO.ERR_ + m_myImage = My.Resources.cross + Case ICO.WARNING_ + m_myImage = My.Resources.warning Case Else - myImage = My.Resources.accept + m_myImage = My.Resources.accept End Select - Return myImage + Return m_myImage End Function + ' OK: Salva l'IDCam nella configurazione corrente Public Sub SaveIDCamera(IDConfing As String, IDCamera As String) Dim NomeFileCfg, TmpString As String Dim NomeFileTempCfg, DirToReadCfg As String @@ -249,6 +267,7 @@ Public Class SetConfigForm Dim writer As StreamWriter Try + If IDConfing.Contains("Default") Then IDConfing = "" DirToReadCfg = FrmMain.sDataRoot & IDConfing NomeFileCfg = DirToReadCfg & "\CameraMng.cfg" NomeFileTempCfg = DirToReadCfg & "\CameraMngTmp.cfg" @@ -266,7 +285,7 @@ Public Class SetConfigForm writer.WriteLine(TmpString, CultureInfo.InvariantCulture) End If End While - writer.WriteLine("CameraID=" & IDCamera, CultureInfo.InvariantCulture) + writer.WriteLine("CameraID=" & If(IDCamera = IdCamEmpty, "", IDCamera), CultureInfo.InvariantCulture) FileClose(nf) writer.Close() File.Copy(NomeFileCfg, SaveFileCfg) @@ -282,105 +301,305 @@ Public Class SetConfigForm End Try End Sub + ' OK: Data la riga della DataGrid viene assegnato il font: bSet=True -> BOLD, bSet=False -> REGULAR + Private Sub SetStatusApplyFont(IndexRowDataGrid As Integer, bSet As Boolean) + If IndexRowDataGrid > -1 Then + Dim ApplyCellButton As DataGridViewButtonCell = CType(DataGridView1.Rows(IndexRowDataGrid).Cells(COLUMN.APPLY_CMD), DataGridViewButtonCell) + Dim CurrFont As Font = ApplyCellButton.Style.Font + ' Crea un nuovo font basato su quello esistente, ma con stile Regular + If IsNothing(CurrFont) Then CurrFont = Me.DataGridView1.Font + ApplyCellButton.Style.Font = New Font(CurrFont, If(bSet, FontStyle.Bold, FontStyle.Regular)) + End If + End Sub + + ' OK: Aggiorno la DataGrid per visualizzare la configurazione attiva + Private Function ApplyCurrCfg(CurrIdCfg As String, Optional bForce As Boolean = False) As Boolean + ' Se il nome della configurazione corrente è già attivo allora esco + If (m_sCurrAppliedIdCfg = CurrIdCfg And Not bForce) And String.IsNullOrEmpty(CurrIdCfg) Then Return False + + ' Recupero l'indice della DataGrid associato alla configurazione applicata: rimuovo il font BOLD + Dim IndAppliedIdCfg As Integer = -1 + For Index As Integer = 0 To DataGridView1.Rows.Count - 1 + If DataGridView1.Rows(Index).Cells(COLUMN.ID_CFG).Value = m_sCurrAppliedIdCfg Then + IndAppliedIdCfg = Index + Exit For + End If + Next + ' Ripristino il font Regular + SetStatusApplyFont(IndAppliedIdCfg, False) + + ' Recupero l'indice della DataGrid associato alla configurazione + Dim IndCurrIdCfg As Integer = -1 + For Index As Integer = 0 To DataGridView1.Rows.Count - 1 + If DataGridView1.Rows(Index).Cells(COLUMN.ID_CFG).Value = CurrIdCfg Then + IndCurrIdCfg = Index + Exit For + End If + Next + ' Applico il font Bold + SetStatusApplyFont(IndCurrIdCfg, True) + + ' Assegno come applicata cfg corrente + m_sCurrAppliedIdCfg = CurrIdCfg + + Return True + End Function + +#End Region ' Metodi gestione combobox + + ' OK: Aggiorna l'icone della riga corrente + Private Function RefreshIcoAndComboBox(ByRef riga As DataGridViewRow) As Boolean + 'Dim riga As DataGridViewRow = DataGridView1.Rows(IndexRow) + + Dim CfgItem As String = riga.Cells(COLUMN.ID_CFG).Value + ' Recupero la camera assegnata alla configurazione + Dim IndIDCam As Integer = GetCurrCamIndFromCfg(CfgItem) + If IndIDCam > EnableCamList.Count - 1 Then Return False + Dim CurrCam As EbnableCamItem = EnableCamList(IndIDCam) + If IsNothing(CurrCam) Then Return False + + ' Configurazione delle icone della pagina + If CurrCam.IdCam = IdCamEmpty Then + ' CFG ICO + riga.Cells(COLUMN.CFG_ICO).Value = GetCurrIco(ICO.ERR_) + ' CAM ICO + riga.Cells(COLUMN.CAM_ICO).Value = GetCurrIco(ICO.ERR_) + Else + ' CFG ICO + If CurrCam.IdCfg(0) = CfgItem Then + riga.Cells(COLUMN.CFG_ICO).Value = GetCurrIco(ICO.OK_) + Else + riga.Cells(COLUMN.CFG_ICO).Value = GetCurrIco(ICO.WARNING_) + End If + ' CAM ICO + If CurrCam.IsConnected Then + riga.Cells(COLUMN.CAM_ICO).Value = GetCurrIco(ICO.OK_) + Else + riga.Cells(COLUMN.CAM_ICO).Value = GetCurrIco(ICO.WARNING_) + End If + End If + + ' Creo la lista degli IdCam disponibili per la configurazione corrente + Dim CamList As New List(Of String) + ' Procedo alla creazione della lista delle camere libere + For Each CameraItem As EbnableCamItem In EnableCamList + If CameraItem.IsEnable Then + CamList.Add(CameraItem.IdCam) + End If + Next + ' Aggiungo la camera assegnata a questa configurazione + If CurrCam.IdCam <> IdCamEmpty Then CamList.Add(CurrCam.IdCam) + ' Se la camera non è in elenco tra le camere disponibili (Id già occupato) + If CamList.IndexOf(CurrCam.IdCam) < 0 Then + CamList.Add(CurrCam.IdCam) + End If + + If m_nCurrIndexRow = riga.Index Then + Dim Pippo As Boolean = True + End If + + + + ' Assegno la lista alla cella ComboBox + Dim comboBoxCell As DataGridViewComboBoxCell = TryCast(riga.Cells.Item(COLUMN.ID_CAM), DataGridViewComboBoxCell) + If Not IsNothing(comboBoxCell) Then + m_UpdatingDataSource = True + + ' Imposto l'ID della camera (sembra che questa assegnazione non generi nessun evento) + comboBoxCell.Value = CurrCam.IdCam + + ' verifice che le due liste siano uguali + Dim bAreSame As Boolean = False + If Not IsNothing(comboBoxCell.DataSource) Then + ' Ad ogni assegnazione della lista viene lanciato l'evento + bAreSame = True + If comboBoxCell.DataSource.Count <> CamList.Count Then + ' Hanno numero di elementi differenti: quindi sicuramente diverse + bAreSame = False + Else + ' Verifico che tutti gli elementi di una lista siano anche nell'altra + For Each Item As String In comboBoxCell.DataSource + If CamList.FindIndex(Function(x) x = Item) < 0 Then + bAreSame = False + Exit For + End If + Next + End If + End If + ' Se le liste sono diverse anche per contenuto allora ricarico + If Not bAreSame Then comboBoxCell.DataSource = CamList + + m_UpdatingDataSource = False + End If + + Return True + End Function + + ' Aggiorno la selezione della tabella e setto la riga corrente nella variabile m_nCurrIndexRow + Private Sub SelectCurrIndexRow(IndexRow As Integer) + ' Verifico che l'indice di riga sia valido + If IndexRow < 0 Or IndexRow > DataGridView1.RowCount Then Return + ' Se la selezione è la stessa riga che è in uso allora non aggiorno + If IndexRow = m_nCurrIndexRow Then Return + Me.Invalidate() + DataGridView1.ClearSelection() + DataGridView1.Rows(IndexRow).Selected = True + m_nCurrIndexRow = IndexRow + End Sub + +#Region "EVENTS" + + 'Private CMB As ComboBox + + ' Selezione ComboBox Private Sub DataGridView1_EditingControlShowing(sender As Object, e As DataGridViewEditingControlShowingEventArgs) Handles DataGridView1.EditingControlShowing + ' Seleziono la riga indicata + SelectCurrIndexRow(DataGridView1.CurrentCell.RowIndex) ' Controlla se la cella corrente è nella colonna della ComboBox e se il controllo è una ComboBox If DataGridView1.CurrentCell.ColumnIndex = DataGridView1.Columns("ComboCamera").Index AndAlso TypeOf e.Control Is ComboBox Then Dim comboBox As ComboBox = TryCast(e.Control, ComboBox) If comboBox IsNot Nothing Then - ' Rimuovi eventuali gestori eventi precedenti per evitare eventi duplicati - ' Questo è importante se l'utente modifica più volte la stessa cella + ' Salvo un riferimento alla combobox selezionata: viene cancellato il riferimento al termine della selezione + 'CMB = comboBox + ' Rimuovi i gestori precedenti per evitare agganci multipli RemoveHandler comboBox.SelectedIndexChanged, AddressOf DataGridViewComboBox_SelectedIndexChanged - ' Aggiungi il gestore eventi per l'evento SelectedIndexChanged della ComboBox + 'Aggiungo il gestore eventi per l'evento SelectedIndexChanged della ComboBox AddHandler comboBox.SelectedIndexChanged, AddressOf DataGridViewComboBox_SelectedIndexChanged End If End If End Sub - ' Questo è il gestore eventi che si attiverà quando l'utente seleziona un elemento nella ComboBox + ' Questo è il gestore eventi che si attiverà quando l'utente seleziona un elemento nella ComboBox -- Handles DataGridView1.EditingControlShowing Private Sub DataGridViewComboBox_SelectedIndexChanged(sender As Object, e As EventArgs) Dim comboBox As ComboBox = TryCast(sender, ComboBox) - If comboBox IsNot Nothing Then + 'Dim comboBox As ComboBox = CMB + + If Not IsNothing(comboBox) AndAlso Not IsNothing(comboBox.SelectedItem) Then + ' Nuovo valore Dim selectedValue As String = comboBox.SelectedItem.ToString() Dim currentRowIndex As Integer = DataGridView1.CurrentCell.RowIndex - + ' Precedente valore Dim IDCamera As String = If(Not IsNothing(DataGridView1.Rows(currentRowIndex).Cells("ComboCamera").Value), DataGridView1.Rows(currentRowIndex).Cells("ComboCamera").Value.ToString(), String.Empty) + ' Id della configurazione corrente + Dim IDCfg As String = DataGridView1.Rows(currentRowIndex).Cells("Config").Value.ToString() If IDCamera <> selectedValue Then - DataGridView1.Rows(currentRowIndex).Cells(4).Value = "Save*" + ' Aggiorno l'elenco EnableCamList + If Not m_UpdatingDataSource Then + UpdateListOfEnableCamItem(IDCfg, selectedValue) + Else + UpdateListOfEnableCamItem(IDCfg, IDCamera) + End If + ' Ricostruisco la DataGrid + UpdateDataGridView() + ' Aggiorno il valore del bottone + DataGridView1.Rows(currentRowIndex).Cells(COLUMN.SAVE_CMD).Value = "Save*" End If - End If End Sub - ' Tutti i click sulla datagrid passono da qui + ' Selezione del valore di una cella: gestione dei bottoni SAVE & APPLY Private Sub DataGridView1_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick ' Controlla che il click non sia sull'intestazione della colonna If e.RowIndex < 0 Then Return - DataGridView1.Rows(e.RowIndex).Selected = True + + ' seleziona la riga indicata + SelectCurrIndexRow(e.RowIndex) If e.ColumnIndex < 0 Then Return - - IndexCurrentRow = e.RowIndex - IDConfig = DataGridView1.Rows(e.RowIndex).Cells("Config").Value.ToString() - IDCamera = If(Not IsNothing(DataGridView1.Rows(e.RowIndex).Cells("ComboCamera").Value), DataGridView1.Rows(e.RowIndex).Cells("ComboCamera").Value.ToString(), String.Empty) + ' recupero l'Id della configurazione e l'Id della camera + Dim sIDConfig As String = DataGridView1.Rows(m_nCurrIndexRow).Cells("Config").Value.ToString() + Dim sIDCamera As String = If(Not IsNothing(DataGridView1.Rows(m_nCurrIndexRow).Cells("ComboCamera").Value), DataGridView1.Rows(e.RowIndex).Cells("ComboCamera").Value.ToString(), String.Empty) ' Controlla se il click è avvenuto nella colonna dei bottoni (Usa il nome che hai dato alla colonna) If Me.DataGridView1.Columns(e.ColumnIndex).Name = "SaveConfig" Then - If Not String.IsNullOrEmpty(IDConfig) And Not String.IsNullOrEmpty(IDCamera) Then - SaveIDCamera(IDConfig, IDCamera) - DataGridView1.Rows(e.RowIndex).Cells(4).Value = "Save" - RefreshDataGrid(e.RowIndex) - bIsSavedAll = True - Else - MessageBox.Show("Non è possibile salvare l'ID di una camera non connessa.", "Avviso", MessageBoxButtons.OK, MessageBoxIcon.Asterisk) + If Not String.IsNullOrEmpty(sIDConfig) Then + SaveIDCamera(sIDConfig, sIDCamera) + DataGridView1.Rows(m_nCurrIndexRow).Cells(COLUMN.SAVE_CMD).Value = "Save" + '' Aggiorno l'elenco EnableCamList + 'UpdateListOfEnableCamItem(sIDConfig, sIDCamera) + '' Ricostruisco la DataGrid SENZA forzare la selezione della riga + 'PopolateDataGrid(False) + End If + ' Se la configurazione è applicata allora procedo ad aggiornare anche il programma + If m_sCurrAppliedIdCfg = sIDConfig Then + If Not ApplyCurrCfg(sIDConfig, True) Then Return + ' seleziona la riga indicata + SelectCurrIndexRow(e.RowIndex) + + ' Aggiorno la camera in uso nel programma + Dim IndCamera As Integer = FrmMain.ComboBoxCameras.Items.IndexOf(sIDCamera) + If IndCamera > -1 Then FrmMain.ComboBoxCameras.SelectedIndex = IndCamera + Dim IndCameraCfg As Integer = FrmMain.ComboBoxCameraCfg.Items.IndexOf(sIDConfig) + If IndCameraCfg > -1 Then FrmMain.ComboBoxCameraCfg.SelectedIndex = IndCameraCfg End If ElseIf Me.DataGridView1.Columns(e.ColumnIndex).Name = "ApplyConfig" Then - If Not (String.IsNullOrEmpty(IDConfig) And String.IsNullOrEmpty(IDCamera)) Then - ' verifico che non sia stato salvato l'id indicato - If DataGridView1.Rows(e.RowIndex).Cells(4).Value.ToString().Contains("*"c) Then + If Not String.IsNullOrEmpty(sIDConfig) And Not String.IsNullOrEmpty(sIDCamera) And sIDCamera <> IdCamEmpty Then + ' Verifico che non ci sia una modifica attiva + If DataGridView1.Rows(m_nCurrIndexRow).Cells(COLUMN.SAVE_CMD).Value.ToString().Contains("*"c) Then MessageBox.Show("Salvare la configurazione prima di applicarla.", "Informazione", MessageBoxButtons.OK, MessageBoxIcon.Asterisk) Return End If - Dim IndCamera As Integer = FrmMain.ComboBoxCameras.Items.IndexOf(IDCamera) - FrmMain.ComboBoxCameras.SelectedIndex = IndCamera - Dim IndCameraCfg As Integer = FrmMain.ComboBoxCameraCfg.Items.IndexOf(IDConfig) - FrmMain.ComboBoxCameraCfg.SelectedIndex = IndCameraCfg - RefreshSelectedItemCfg(e.RowIndex) + If Not ApplyCurrCfg(sIDConfig) Then Return + ' seleziona la riga indicata + SelectCurrIndexRow(e.RowIndex) + ' Aggiorno la camera in uso nel programma + Dim IndCamera As Integer = FrmMain.ComboBoxCameras.Items.IndexOf(sIDCamera) + If IndCamera > -1 Then FrmMain.ComboBoxCameras.SelectedIndex = IndCamera + Dim IndCameraCfg As Integer = FrmMain.ComboBoxCameraCfg.Items.IndexOf(sIDConfig) + If IndCameraCfg > -1 Then FrmMain.ComboBoxCameraCfg.SelectedIndex = IndCameraCfg + Else + MessageBox.Show("Non è possibile applicare una configurazione di una camera non connessa.", "Avviso", MessageBoxButtons.OK, MessageBoxIcon.Asterisk) End If + + ElseIf Me.DataGridView1.Columns(e.ColumnIndex).Name = "ComboCamera" Then + ' riconosco che è stata selezionata la combobox End If + End Sub + ' Chiusura della finestra Private Sub SetConfig_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing - ' 💡 FORZA LA FINE DELLA MODALITÀ DI MODIFICA + ' FORZA LA FINE DELLA MODALITÀ DI MODIFICA Me.Validate() Dim result As DialogResult + Dim ListOfIndexModifiedCfg As New List(Of Integer) + Dim bExit As Boolean = True For IndexRow As Integer = 0 To DataGridView1.Rows.Count - 1 - If DataGridView1.Rows(IndexRow).Cells(4).Value = "Save*" Then - ' Ci sono modifiche. Chiedi all'utente cosa fare. - If bIsSavedAll Then - result = MessageBox.Show("Salvare tutte le configurazioni modificate o no?", "Attenzione", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning) - End If - Select Case result - Case DialogResult.Yes - ' Salvataggio - If DataGridView1.Rows(IndexRow).Cells(0).Value = "Default" Then DataGridView1.Rows(IndexRow).Cells(0).Value = String.Empty - SaveIDCamera(DataGridView1.Rows(IndexRow).Cells(0).Value, DataGridView1.Rows(IndexRow).Cells(2).Value) - DataGridView1.Rows(IndexRow).Cells(4).Value = "Save" - RefreshDataGrid(IndexRow) - bIsSavedAll = False - Case DialogResult.No - ' La finestra si chiuderà normalmente. Non fare nulla. - bIsSavedAll = True - Return - Case DialogResult.Cancel - ' L'utente ha annullato l'operazione. Annulla la chiusura della finestra. - bIsSavedAll = True - e.Cancel = True - End Select + ' Verifico se ci sia nessuna modifica attiva + If DataGridView1.Rows(IndexRow).Cells(COLUMN.SAVE_CMD).Value = "Save*" Then + ListOfIndexModifiedCfg.Add(IndexRow) + bExit = False End If Next - bIsSavedAll = True + ' Se non ci sono modifiche allora esco subito + If bExit Then Return + + ' Costruisco il messaggio in funzione del numero di elementi presenti + Dim sMsg As String = "Vuoi salvare la modifica corrente?" + If ListOfIndexModifiedCfg.Count > 1 Then + sMsg = "Vuoi salvare le modifiche correnti?" + End If + + result = MessageBox.Show(sMsg, "Attenzione", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning) + Select Case result + Case DialogResult.Yes + ' Salvataggio + For Each IndexRow As Integer In ListOfIndexModifiedCfg + ' Salvataggio + SaveIDCamera(DataGridView1.Rows(IndexRow).Cells(COLUMN.ID_CFG).Value, DataGridView1.Rows(IndexRow).Cells(COLUMN.ID_CAM).Value) + Next + Case DialogResult.No + ' La finestra si chiuderà normalmente. Non fare nulla. + Return + Case DialogResult.Cancel + ' L'utente ha annullato l'operazione. Annulla la chiusura della finestra. + e.Cancel = True + End Select + ' Al termine la finestra viene chiusa End Sub +#End Region ' Events + End Class \ No newline at end of file diff --git a/CameraMng/bin/x64/Release/CameraMng.xml b/CameraMng/bin/x64/Release/CameraMng.xml index cc66e82..0df66bd 100644 --- a/CameraMng/bin/x64/Release/CameraMng.xml +++ b/CameraMng/bin/x64/Release/CameraMng.xml @@ -32,6 +32,11 @@ CameraMng Cerca una risorsa localizzata di tipo System.Drawing.Bitmap. + + + Cerca una risorsa localizzata di tipo System.Drawing.Bitmap. + + Cerca una risorsa localizzata di tipo System.Drawing.Bitmap. @@ -62,6 +67,11 @@ CameraMng Cerca una risorsa localizzata di tipo System.Drawing.Bitmap. + + + Cerca una risorsa localizzata di tipo System.Drawing.Bitmap. + + Cerca una risorsa localizzata di tipo System.Drawing.Bitmap. @@ -92,6 +102,11 @@ CameraMng Cerca una risorsa localizzata di tipo System.Drawing.Bitmap. + + + Cerca una risorsa localizzata di tipo System.Drawing.Bitmap. + + Cerca una risorsa localizzata di tipo System.Drawing.Bitmap. diff --git a/CameraMng/clsCamera/clsCamera.vb b/CameraMng/clsCamera/clsCamera.vb index bdb1162..4b478c4 100644 --- a/CameraMng/clsCamera/clsCamera.vb +++ b/CameraMng/clsCamera/clsCamera.vb @@ -137,7 +137,7 @@ Public Class clsCamera If _connected Then Disconnect() If bodyID = "" Then - Connect(0) + ' Connect(0) Return End If diff --git a/CameraMng/obj/x64/Debug/CameraMng.vbproj.AssemblyReference.cache b/CameraMng/obj/x64/Debug/CameraMng.vbproj.AssemblyReference.cache index b128c11..4d79075 100644 Binary files a/CameraMng/obj/x64/Debug/CameraMng.vbproj.AssemblyReference.cache and b/CameraMng/obj/x64/Debug/CameraMng.vbproj.AssemblyReference.cache differ diff --git a/CameraMng/obj/x64/Debug/CameraMng.vbproj.CoreCompileInputs.cache b/CameraMng/obj/x64/Debug/CameraMng.vbproj.CoreCompileInputs.cache index 7b86e50..9c799eb 100644 --- a/CameraMng/obj/x64/Debug/CameraMng.vbproj.CoreCompileInputs.cache +++ b/CameraMng/obj/x64/Debug/CameraMng.vbproj.CoreCompileInputs.cache @@ -1 +1 @@ -80ba11b124538c7d3079f30cd12468109ae550e631cf8c94dfc5efc15b795614 +69636ff66d10d465f87b29c6b3440534ee373b52aa51b9726c6ce7a90119bc6f diff --git a/CameraMng/obj/x64/Debug/CameraMng.vbproj.GenerateResource.cache b/CameraMng/obj/x64/Debug/CameraMng.vbproj.GenerateResource.cache index 393834d..e32462d 100644 Binary files a/CameraMng/obj/x64/Debug/CameraMng.vbproj.GenerateResource.cache and b/CameraMng/obj/x64/Debug/CameraMng.vbproj.GenerateResource.cache differ diff --git a/CameraMng/obj/x64/Debug/DesignTimeResolveAssemblyReferences.cache b/CameraMng/obj/x64/Debug/DesignTimeResolveAssemblyReferences.cache index 87de04f..7174f57 100644 Binary files a/CameraMng/obj/x64/Debug/DesignTimeResolveAssemblyReferences.cache and b/CameraMng/obj/x64/Debug/DesignTimeResolveAssemblyReferences.cache differ diff --git a/CameraMng/obj/x64/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/CameraMng/obj/x64/Debug/DesignTimeResolveAssemblyReferencesInput.cache index 6847c44..b4a8dc8 100644 Binary files a/CameraMng/obj/x64/Debug/DesignTimeResolveAssemblyReferencesInput.cache and b/CameraMng/obj/x64/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ diff --git a/CameraMng/obj/x64/Debug/FrmMain.resources b/CameraMng/obj/x64/Debug/FrmMain.resources index ac6f347..87d27eb 100644 Binary files a/CameraMng/obj/x64/Debug/FrmMain.resources and b/CameraMng/obj/x64/Debug/FrmMain.resources differ diff --git a/CameraMng/obj/x64/Release/CameraMng.vbproj.AssemblyReference.cache b/CameraMng/obj/x64/Release/CameraMng.vbproj.AssemblyReference.cache index 4be7836..83ea001 100644 Binary files a/CameraMng/obj/x64/Release/CameraMng.vbproj.AssemblyReference.cache and b/CameraMng/obj/x64/Release/CameraMng.vbproj.AssemblyReference.cache differ diff --git a/CameraMng/obj/x64/Release/CameraMng.vbproj.CoreCompileInputs.cache b/CameraMng/obj/x64/Release/CameraMng.vbproj.CoreCompileInputs.cache index c46f02b..dff123e 100644 --- a/CameraMng/obj/x64/Release/CameraMng.vbproj.CoreCompileInputs.cache +++ b/CameraMng/obj/x64/Release/CameraMng.vbproj.CoreCompileInputs.cache @@ -1 +1 @@ -6dfe2777d17f530c20a47946243d5514a0d9ccf3b3bc8a842d8aaf280d73ff42 +e63cd9d1bff65e57a3ee15db15da52f89e1cb74102fae0c75198f4c36fa0c215 diff --git a/CameraMng/obj/x64/Release/CameraMng.vbproj.FileListAbsolute.txt b/CameraMng/obj/x64/Release/CameraMng.vbproj.FileListAbsolute.txt index 1850f2b..e9d3ade 100644 --- a/CameraMng/obj/x64/Release/CameraMng.vbproj.FileListAbsolute.txt +++ b/CameraMng/obj/x64/Release/CameraMng.vbproj.FileListAbsolute.txt @@ -48,3 +48,4 @@ C:\EgtDev\cameramanager\CameraMng\obj\x64\Release\CameraMng.vbproj.Up2Date C:\EgtDev\cameramanager\CameraMng\obj\x64\Release\CameraMng.exe C:\EgtDev\cameramanager\CameraMng\obj\x64\Release\CameraMng.xml C:\EgtDev\cameramanager\CameraMng\obj\x64\Release\CameraMng.pdb +C:\EgtDev\cameramanager\CameraMng\obj\x64\Release\SetConfigForm.resources diff --git a/CameraMng/obj/x64/Release/CameraMng.vbproj.GenerateResource.cache b/CameraMng/obj/x64/Release/CameraMng.vbproj.GenerateResource.cache index 574d41c..e32462d 100644 Binary files a/CameraMng/obj/x64/Release/CameraMng.vbproj.GenerateResource.cache and b/CameraMng/obj/x64/Release/CameraMng.vbproj.GenerateResource.cache differ diff --git a/CameraMng/obj/x64/Release/CameraMng.xml b/CameraMng/obj/x64/Release/CameraMng.xml index cc66e82..0df66bd 100644 --- a/CameraMng/obj/x64/Release/CameraMng.xml +++ b/CameraMng/obj/x64/Release/CameraMng.xml @@ -32,6 +32,11 @@ CameraMng Cerca una risorsa localizzata di tipo System.Drawing.Bitmap. + + + Cerca una risorsa localizzata di tipo System.Drawing.Bitmap. + + Cerca una risorsa localizzata di tipo System.Drawing.Bitmap. @@ -62,6 +67,11 @@ CameraMng Cerca una risorsa localizzata di tipo System.Drawing.Bitmap. + + + Cerca una risorsa localizzata di tipo System.Drawing.Bitmap. + + Cerca una risorsa localizzata di tipo System.Drawing.Bitmap. @@ -92,6 +102,11 @@ CameraMng Cerca una risorsa localizzata di tipo System.Drawing.Bitmap. + + + Cerca una risorsa localizzata di tipo System.Drawing.Bitmap. + + Cerca una risorsa localizzata di tipo System.Drawing.Bitmap. diff --git a/CameraMng/obj/x64/Release/FrmMain.resources b/CameraMng/obj/x64/Release/FrmMain.resources index 5f525f7..87d27eb 100644 Binary files a/CameraMng/obj/x64/Release/FrmMain.resources and b/CameraMng/obj/x64/Release/FrmMain.resources differ diff --git a/CameraMng/obj/x64/Release/Resources.resources b/CameraMng/obj/x64/Release/Resources.resources index b1cb95a..5e90f6e 100644 Binary files a/CameraMng/obj/x64/Release/Resources.resources and b/CameraMng/obj/x64/Release/Resources.resources differ