Compare commits

...

5 Commits

Author SHA1 Message Date
NicolaP c24f12a208 Gestione DDF_ParmOnOf in HardwareManager 2022-06-27 15:25:42 +02:00
NicolaP f3a53efa42 Non blocco i file se programma in sola lettura 2022-05-30 18:23:17 +02:00
NicolaP 1e75e0073c Miglioramento gestione errori per compo 2022-05-30 18:19:35 +02:00
NicolaP e0281a3f46 Miglioramento gestione errori per direttori compo 2022-05-12 18:08:55 +02:00
NicolaP cf07c578a0 Merge branch 'Features/OnlyRead' into NicolaP 2022-05-12 15:11:07 +02:00
6 changed files with 169 additions and 8 deletions
+95 -3
View File
@@ -6,6 +6,13 @@ Imports System.IO
Public Class CompoPanelVM
Implements INotifyPropertyChanged
Private m_ErroLoadCompo As String = String.Empty
Public ReadOnly Property ErrorLoadCompo As String
Get
Return m_ErroLoadCompo
End Get
End Property
Private m_PageName As String = String.Empty
Public ReadOnly Property GoToAssembly As String
@@ -75,9 +82,39 @@ Public Class CompoPanelVM
Return
End If
Dim CompoArray() As String = Directory.GetDirectories(IniFile.m_CompoDir)
Dim ListCompoToInsert As New List(Of VerifyCompo)
For Ind As Integer = 0 To DdfFile.CompoListOrder.Count - 1
ListCompoToInsert.Add(New VerifyCompo(DdfFile.CompoListOrder(Ind), False))
Next
' Verifico che la lista Panel abbia un numero di elementi uguale o minore di quella DDF
If OptionModule.m_CompoPaneOrder.Count > DdfFile.CompoListOrder.Count Then
Dim ListCompoToShow As New List(Of VerifyCompo)
For Ind As Integer = 0 To OptionModule.m_CompoPaneOrder.Count - 1
ListCompoToShow.Add(New VerifyCompo(OptionModule.m_CompoPaneOrder(Ind), False))
Next
' cerco quali sono le componenti in esubero nella lista CompoPane
For Each ItemCompoPane As String In DdfFile.CompoListOrder
ListCompoToShow.Find(Function(x) x.sName = ItemCompoPane).SetExists(True)
Next
' recupero i nomi delle componenti non presenti nell'elenco DDF
Dim sMissingCompoInDDFList As String = String.Empty
For Each Item As VerifyCompo In ListCompoToShow
If Not Item.bExists Then
If String.IsNullOrEmpty(sMissingCompoInDDFList) Then
sMissingCompoInDDFList = Item.sName
Else
sMissingCompoInDDFList &= ", " & Item.sName
End If
End If
Next
m_ErroLoadCompo = "Verify component in CompoPanelOrder: " & sMissingCompoInDDFList
Return
End If
' carico i valori dei bottoni con un preciso ordine
Dim CompoPanelList As List(Of String) = OptionModule.m_CompoPaneOrder
For IndexCompoOrder = 0 To DdfFile.CompoListOrder.Count - 1
For IndexCompoOrder = 0 To CompoPanelList.Count() - 1 ' DdfFile.CompoListOrder.Count - 1
For Index = 0 To CompoArray.Count - 1
' apro ogni directory e cerco un file di testo di nome Config.ini
Dim CurrCompoPath As String = CompoArray(Index) & "\" & ConstCompo.CONFIGINI_FILE_NAME
@@ -87,14 +124,41 @@ Public Class CompoPanelVM
GetPrivateProfileFolderName(S_TEMPLATE, K_FOLDER_NAME, FolderName, CurrCompoPath)
If CompoPanelList(IndexCompoOrder) = CompoNameDDF Then
m_CompoTypeList.Add(New CompoType(CompoName, CompoNameDDF, CompoArray(Index), Side, FolderName))
ListCompoToInsert.Find(Function(x) x.sName = CompoNameDDF).SetExists(True)
' aggiungere il caricamento delle liste
Exit For
End If
End If
Next
Next
' verifica nella lista di partenza quali sono i componenti che non sono stati caricati
m_ErroLoadCompo = String.Empty
' cerco eventuali discrepanze tra la lista DDF e la lista Panel
Dim sMissingCompoInPanel As String = String.Empty
For nInd As Integer = 0 To ListCompoToInsert.Count - 1
Dim DDFCompoName As String = ListCompoToInsert(nInd).sName
If IsNothing(CompoPanelList.Find(Function(x) x = DDFCompoName)) Then
If String.IsNullOrEmpty(sMissingCompoInPanel) Then
sMissingCompoInPanel = "Missing component Panel button: " & vbCrLf & " - " & DDFCompoName
Else
sMissingCompoInPanel &= vbCrLf & " - " & DDFCompoName
End If
ListCompoToInsert(nInd).SetExists(True)
End If
Next
' cerco discrepanze tra la lista dei bottoni e direttori
For Each Item As VerifyCompo In ListCompoToInsert
If Not Item.bExists Then
If String.IsNullOrEmpty(m_ErroLoadCompo) Then
m_ErroLoadCompo = "Missing component Directory: " & vbCrLf & " - " & Item.sName
Else
m_ErroLoadCompo &= vbCrLf & " - " & Item.sName
End If
End If
Next
If Not String.IsNullOrEmpty(sMissingCompoInPanel) Then
m_ErroLoadCompo &= vbCrLf & sMissingCompoInPanel
End If
End Sub
#Region "COMMANDS"
@@ -215,3 +279,31 @@ Public Class CompoPanelVM
End Sub
End Class
Public Class VerifyCompo
Private m_sName As String
Public ReadOnly Property sName As String
Get
Return m_sName
End Get
End Property
Private m_bExists As Boolean = False
Public ReadOnly Property bExists As Boolean
Get
Return m_bExists
End Get
End Property
Public Sub SetExists(Exists As Boolean)
m_bExists = Exists
End Sub
Sub New(Name As String, Exists As Boolean)
m_sName = Name
m_bExists = Exists
End Sub
End Class
+28 -2
View File
@@ -1883,6 +1883,9 @@ Public Class Compo
If Map.refMainWindowVM.SelectedPage <> MainWindowVM.ListPageEnum.nHardwarePage Then
If Not TempParam.EnableCopy Then Return False
End If
Dim sItems() As String = sValue.Split(";"c)
' estraggo il primo valore: -- NomeParamOnOff = inch(0.6); 0
sValue = sItems(0)
Dim ReadValue = RegexFunction.Brackets(sValue)
If ReadValue.Contains("DGD.dW") Then
ReadValue = sValue.Replace(ReadValue & ")", "W")
@@ -1898,7 +1901,17 @@ Public Class Compo
End If
Utility.ConvertCurrentUnitMeasure(ReadValue)
TempParam.SetValue(ReadValue)
TempParam.SetIsActive(True)
' verifico se deve essere attivata
If sItems.Count > 1 Then
If sItems(1).Trim <> "0" Then
TempParam.SetIsActive(True)
Else
TempParam.SetIsActive(False)
End If
Else
TempParam.SetIsActive(True)
End If
TempParam.NotifyPropertyChanged("IsActive")
Return True
ElseIf TypeOf CurrCompoParam Is TextBoxParam Then
Dim TempParam As TextBoxParam = DirectCast(CurrCompoParam, TextBoxParam)
@@ -1926,11 +1939,24 @@ Public Class Compo
If Map.refMainWindowVM.SelectedPage <> MainWindowVM.ListPageEnum.nHardwarePage Then
If Not TempParam.EnableCopy Then Return False
End If
Dim sItems() As String = sValue.Split(";"c)
' estraggo il primo valore: -- NomeParamOnOff = inch(0.6); 0
sValue = sItems(0)
Dim ReadValue = Trim(sValue)
For Each Item In TempParam.ItemListDDF
If Trim(Item).ToLower = ReadValue.ToLower Then
TempParam.SetSelItem(TempParam.ItemList(TempParam.ItemListDDF.IndexOf(Item)))
TempParam.SetIsActive(True)
' verifico se deve essere attivata
If sItems.Count > 1 Then
If sItems(1).Trim <> "0" Then
TempParam.SetIsActive(True)
Else
TempParam.SetIsActive(False)
End If
Else
TempParam.SetIsActive(True)
End If
TempParam.NotifyPropertyChanged("IsActive")
Exit For
End If
Next
+30 -3
View File
@@ -1055,7 +1055,19 @@ Public Class Hardware
ElseIf TypeOf m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter) Is TextBoxOnOffParam Then
Dim Text As TextBoxOnOffParam = DirectCast(m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter), TextBoxOnOffParam)
Text.SetIsActive(True)
' estraggo il valore: -- NomeParamOnOff = inch(0.6); 0
Dim sItems() As String = sValue.Split(";"c)
sValue = sItems(0)
' verifico se deve essere attivata
If sItems.Count > 1 Then
If sItems(1).Trim <> "0" Then
Text.SetIsActive(True)
Else
Text.SetIsActive(False)
End If
Else
Text.SetIsActive(True)
End If
' se testo numerico, eseguo opportunbe conversioni per H,W e T
sValue = ConvertToDGD(Text.TypeVar, sValue)
' controllo il tipo di dato che si aspetta
@@ -1116,7 +1128,19 @@ Public Class Hardware
ElseIf TypeOf m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter) Is ComboBoxOnOffParam Then
Dim Text As ComboBoxOnOffParam = DirectCast(m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter), ComboBoxOnOffParam)
Text.SetIsActive(True)
' estraggo il valore: -- NomeParamOnOff = inch(0.6); 0
Dim sItems() As String = sValue.Split(";"c)
sValue = sItems(0)
' verifico se deve essere attivata
If sItems.Count > 1 Then
If sItems(1).Trim <> "0" Then
Text.SetIsActive(True)
Else
Text.SetIsActive(False)
End If
Else
Text.SetIsActive(True)
End If
Text.SetSelItem(Text.ItemList(0))
For IndexCombo As Integer = 0 To Text.ItemListDDF.Count - 1
If Trim(Utility.DeleteSuperScript(Text.ItemListDDF(IndexCombo))) = Trim(Utility.DeleteSuperScript(sValue)) Then Text.SetSelItem(Text.ItemList(IndexCombo))
@@ -2015,7 +2039,6 @@ Public Class Hardware
ElseIf TypeOf m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter) Is TextBoxOnOffParam Then
Dim Text As TextBoxOnOffParam = DirectCast(m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter), TextBoxOnOffParam)
sValue = String.Empty
If Not Text.IsActive Then sValue = " nil" : Return True
' controllo il tipo di dato che si aspetta
Select Case Text.TypeVar
Case ConstGen.INCHES
@@ -2049,6 +2072,8 @@ Public Class Hardware
End Select
' se testo numerico, eseguo opportune conversioni per H,W e T
sValue = ConvertFromDGD(Text.TypeVar, sValue)
' se parametro spento
If Not Text.IsActive Then sValue &= "; 0"
Return True
ElseIf TypeOf m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter) Is TextBoxParam Then
Dim Text As TextBoxParam = DirectCast(m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter), TextBoxParam)
@@ -2123,6 +2148,8 @@ Public Class Hardware
If Text.SelItem = Text.ItemList(Index) Then sValue = Text.ItemListDDF(Index) : Return True
Next
sValue = Text.SelItem
' se parametro spento
If Not Text.IsActive Then sValue &= "; 0"
Return True
ElseIf TypeOf m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter) Is ComboBoxParam Then
+1
View File
@@ -13,6 +13,7 @@ Class MainWindowV
' se è assente la chiave di protezione non mostro la finestra Launcher
If Map.refSceneManagerVM.bProtectKey Then
Map.refMainWindowVM.SetLauncher()
Map.refMainWindowVM.ShowErrorCompoLoad()
End If
End Sub
+12
View File
@@ -163,6 +163,18 @@ Public Class MainWindowVM
InitWatcher()
End Sub
#Region "Methods"
Public Sub ShowErrorCompoLoad()
Dim sError As String = Map.refCompoPanelVM.ErrorLoadCompo
If Not String.IsNullOrEmpty(sError) Then
MessageBox.Show(sError, EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
EgtOutLog(sError)
End If
End Sub
#End Region ' Methods
#Region "Watcher"
Public Enum WatcherCalling
+3
View File
@@ -22,6 +22,9 @@ Public Module Utility
' CurrFile deve arrivare già senza estensione!
Private Function GenerateLockFileName(ByVal CurrDirectory As String, Optional ByVal CurrFile As String = "") As String
If OptionModule.ReadOnlyDDF Then
Return String.Empty
End If
' per bloccare il direttorio
If String.IsNullOrEmpty(CurrFile) Then
Return CurrDirectory & "\Lock_Project" & LCK_EXTENSION