EgtDOORCreator :

- Passaggio a lettura intestazione file DDF per avere i parametri dei componenti.
This commit is contained in:
Nicola Pievani
2017-02-02 09:17:03 +00:00
parent ee575750da
commit aa367c4345
17 changed files with 1382 additions and 965 deletions
+10 -2
View File
@@ -2,10 +2,18 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ItemsControl ItemsSource="{Binding CompoBtnList}">
<ItemsControl ItemsSource="{Binding CompoTypeList}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid Columns="1"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Button Content="{Binding Name}" Command="{Binding CompoBtnCommand}"/>
<Button Content="{Binding Name}"
Command="{Binding DataContext.CompoBtnCommand,
RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"
CommandParameter="{Binding}"/>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
+55 -30
View File
@@ -1,50 +1,75 @@
Imports System.ComponentModel
Imports System.Collections.ObjectModel
Imports EgtUILib
Imports System.IO
Public Class CompoPanelViewModel
Implements INotifyPropertyChanged
Implements INotifyPropertyChanged
Private m_Door As Door
Public Property Door As Door
Get
Return m_Door
End Get
Set(value As Door)
m_Door = value
End Set
End Property
Private m_rfMainWindowViewModel As MainWindowViewModel
Private m_rfDoorParametersViewModel As DoorParametersViewModel
Private Shared m_CompoBtnList As New ObservableCollection(Of CompoBtn)
Public Shared ReadOnly Property CompoBtnList As ObservableCollection(Of CompoBtn)
Private Shared m_CompoTypeList As New ObservableCollection(Of CompoType)
Public Shared ReadOnly Property CompoTypeList As ObservableCollection(Of CompoType)
Get
Return m_CompoBtnList
Return m_CompoTypeList
End Get
End Property
Sub New(ByRef Door As Door)
Me.m_Door = Door
' Definizione comando
Private m_CmdCompoBtn As ICommand
Sub New(MainWindowViewModel As MainWindowViewModel)
m_rfMainWindowViewModel = MainWindowViewModel
m_rfDoorParametersViewModel = DirectCast(m_rfMainWindowViewModel.DoorParameters.DataContext, DoorParametersViewModel)
' Lettura file ini per generare bottoni
Dim Index As Integer = 1
Dim CompoName As String = String.Empty
Dim CompoNameDDF As String = String.Empty
Dim nCompoName As Integer = 0
' ciclo sui Compo
While Index <> -1
CompoGetPrivateProfileNameGroup(ConstCompo.S_COMPO & Index, ConstCompo.K_NAME, CompoNameDDF, CompoName)
' se lo trovo
If CompoName = String.Empty Then
Index = -1
Else
m_CompoBtnList.Add(New CompoBtn(CompoName, ConstCompo.S_COMPO & Index, CompoNameDDF, AddressOf Door.AddNewCompo))
Index += 1
' Carico un vettore con il nome delle Path delle componenti
Dim CompoArray() As String = Directory.GetDirectories("c:\EgtData\Doors\Compo")
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
If File.Exists(CurrCompoPath) Then
GetPrivateProfileCompoName(ConstCompo.S_COMPO, ConstCompo.K_NAME, CompoNameDDF, CompoName, CurrCompoPath)
m_CompoTypeList.Add(New CompoType(CompoName, CompoNameDDF, CompoArray(Index)))
End If
End While
Next
End Sub
Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged
#Region "COMMANDS"
Public Sub NotifyPropertyChanged(propName As String)
RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propName))
End Sub
#Region "CompoBtnCommand"
''' <summary>
''' Returns a command that do Exec.
''' </summary>
Public ReadOnly Property CompoBtnCommand As ICommand
Get
If m_CmdCompoBtn Is Nothing Then
m_CmdCompoBtn = New Command(AddressOf CompoBtn)
End If
Return m_CmdCompoBtn
End Get
End Property
''' <summary>
''' Execute the Exec. This method is invoked by the ExecCommand.
''' </summary>
Public Sub CompoBtn(param As Object)
Dim CurrCompoType As CompoType = DirectCast(param, CompoType)
m_rfDoorParametersViewModel.CurrDoor.AddNewCompo(CurrCompoType)
End Sub
#End Region ' CompoBtnCommand
#End Region 'Commands
Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged
Public Sub NotifyPropertyChanged(propName As String)
RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propName))
End Sub
End Class
+4 -3
View File
@@ -14,12 +14,13 @@
Module ConstCompo
Public Const COMPOINI_FILE_NAME As String = "Compo.ini"
Public Const CONFIGINI_FILE_NAME As String = "Config.ini"
Public Const S_COMPO As String = "Compo"
Public Const S_TEMPLATE As String = "Template"
Public Const K_NAME As String = "Name"
Public Const K_COMBOBOX As String = "ComboBox"
Public Const K_TEXTBOX As String = "TextBox"
Public Const K_SPECIALTEXTBOX As String = "SpecialTextBox"
Public Const K_ISACTIVE As String = "IsActive"
Public Const K_COMPO As String = "Compo"
Public Const K_SIZE As String = "size"
Public Const K_WIDTH As String = "width"
+1 -1
View File
@@ -3,7 +3,7 @@
Public Const MSG_EGTDOORCREATOR As Integer = 50000
Public Const MSG_MAINWINDOW As Integer = MSG_EGTDOORCREATOR
Public Const MSG_MISSINGKEYWD As Integer = 10100
Public Const MSG_TOPCOMMANDBAR As Integer = 10200
Public Const MSG_ERROR As Integer = MSG_EGTDOORCREATOR + 100
Public Const MSG_EGTWPFLIB5 As Integer = 30000
Public Const MSG_EGTSAVEFILEDIALOG As Integer = MSG_EGTWPFLIB5
+303 -112
View File
@@ -8,84 +8,90 @@ Friend Module DdfFile
Friend m_Door As New Door
Private FileContent As String()
#Region "Lettura ddf"
Friend CompoListOrder As New List(Of String)({"vision_cut_outs", "louver_cut_outs", "mail_slots", "viewers", "flush_pulls", "hinges", "locks", "flush_bolts", "edge_pulls", "roller_latchs", "pivots", "stops_and_closers", "oh_stop_close"})
Public Function ReadDDF(sPath As String) As Boolean
If Not File.Exists(sPath) Then Return False
#Region "LETTURA DDF"
' Leggo e stampo a video
Public Sub ReadDDF(sPath As String, ByRef ReadDoor As Door)
m_Door = ReadDoor
' restituisce un problema nella lettura di un valore della compo
Dim InvalidValue As String = String.Empty
If Not File.Exists(sPath) Then Return
FileContent = File.ReadAllLines(sPath)
If FileContent.Count = 0 Then Return False
If FileContent.Count = 0 Then
MessageBox.Show("Empty file", EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
End If
For LineIndex As Integer = 0 To FileContent.Count - 1
' size
If SearchKey(FileContent(LineIndex), K_SIZE) Then
LineIndex = GetSize(LineIndex + 1)
If LineIndex = -1 Then
MessageBox.Show("Errore in lettura DDF", "Errore", MessageBoxButton.OK, MessageBoxImage.Error)
InvalidValue += EgtMsg(50102) + K_SIZE + vbCrLf
Exit For
End If
End If
' swing
If SearchKey(FileContent(LineIndex), K_SWING) Then
LineIndex = GetSwing(LineIndex)
If LineIndex = -1 Then
InvalidValue += EgtMsg(50102) + K_SWING + vbCrLf
Exit For
End If
End If
'' swing
'If SearchKey(FileContent(LineIndex), K_SWING) Then
' If Not GetProfiles(LineIndex + 1) Then
' MessageBox.Show("Errore in lettura DDF", "Errore", MessageBoxButton.OK, MessageBoxImage.Error)
' End If
'End If
' profiles
If SearchKey(FileContent(LineIndex), K_PROFILES) Then
LineIndex = GetProfiles(LineIndex + 1)
If LineIndex = -1 Then
MessageBox.Show("Errore in lettura DDF", "Errore", MessageBoxButton.OK, MessageBoxImage.Error)
InvalidValue += EgtMsg(50102) + K_PROFILES + vbCrLf
Exit For
End If
End If
' Compo
If Not String.IsNullOrWhiteSpace(SearchName(FileContent(LineIndex))) Then
Dim CompoNameDDF = SearchName(FileContent(LineIndex))
If Not String.IsNullOrWhiteSpace(CompoNameDDF) Then
LineIndex = GetNewCompo(LineIndex + 1, CompoNameDDF, InvalidValue)
End If
End If
Next
Return True
If Not String.IsNullOrWhiteSpace(InvalidValue) Then
MessageBox.Show(InvalidValue, EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
End If
End Sub
' restituisce il valore della stringa che precede i due punti
Friend Function SearchName(sLine As String) As String
Return Regex.Match(sLine, "\s*(.*?\b)\s*:.*").Groups(1).Value
End Function
' Cerca la stringa con il trattino
Friend Function SearchScore(sLine As String) As Boolean
If Regex.Match(sLine, "\s*(-).*$").Groups(1).Value = "-" Then Return True
Return False
End Function
' restituisce il nome compreso tra il trattino meno e i due punti
Friend Function SearchTemplate(sLine As String) As String
Return Regex.Match(sLine, "\s*-*\s*(.*?\b)\s*:.*$").Groups(1).Value
End Function
' restituisce la stringa dopo i due punti
Friend Function SearchKeyValue(sLine As String, sKey As String) As String
Return Regex.Match(sLine, "\s*" & sKey & "\s*:\s*(.*?\b)\s*$").Groups(1).Value
Return Regex.Match(sLine, "\s*-*\s*" & sKey & "\s*:\s*(.*?\b)\s*$").Groups(1).Value
End Function
' cerca il nome che precede i due punti
Friend Function SearchKey(sLine As String, sKey As String) As Boolean
If Not Regex.Match(sLine, "\s*(" & sKey & ")\s*:\s*$").Groups(1).Value = sKey Then Return False
If Not Regex.Match(sLine, "\s*(" & sKey & ")\s*:.*$").Groups(1).Value = sKey Then Return False
Return True
End Function
'' Lettura di file DDF e scrittura su lista
'Public Function ReadDDF(ByRef DdfList As List(Of String)) As Boolean
' ' Path Compo.ini file
' Dim m_sCompoIniFile As String = String.Empty
' ' Path DdfFile
' Dim m_sDdfFile As New StreamReader("c:\EgtData\EgtDOORCreator\Myprojects\Prova1.ddf")
' Dim sLine As String = String.Empty
' ' Lettura e caricamento del file ddf su una lista
' Do
' sLine = m_sDdfFile.ReadLine()
' If Not sLine Is Nothing Then
' DdfList.Add(sLine)
' End If
' Loop Until sLine Is Nothing
' m_sDdfFile.Close()
' Return True
'End Function
' Cerco l'indice del paragrafo
Private Function DDFGetLeadIndex(ByRef DdfList As List(Of String), ByRef Lead As String) As Integer
Dim Index As Integer
For Index = 0 To DdfList.Count()
If LTrim(DdfList.Item(Index)) = DdfList.Item(Index) Then
Dim sItem() As String = DdfList.Item(Index).Split(":".ToCharArray)
If sItem(0) = Lead Then
Return Index
End If
End If
Next
Return -1
End Function
' carico valori di Size
Public Function GetSize(Index As Integer) As Integer
Dim Width As String = SearchKeyValue(FileContent(Index), K_WIDTH)
If String.IsNullOrEmpty(Width) Then
If String.IsNullOrWhiteSpace(Width) Then
If Not SearchKey(FileContent(Index), K_LOCKEDGE) Then Return -1
Index += 1
Else
@@ -93,7 +99,7 @@ Friend Module DdfFile
Index += 1
End If
Dim Height As String = SearchKeyValue(FileContent(Index), K_HEIGHT)
If String.IsNullOrEmpty(Height) Then
If String.IsNullOrWhiteSpace(Height) Then
If Not SearchKey(FileContent(Index), K_HEIGHT) Then Return -1
Index += 1
Else
@@ -101,7 +107,7 @@ Friend Module DdfFile
Index += 1
End If
Dim Thickness As String = SearchKeyValue(FileContent(Index), K_THICKNESS)
If String.IsNullOrEmpty(Thickness) Then
If String.IsNullOrWhiteSpace(Thickness) Then
If Not SearchKey(FileContent(Index), K_THICKNESS) Then Return -1
Index += 1
Else
@@ -112,31 +118,24 @@ Friend Module DdfFile
End Function
' carico valori swing
Public Function DDFGetSwing(ByRef DdfList As List(Of String)) As Boolean
Dim Index As Integer = DDFGetLeadIndex(DdfList, K_SWING)
If Index <> -1 Then
Dim sItem() As String = DdfList.Item(Index).Split(":".ToCharArray)
m_Door.Swing = sItem(1)
Return True
Public Function GetSwing(Index As Integer) As Integer
Dim Swing As String = SearchKeyValue(FileContent(Index), K_SWING)
If String.IsNullOrWhiteSpace(Swing) Then
If Not SearchKey(FileContent(Index), K_SWING) Then Return -1
Index += 1
Else
Return False
End If
End Function
Public Function ConvertStringToBoolean(sItem As String) As Boolean
If sItem = K_ON Then
Return True
Else
Return False
m_Door.Swing = Swing
Index += 1
End If
Return Index
End Function
' carico valori profiles
Public Function GetProfiles(Index As Integer) As Integer
Dim ReadingError As String = String.Empty
' Lock
Dim LockEdgeType As String = SearchKeyValue(FileContent(Index), K_LOCKEDGE)
If String.IsNullOrEmpty(LockEdgeType) Then
If String.IsNullOrWhiteSpace(LockEdgeType) Then
If Not SearchKey(FileContent(Index), K_LOCKEDGE) Then Return -1
Index += 1
Else
@@ -144,15 +143,15 @@ Friend Module DdfFile
Index += 1
End If
Dim LockEdgeMachining As String = SearchKeyValue(FileContent(Index), K_MACHINING)
If String.IsNullOrEmpty(LockEdgeMachining) Then
If String.IsNullOrWhiteSpace(LockEdgeMachining) Then
If Not SearchKey(FileContent(Index), K_MACHINING) Then Return -1
Index += 1
Else
m_Door.LockEdgeMachining = ConvertStringToBoolean(LockEdgeMachining)
m_Door.LockEdgeMachining = Utility.ConvertOnOffToBoolean(LockEdgeMachining)
Index += 1
End If
Dim LockEdgeOverMaterial As String = SearchKeyValue(FileContent(Index), K_OVERMATERAL)
If String.IsNullOrEmpty(LockEdgeOverMaterial) Then
If String.IsNullOrWhiteSpace(LockEdgeOverMaterial) Then
If Not SearchKey(FileContent(Index), K_OVERMATERAL) Then Return -1
Index += 1
Else
@@ -162,7 +161,7 @@ Friend Module DdfFile
' Hinge
Dim HingeEdgeType As String = SearchKeyValue(FileContent(Index), K_HINGEEDGE)
If String.IsNullOrEmpty(HingeEdgeType) Then
If String.IsNullOrWhiteSpace(HingeEdgeType) Then
If Not SearchKey(FileContent(Index), K_HINGEEDGE) Then Return -1
Index += 1
Else
@@ -170,15 +169,15 @@ Friend Module DdfFile
Index += 1
End If
Dim HingeEdgeMachining As String = SearchKeyValue(FileContent(Index), K_MACHINING)
If String.IsNullOrEmpty(HingeEdgeMachining) Then
If String.IsNullOrWhiteSpace(HingeEdgeMachining) Then
If Not SearchKey(FileContent(Index), K_MACHINING) Then Return -1
Index += 1
Else
m_Door.HingeEdgeMachining = ConvertStringToBoolean(HingeEdgeMachining)
m_Door.HingeEdgeMachining = ConvertOnOffToBoolean(HingeEdgeMachining)
Index += 1
End If
Dim HingeEdgeOverMaterial As String = SearchKeyValue(FileContent(Index), K_OVERMATERAL)
If String.IsNullOrEmpty(HingeEdgeOverMaterial) Then
If String.IsNullOrWhiteSpace(HingeEdgeOverMaterial) Then
If Not SearchKey(FileContent(Index), K_OVERMATERAL) Then Return -1
Index += 1
Else
@@ -188,7 +187,7 @@ Friend Module DdfFile
' Top
Dim TopType As String = SearchKeyValue(FileContent(Index), K_TOP)
If String.IsNullOrEmpty(TopType) Then
If String.IsNullOrWhiteSpace(TopType) Then
If Not SearchKey(FileContent(Index), K_TOP) Then Return -1
Index += 1
Else
@@ -196,15 +195,15 @@ Friend Module DdfFile
Index += 1
End If
Dim TopMachining As String = SearchKeyValue(FileContent(Index), K_MACHINING)
If String.IsNullOrEmpty(TopMachining) Then
If String.IsNullOrWhiteSpace(TopMachining) Then
If Not SearchKey(FileContent(Index), K_MACHINING) Then Return -1
Index += 1
Else
m_Door.TopMachining = ConvertStringToBoolean(TopMachining)
m_Door.TopMachining = ConvertOnOffToBoolean(TopMachining)
Index += 1
End If
Dim TopOverMaterial As String = SearchKeyValue(FileContent(Index), K_OVERMATERAL)
If String.IsNullOrEmpty(TopOverMaterial) Then
If String.IsNullOrWhiteSpace(TopOverMaterial) Then
If Not SearchKey(FileContent(Index), K_OVERMATERAL) Then Return -1
Index += 1
Else
@@ -214,7 +213,7 @@ Friend Module DdfFile
' Bottom
Dim BottomType As String = SearchKeyValue(FileContent(Index), K_BOTTOM)
If String.IsNullOrEmpty(BottomType) Then
If String.IsNullOrWhiteSpace(BottomType) Then
If Not SearchKey(FileContent(Index), K_BOTTOM) Then Return -1
Index += 1
Else
@@ -223,16 +222,16 @@ Friend Module DdfFile
End If
Dim BottomMachining As String = SearchKeyValue(FileContent(Index), K_MACHINING)
If String.IsNullOrEmpty(BottomMachining) Then
If String.IsNullOrWhiteSpace(BottomMachining) Then
If Not SearchKey(FileContent(Index), K_MACHINING) Then Return -1
Index += 1
Else
m_Door.BottomMachining = ConvertStringToBoolean(BottomMachining)
m_Door.BottomMachining = ConvertOnOffToBoolean(BottomMachining)
Index += 1
End If
Dim BottomOverMaterial As String = SearchKeyValue(FileContent(Index), K_OVERMATERAL)
If String.IsNullOrEmpty(BottomOverMaterial) Then
If String.IsNullOrWhiteSpace(BottomOverMaterial) Then
If Not SearchKey(FileContent(Index), K_OVERMATERAL) Then Return -1
Index += 1
Else
@@ -243,64 +242,256 @@ Friend Module DdfFile
Return Index
End Function
' restituisce il nome della componenente
Public Function DDFGetCompoName(ByRef DdfList As List(Of String), ByRef LastIndex As Integer) As String
Dim CompoName As String = String.Empty
Dim Index As Integer
For Index = LastIndex To DdfList.Count()
If LTrim(DdfList.Item(Index)) = DdfList.Item(Index) Then
Dim sItem() As String = DdfList.Item(Index).Split(":".ToCharArray)
CompoName = sItem(0)
' ricerco la compo nella lista dei compobtn
Public Function GetNewCompo(Index As Integer, CompoNameDDF As String, ByRef InvalidValue As String) As Integer
Dim bCompo As Boolean = False
Dim ErrorRow As String = String.Empty
For CompoListIndex = 0 To CompoPanelViewModel.CompoBtnList.Count() - 1
If CompoPanelViewModel.CompoBtnList(CompoListIndex).DDFCompoName = CompoNameDDF Then
Dim NewCompoIndex As Integer = -1
While Index < FileContent.Count AndAlso Not String.IsNullOrWhiteSpace(FileContent(Index))
bCompo = True
If SearchScore(FileContent(Index)) Then
' Aggiungo la compo alla lista se trovo il trattino e restituisco l'indice associato alla lista
NewCompoIndex = m_Door.AddNewCompo(S_COMPO & CompoListIndex + 1)
End If
If NewCompoIndex <> -1 Then
Dim ReadValue As String = SearchKeyValue(FileContent(Index), SearchTemplate(FileContent(Index)))
Select Case SearchTemplate(FileContent(Index))
Case m_Door.CompoList(NewCompoIndex).ComboBox1DDFName
' se la lista è stata inserita manualmente allora esiste una listDDF
If m_Door.CompoList(NewCompoIndex).ComboBox1ListDDF.Count > 0 AndAlso m_Door.CompoList(NewCompoIndex).ComboBox1ListDDF.Contains(ReadValue) Then
Dim nSelIndex As Integer = m_Door.CompoList(NewCompoIndex).ComboBox1ListDDF.IndexOf(ReadValue)
m_Door.CompoList(NewCompoIndex).ComboBox1SelItem = m_Door.CompoList(NewCompoIndex).ComboBox1List(nSelIndex)
' se la lista è caricata da una directoru allora non esiste la listDDF
ElseIf m_Door.CompoList(NewCompoIndex).ComboBox1List.Contains(ReadValue) Then
m_Door.CompoList(NewCompoIndex).ComboBox1SelItem = ReadValue
Else
' se il vaolore inserito non esiste allora scrivo una riga di errore
InvalidValue += EgtMsg(50105) + " " + CStr(Index) + " " + vbCrLf + EgtMsg(50103) + ": " + ReadValue + vbCrLf
End If
Case m_Door.CompoList(NewCompoIndex).ComboBox2DDFName
If m_Door.CompoList(NewCompoIndex).ComboBox2ListDDF.Count > 0 AndAlso m_Door.CompoList(NewCompoIndex).ComboBox2ListDDF.Contains(ReadValue) Then
Dim nSelIndex As Integer = m_Door.CompoList(NewCompoIndex).ComboBox2ListDDF.IndexOf(ReadValue)
m_Door.CompoList(NewCompoIndex).ComboBox2SelItem = m_Door.CompoList(NewCompoIndex).ComboBox2List(nSelIndex)
ElseIf m_Door.CompoList(NewCompoIndex).ComboBox2List.Contains(ReadValue) Then
m_Door.CompoList(NewCompoIndex).ComboBox2SelItem = ReadValue
Else
InvalidValue += EgtMsg(50105) + " " + CStr(Index) + " " + vbCrLf + EgtMsg(50103) + ": " + ReadValue + vbCrLf
End If
Case m_Door.CompoList(NewCompoIndex).ComboBox3DDFName
If m_Door.CompoList(NewCompoIndex).ComboBox3ListDDF.Count > 0 AndAlso m_Door.CompoList(NewCompoIndex).ComboBox3ListDDF.Contains(ReadValue) Then
Dim nSelIndex As Integer = m_Door.CompoList(NewCompoIndex).ComboBox3ListDDF.IndexOf(ReadValue)
m_Door.CompoList(NewCompoIndex).ComboBox3SelItem = m_Door.CompoList(NewCompoIndex).ComboBox3List(nSelIndex)
ElseIf m_Door.CompoList(NewCompoIndex).ComboBox3List.Contains(ReadValue) Then
m_Door.CompoList(NewCompoIndex).ComboBox3SelItem = ReadValue
Else
InvalidValue += EgtMsg(50105) + " " + CStr(Index) + " " + vbCrLf + EgtMsg(50103) + ": " + ReadValue + vbCrLf
End If
Case m_Door.CompoList(NewCompoIndex).TextBox1DDFName
m_Door.CompoList(NewCompoIndex).TextBox1Value = ReadValue
Case m_Door.CompoList(NewCompoIndex).TextBox2DDFName
m_Door.CompoList(NewCompoIndex).TextBox2Value = ReadValue
Case m_Door.CompoList(NewCompoIndex).TextBox3DDFName
m_Door.CompoList(NewCompoIndex).TextBox3Value = ReadValue
Case m_Door.CompoList(NewCompoIndex).TextBox4DDFName
m_Door.CompoList(NewCompoIndex).TextBox4Value = ReadValue
Case m_Door.CompoList(NewCompoIndex).TextBox5DDFName
m_Door.CompoList(NewCompoIndex).TextBox5Value = ReadValue
Case m_Door.CompoList(NewCompoIndex).SpecialTextBox1DDFName
m_Door.CompoList(NewCompoIndex).SpecialTextBox1Value = ReadValue
End Select
End If
Index += 1
End While
Exit For
End If
Next
Return CompoName
If Not bCompo Then
' salta la lettura di tutte le righe che seguono fino al primo spazio vuoto
ErrorRow += CStr(Index)
Index -= 1
While Index < FileContent.Length AndAlso Not String.IsNullOrWhiteSpace(FileContent(Index))
Dim x As String = FileContent(Index)
Index += 1
x = FileContent(Index)
End While
InvalidValue += EgtMsg(50104) + ": " + ErrorRow + "-" + CStr(Index + 1) + Environment.NewLine
End If
Return Index
End Function
#End Region ' Lettura ddf
#Region "SCRITTURA DDF"
'genero le stringhe che dovranno essere scritte nel DDF
Friend Sub WriteDDF(Door As Door, sPath As String)
' pulisco lista prima di iniziare a scrivere
Dim DdfFileContent As New List(Of String)
'Genero una lista di stringhe
Dim dVal As Double = 0
DdfFileContent.Add(ConstCompo.K_SIZE & ":")
StringToDouble(Door.Width, dVal)
DdfFileContent.Add(ConstCompo.K_SPACE3 & ConstCompo.K_WIDTH & ": " & DoubleToString(dVal, 3))
StringToDouble(Door.Height, dVal)
DdfFileContent.Add(ConstCompo.K_SPACE3 & ConstCompo.K_HEIGHT & ": " & DoubleToString(dVal, 3))
StringToDouble(Door.Thickness, dVal)
DdfFileContent.Add(ConstCompo.K_SPACE3 & ConstCompo.K_THICKNESS & ": " & DoubleToString(dVal, 3))
' aggiungo una riga vuota per separare la lista successiva
DdfFileContent.Add("")
DdfFileContent.Add("" & ConstCompo.K_SWING & ": " & Door.Swing)
' aggiungo una riga vuota per separare la lista successiva
DdfFileContent.Add("")
DdfFileContent.Add("" & ConstCompo.K_PROFILES & ":")
DdfFileContent.Add(ConstCompo.K_SPACE3 & ConstCompo.K_LOCKEDGE & ": " & Door.LockEdgeType)
DdfFileContent.Add(ConstCompo.K_SPACE5 & ConstCompo.K_MACHINING & ": " & ConvertBooleanToOnOff(Door.LockEdgeMachining))
StringToDouble(Door.LockEdgeOverMaterial, dVal)
DdfFileContent.Add(ConstCompo.K_SPACE5 & ConstCompo.K_OVERMATERAL & ": " & DoubleToString(dVal, 3))
DdfFileContent.Add(ConstCompo.K_SPACE3 & ConstCompo.K_HINGEEDGE & ": " & Door.HingeEdgeType)
DdfFileContent.Add(ConstCompo.K_SPACE5 & ConstCompo.K_MACHINING & ": " & ConvertBooleanToOnOff(Door.HingeEdgeMachining))
StringToDouble(Door.HingeEdgeOverMaterial, dVal)
DdfFileContent.Add(ConstCompo.K_SPACE5 & ConstCompo.K_OVERMATERAL & ": " & DoubleToString(dVal, 3))
DdfFileContent.Add(ConstCompo.K_SPACE3 & ConstCompo.K_TOP & ": " & Door.TopType)
DdfFileContent.Add(ConstCompo.K_SPACE5 & ConstCompo.K_MACHINING & ": " & ConvertBooleanToOnOff(Door.TopMachining))
StringToDouble(Door.TopOverMaterial, dVal)
DdfFileContent.Add(ConstCompo.K_SPACE5 & ConstCompo.K_OVERMATERAL & ": " & DoubleToString(dVal, 3))
DdfFileContent.Add(ConstCompo.K_SPACE3 & ConstCompo.K_BOTTOM & ": " & Door.BottomType)
DdfFileContent.Add(ConstCompo.K_SPACE5 & ConstCompo.K_MACHINING & ": " & ConvertBooleanToOnOff(Door.BottomMachining))
StringToDouble(Door.BottomOverMaterial, dVal)
DdfFileContent.Add(ConstCompo.K_SPACE5 & ConstCompo.K_OVERMATERAL & ": " & DoubleToString(dVal, 3))
' aggiungo una riga vuota per separare la lista successiva
DdfFileContent.Add("")
' Riordino e stampo le compo
SearchCompo(DdfFileContent, Door)
If Not Directory.Exists(Path.GetDirectoryName(sPath)) Then
Directory.CreateDirectory(Path.GetDirectoryName(sPath))
End If
File.WriteAllLines(sPath, DdfFileContent, Text.Encoding.UTF8)
End Sub
' stampa le compo seguedo l'ordine della lista delle componenti del ddf
Public Sub SearchCompo(DdfFileContent As List(Of String), Door As Door)
Dim WritingError As New List(Of String)
For Index1 = 0 To DdfFile.CompoListOrder.Count() - 1
For Index2 = 0 To Door.CompoList.Count() - 1
If DdfFile.CompoListOrder(Index1) = Door.CompoList.Item(Index2).NameDDF Then
DdfFileContent.AddRange(GenerateCompolistDDF(Door.CompoList.Item(Index2), WritingError))
End If
Next
Next
ErrorMsg(WritingError)
End Sub
Public Sub ErrorMsg(ErrorList As List(Of String))
Dim Msg As String = String.Empty
For Index = 0 To ErrorList.Count - 1
Msg += ErrorList(Index)
Msg += vbCrLf
Next
If Not String.IsNullOrWhiteSpace(Msg) Then
MessageBox.Show(EgtMsg(50106) & vbCrLf & Msg, EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
End If
End Sub
'Genero la lista di parametri di ogni compo che vedo a video
Public Function GenerateCompolistDDF(Compo As Compo) As List(Of String)
Public Function GenerateCompolistDDF(Compo As Compo, ByRef ErrorValue As List(Of String)) As List(Of String)
'Dim ErrorValue As String = String.Empty
Dim CompoListDDF As New List(Of String)
CompoListDDF.Add(Compo.NameDDF & ":")
'aggiungo le combobox
If Compo.ComboBox1Visibility = Visibility.Visible Then
CompoListDDF.Add(ConstCompo.K_SPACE3 & "- " & Compo.ComboBox1DDFName & ": " & If(Not Path.HasExtension(Compo.ComboBox1SelItem), Compo.ComboBox1ListDDF.Item(Compo.ComboBox1List.IndexOf(Compo.ComboBox1SelItem)), Compo.ComboBox1SelItem.Replace(Path.GetExtension(Compo.ComboBox1SelItem), "")))
If Compo.ComboBox1Visibility = Visibility.Visible AndAlso Not String.IsNullOrWhiteSpace(Compo.ComboBox1SelItem) Then
Dim ItemComboBox As String = String.Empty
If Compo.ComboBox1ListDDF.Count > 0 Then
ItemComboBox = Compo.ComboBox1ListDDF.Item(Compo.ComboBox1List.IndexOf(Compo.ComboBox1SelItem))
Else
ItemComboBox = Compo.ComboBox1SelItem
End If
CompoListDDF.Add(ConstCompo.K_SPACE3 & "- " & Compo.ComboBox1DDFName & ": " & ItemComboBox)
ElseIf Compo.ComboBox1Visibility = Visibility.Visible Then
ErrorValue.Add(Compo.Name + ": " + Compo.ComboBox1Name)
CompoListDDF.Add(ConstCompo.K_SPACE3 & "- " & Compo.ComboBox1DDFName & ": ")
End If
If Compo.ComboBox2Visibility = Visibility.Visible Then
CompoListDDF.Add(ConstCompo.K_SPACE5 & Compo.ComboBox2DDFName & ": " & If(Not Path.HasExtension(Compo.ComboBox2SelItem), Compo.ComboBox2ListDDF.Item(Compo.ComboBox2List.IndexOf(Compo.ComboBox2SelItem)), Compo.ComboBox2SelItem.Replace(Path.GetExtension(Compo.ComboBox2SelItem), "")))
If Compo.ComboBox2Visibility = Visibility.Visible AndAlso Not String.IsNullOrWhiteSpace(Compo.ComboBox2SelItem) Then
Dim ItemComboBox As String = String.Empty
If Not Path.HasExtension(Compo.ComboBox2SelItem) Then
If Compo.ComboBox2ListDDF.Count > 0 Then
ItemComboBox = Compo.ComboBox2ListDDF.Item(Compo.ComboBox2List.IndexOf(Compo.ComboBox2SelItem))
Else
ItemComboBox = Compo.ComboBox2SelItem
End If
Else
ItemComboBox = Compo.ComboBox2SelItem.Replace(Path.GetExtension(Compo.ComboBox2SelItem), "")
End If
CompoListDDF.Add(ConstCompo.K_SPACE3 & "- " & Compo.ComboBox2DDFName & ": " & ItemComboBox)
ElseIf Compo.ComboBox2Visibility = Visibility.Visible Then
ErrorValue.Add(Compo.Name + ": " + Compo.ComboBox2Name)
CompoListDDF.Add(ConstCompo.K_SPACE3 & "- " & Compo.ComboBox2DDFName & ": ")
End If
If Compo.ComboBox3Visibility = Visibility.Visible Then
CompoListDDF.Add(ConstCompo.K_SPACE5 & Compo.ComboBox3DDFName & ": " & If(Not Path.HasExtension(Compo.ComboBox3SelItem), Compo.ComboBox3ListDDF.Item(Compo.ComboBox3List.IndexOf(Compo.ComboBox3SelItem)), Compo.ComboBox3SelItem.Replace(Path.GetExtension(Compo.ComboBox3SelItem), "")))
If Compo.ComboBox3Visibility = Visibility.Visible AndAlso Not String.IsNullOrWhiteSpace(Compo.ComboBox3SelItem) Then
Dim ItemComboBox As String = String.Empty
If Not Path.HasExtension(Compo.ComboBox3SelItem) Then
If Compo.ComboBox3ListDDF.Count > 0 Then
ItemComboBox = Compo.ComboBox3ListDDF.Item(Compo.ComboBox3List.IndexOf(Compo.ComboBox3SelItem))
Else
ItemComboBox = Compo.ComboBox3SelItem
End If
Else
ItemComboBox = Compo.ComboBox3SelItem.Replace(Path.GetExtension(Compo.ComboBox3SelItem), "")
End If
CompoListDDF.Add(ConstCompo.K_SPACE3 & "- " & Compo.ComboBox3DDFName & ": " & ItemComboBox)
ElseIf Compo.ComboBox3Visibility = Visibility.Visible Then
ErrorValue.Add(Compo.Name + ": " + Compo.ComboBox3Name)
CompoListDDF.Add(ConstCompo.K_SPACE3 & "- " & Compo.ComboBox3DDFName & ": ")
End If
'aggiungo le textbox
Dim dVal As Double = 0
If Compo.TextBox1Visibility = Visibility.Visible Then
StringToDouble(Compo.TextBox1Value, dVal)
If Compo.TextBox1Visibility = Visibility.Visible AndAlso Not String.IsNullOrWhiteSpace(Compo.TextBox1Value) AndAlso StringToDouble(Compo.TextBox1Value, dVal) Then
CompoListDDF.Add(ConstCompo.K_SPACE5 & Compo.TextBox1DDFName & ": " & DoubleToString(dVal, 3))
ElseIf Compo.TextBox1Visibility = Visibility.Visible Then
ErrorValue.Add(Compo.Name + ": " + Compo.TextBox1Name)
CompoListDDF.Add(ConstCompo.K_SPACE5 & Compo.TextBox1DDFName & ": ")
End If
If Compo.TextBox2Visibility = Visibility.Visible Then
StringToDouble(Compo.TextBox2Value, dVal)
If Compo.TextBox2Visibility = Visibility.Visible AndAlso Not String.IsNullOrWhiteSpace(Compo.TextBox2Value) AndAlso StringToDouble(Compo.TextBox2Value, dVal) Then
CompoListDDF.Add(ConstCompo.K_SPACE5 & Compo.TextBox2DDFName & ": " & DoubleToString(dVal, 3))
ElseIf Compo.TextBox2Visibility = Visibility.Visible Then
ErrorValue.Add(Compo.Name + ": " + Compo.TextBox2Name)
CompoListDDF.Add(ConstCompo.K_SPACE5 & Compo.TextBox2DDFName & ": ")
End If
If Compo.TextBox3Visibility = Visibility.Visible Then
StringToDouble(Compo.TextBox3Value, dVal)
If Compo.TextBox3Visibility = Visibility.Visible AndAlso Not String.IsNullOrWhiteSpace(Compo.TextBox3Value) AndAlso StringToDouble(Compo.TextBox3Value, dVal) Then
CompoListDDF.Add(ConstCompo.K_SPACE5 & Compo.TextBox3DDFName & ": " & DoubleToString(dVal, 3))
ElseIf Compo.TextBox3Visibility = Visibility.Visible Then
ErrorValue.Add(Compo.Name + ": " + Compo.TextBox3Name)
CompoListDDF.Add(ConstCompo.K_SPACE5 & Compo.TextBox3DDFName & ": ")
End If
If Compo.TextBox4Visibility = Visibility.Visible Then
StringToDouble(Compo.TextBox4Value, dVal)
If Compo.TextBox4Visibility = Visibility.Visible AndAlso Not String.IsNullOrWhiteSpace(Compo.TextBox4Value) AndAlso StringToDouble(Compo.TextBox4Value, dVal) Then
CompoListDDF.Add(ConstCompo.K_SPACE5 & Compo.TextBox4DDFName & ": " & DoubleToString(dVal, 3))
ElseIf Compo.TextBox4Visibility = Visibility.Visible Then
ErrorValue.Add(Compo.Name + ": " + Compo.TextBox4Name)
CompoListDDF.Add(ConstCompo.K_SPACE5 & Compo.TextBox4DDFName & ": ")
End If
If Compo.TextBox5Visibility = Visibility.Visible Then
StringToDouble(Compo.TextBox5Value, dVal)
If Compo.TextBox5Visibility = Visibility.Visible AndAlso Not String.IsNullOrWhiteSpace(Compo.TextBox5Value) AndAlso StringToDouble(Compo.TextBox5Value, dVal) Then
CompoListDDF.Add(ConstCompo.K_SPACE5 & Compo.TextBox5DDFName & ": " & DoubleToString(dVal, 3))
ElseIf Compo.TextBox5Visibility = Visibility.Visible Then
ErrorValue.Add(Compo.Name + ": " + Compo.TextBox5Name)
CompoListDDF.Add(ConstCompo.K_SPACE5 & Compo.TextBox5DDFName & ": ")
End If
If Compo.SpecialTextBox1Visibility = Visibility.Visible Then
StringToDouble(Compo.SpecialTextBox1Value, dVal)
If Compo.SpecialTextBox1Visibility = Visibility.Visible AndAlso Not String.IsNullOrWhiteSpace(Compo.SpecialTextBox1Value) AndAlso StringToDouble(Compo.SpecialTextBox1Value, dVal) Then
CompoListDDF.Add(ConstCompo.K_SPACE5 & Compo.SpecialTextBox1DDFName & ": " & DoubleToString(dVal, 3))
ElseIf Compo.SpecialTextBox1Visibility = Visibility.Visible Then
ErrorValue.Add(Compo.Name + ": " + Compo.SpecialTextBox1Name)
CompoListDDF.Add(ConstCompo.K_SPACE5 & Compo.SpecialTextBox1Name & ": ")
End If
' aggiungo una riga vuota
CompoListDDF.Add("")
Return CompoListDDF
End Function
#End Region ' Scrittura DDF
End Module
+311 -538
View File
@@ -1,592 +1,235 @@
Imports System.ComponentModel
Imports System.Collections.ObjectModel
Imports System.IO
Public Class Compo
Implements INotifyPropertyChanged
#Region "GROUP"
Friend m_rfCurrDoor As Door
Private m_Name As String
Public Property Name As String
Private m_CompoType As CompoType
Public ReadOnly Property CompoType As CompoType
Get
Return m_Name
Return m_CompoType
End Get
End Property
#Region "Template ComboBox"
Private m_TemplateName As String
Public Property TemplateName As String
Get
Return m_TemplateName
End Get
Set(value As String)
m_Name = value
m_TemplateName = value
End Set
End Property
Private m_NameDDF As String
Public Property NameDDF As String
Private m_TemplateDDFName As String
Public Property TemplateDDFName As String
Get
Return m_NameDDF
Return m_TemplateDDFName
End Get
Set(value As String)
m_NameDDF = value
m_TemplateDDFName = value
End Set
End Property
#Region "ComboBox"
#Region "ComboBox1"
Private m_ComboBox1Index As Integer
Public Property ComboBox1Index As Integer
Private m_TemplateItemList As New List(Of String)
Public Property TemplateItemList As List(Of String)
Get
Return m_ComboBox1Index
End Get
Set(value As Integer)
m_ComboBox1Index = value
End Set
End Property
Private m_ComboBox1Name As String
Public Property ComboBox1Name As String
Get
Return m_ComboBox1Name
End Get
Set(value As String)
m_ComboBox1Name = value
End Set
End Property
Private m_ComboBox1List As List(Of String)
Public Property ComboBox1List As List(Of String)
Get
Return m_ComboBox1List
Return m_TemplateItemList
End Get
Set(value As List(Of String))
m_ComboBox1List = value
m_TemplateItemList = value
End Set
End Property
Private m_ComboBox1ListDDF As List(Of String)
Public Property ComboBox1ListDDF As List(Of String)
Private m_TemplateSelItem As String
Public Property TemplateSelItem As String
Get
Return m_ComboBox1ListDDF
End Get
Set(value As List(Of String))
m_ComboBox1ListDDF = value
End Set
End Property
Private m_ComboBox1SpecialList As List(Of String)
Public Property ComboBox1SpecialList As List(Of String)
Get
Return m_ComboBox1SpecialList
End Get
Set(value As List(Of String))
m_ComboBox1SpecialList = value
End Set
End Property
Private m_ComboBox1SelItem As String
Public Property ComboBox1SelItem As String
Get
Return m_ComboBox1SelItem
Return m_TemplateSelItem
End Get
Set(value As String)
m_ComboBox1SelItem = value
Dim bFound As Boolean = False
If Not IsNothing(ComboBox1SpecialList) Then
For Index = 0 To m_ComboBox1SpecialList.Count() - 1
If m_ComboBox1SpecialList(Index) = m_ComboBox1SelItem Then
bFound = True
Exit For
End If
Next
If bFound Then
m_SpecialTextBox1Visibility = Visibility.Visible
Else
m_SpecialTextBox1Visibility = Visibility.Collapsed
End If
NotifyPropertyChanged("SpecialTextBox1Visibility")
Dim CurrItemPath As String = m_CompoType.Path & "\" & value
If Not Path.HasExtension(CurrItemPath) Then
CurrItemPath &= ".lua"
End If
End Set
End Property
Private m_ComboBox1DDFName As String
Public Property ComboBox1DDFName As String
Get
Return m_ComboBox1DDFName
End Get
Set(value As String)
m_ComboBox1DDFName = value
End Set
End Property
Private m_ComboBox1Visibility As Visibility
Public Property ComboBox1Visibility As Visibility
Get
Return m_ComboBox1Visibility
End Get
Set(value As Visibility)
m_ComboBox1Visibility = value
End Set
End Property
#End Region ' ComboBox 1
#Region "ComboBox2"
Private m_ComboBox2Index As Integer
Public Property ComboBox2Index As Integer
Get
Return m_ComboBox2Index
End Get
Set(value As Integer)
m_ComboBox2Index = value
End Set
End Property
Private m_ComboBox2Name As String
Public Property ComboBox2Name As String
Get
Return m_ComboBox2Name
End Get
Set(value As String)
m_ComboBox2Name = value
End Set
End Property
Private m_ComboBox2List As List(Of String)
Public Property ComboBox2List As List(Of String)
Get
Return m_ComboBox2List
End Get
Set(value As List(Of String))
m_ComboBox2List = value
End Set
End Property
Private m_ComboBox2ListDDF As List(Of String)
Public Property ComboBox2ListDDF As List(Of String)
Get
Return m_ComboBox2ListDDF
End Get
Set(value As List(Of String))
m_ComboBox2ListDDF = value
End Set
End Property
Private m_ComboBox2SpecialList As List(Of String)
Public Property ComboBox2SpecialList As List(Of String)
Get
Return m_ComboBox2SpecialList
End Get
Set(value As List(Of String))
m_ComboBox2SpecialList = value
End Set
End Property
Private m_ComboBox2SelItem As String
Public Property ComboBox2SelItem As String
Get
Return m_ComboBox2SelItem
End Get
Set(value As String)
m_ComboBox2SelItem = value
Dim bFound As Boolean = False
If Not IsNothing(ComboBox2SpecialList) Then
For Index = 0 To m_ComboBox2SpecialList.Count() - 1
If m_ComboBox2SpecialList(Index) = m_ComboBox2SelItem Then
bFound = True
Exit For
End If
Next
If bFound Then
m_SpecialTextBox1Visibility = Visibility.Visible
Else
m_SpecialTextBox1Visibility = Visibility.Collapsed
If Not File.Exists(CurrItemPath) Then Return
m_TemplateSelItem = value
Dim ReadCurrCompo() As String = File.ReadAllLines(CurrItemPath)
' creo la stringa che contiene la lista degli errori
Dim ErrorList As String = String.Empty
For LineIndex = 0 To ReadCurrCompo.Count - 1
Dim CurrCompoFileLine As String = ReadCurrCompo(LineIndex)
If RegexFunction.IsGraphicParametersTitle(CurrCompoFileLine) Then
Dim ParamIndex As Integer = 1
Dim NewCompoParam As CompoParam = Nothing
Dim bIsFinished As Boolean = False
While Not bIsFinished
NewCompoParam = Nothing
If Not String.IsNullOrWhiteSpace(ReadCurrCompo(LineIndex + ParamIndex)) Then
bIsFinished = Not ReadParam(ReadCurrCompo(LineIndex + ParamIndex), ParamIndex, NewCompoParam, ErrorList)
Else
LineIndex += 1
Continue While
End If
If Not IsNothing(NewCompoParam) Then
' se non esiste l'indice
If Not m_CompoParamList.Count > ParamIndex - 1 Then
' creo il parametro combo
Me.CompoParamList.Insert(ParamIndex - 1, NewCompoParam)
Else
' se esiste ma è diverso il nome DDF
If Not m_CompoParamList(ParamIndex - 1).DDFName = NewCompoParam.DDFName Then
' creo il nuovo parametro combo
m_CompoParamList.RemoveAt(ParamIndex - 1)
m_CompoParamList.Insert(ParamIndex - 1, NewCompoParam)
End If
End If
End If
If Not bIsFinished Then ParamIndex += 1
End While
For DeleteIndex = m_CompoParamList.Count - 1 To ParamIndex - 1 Step -1
m_CompoParamList.RemoveAt(DeleteIndex)
Next
Exit For
End If
NotifyPropertyChanged("SpecialTextBox1Visibility")
End If
Next
End Set
End Property
Private m_ComboBox2DDFName As String
Public Property ComboBox2DDFName As String
Get
Return m_ComboBox2DDFName
End Get
Set(value As String)
m_ComboBox2DDFName = value
End Set
End Property
Private m_ComboBox2Visibility As Visibility
Public Property ComboBox2Visibility As Visibility
Get
Return m_ComboBox2Visibility
End Get
Set(value As Visibility)
m_ComboBox2Visibility = value
End Set
End Property
#End Region ' ComboBox2
#Region "ComboBox3"
Private m_ComboBox3Index As Integer
Public Property ComboBox3Index As Integer
Get
Return m_ComboBox3Index
End Get
Set(value As Integer)
m_ComboBox3Index = value
End Set
End Property
Private m_ComboBox3Name As String
Public Property ComboBox3Name As String
Get
Return m_ComboBox3Name
End Get
Set(value As String)
m_ComboBox3Name = value
End Set
End Property
Private m_ComboBox3List As List(Of String)
Public Property ComboBox3List As List(Of String)
Get
Return m_ComboBox3List
End Get
Set(value As List(Of String))
m_ComboBox3List = value
End Set
End Property
Private m_ComboBox3ListDDF As List(Of String)
Public Property ComboBox3ListDDF As List(Of String)
Get
Return m_ComboBox3ListDDF
End Get
Set(value As List(Of String))
m_ComboBox3ListDDF = value
End Set
End Property
Private m_ComboBox3SpecialList As List(Of String)
Public Property ComboBox3SpecialList As List(Of String)
Get
Return m_ComboBox3SpecialList
End Get
Set(value As List(Of String))
m_ComboBox3SpecialList = value
End Set
End Property
Private m_ComboBox3SelItem As String
Public Property ComboBox3SelItem As String
Get
Return m_ComboBox3SelItem
End Get
Set(value As String)
m_ComboBox3SelItem = value
Dim bFound As Boolean = False
If Not IsNothing(ComboBox3SpecialList) Then
For Index = 0 To m_ComboBox3SpecialList.Count() - 1
If m_ComboBox3SpecialList(Index) = m_ComboBox3SelItem Then
bFound = True
Exit For
End If
Next
If bFound Then
m_SpecialTextBox1Visibility = Visibility.Visible
Private Function ReadParam(sLine As String, nParamIndex As Integer, ByRef NewCompoParam As CompoParam, sErrorList As String) As Boolean
Dim ReadLine As String = ParamLine(sLine, "Param" & nParamIndex)
If Not String.IsNullOrWhiteSpace(ReadLine) Then
Dim sItems() As String = ReadLine.Split(";"c)
If sItems.Count > 0 Then
Select Case sItems(0)
Case "ComboBox"
If sItems.Count >= 4 Then
' carico gli elementi della lista
Dim sComboItemList() As String = sItems(3).Split(","c)
Dim ComboItemList As New List(Of String)
Dim DDFComboItemList As New List(Of String)
For ItemIndex = 0 To sComboItemList.Count - 1
' carico la lista con i nomi DDF
Dim ComboItem() As String = sComboItemList(ItemIndex).Split("/"c)
DDFComboItemList.Add(ComboItem(0))
ComboItemList.Add(Utility.ReadMsg(ComboItem(1)))
Next
NewCompoParam = New ComboBoxParam(sItems(1), Utility.ReadMsg(sItems(2)), ComboItemList, DDFComboItemList)
Return True
Else
sErrorList &= String.Format("Error reading {0} param in {1} compo.", sItems(1), m_CompoType.DDFName)
End If
Case "TextBox"
If sItems.Count >= 3 Then
If sItems.Count > 3 Then
Dim DDFComboValuelList As New List(Of String)
Dim sComboItemList() As String = sItems(4).Split(","c)
For ItemIndex = 0 To sComboItemList.Count - 1
DDFComboValuelList.Add(sComboItemList(ItemIndex))
Next
For ParamIndex = 0 To m_CompoParamList.Count - 1
Dim CurrCompoParam As CompoParam = m_CompoParamList(ParamIndex)
If CurrCompoParam.DDFName = sItems(3) Then
If TypeOf CurrCompoParam Is ComboBoxParam Then
NewCompoParam = New TextBoxParam(sItems(1), Utility.ReadMsg(sItems(2)), DirectCast(CurrCompoParam, ComboBoxParam), DDFComboValuelList)
Return True
Else
NewCompoParam = New TextBoxParam(sItems(1), Utility.ReadMsg(sItems(2)), Nothing, Nothing)
Return True
End If
Exit For
End If
Next
NewCompoParam = New TextBoxParam(sItems(1), Utility.ReadMsg(sItems(2)), Nothing, Nothing)
Return True
Else
NewCompoParam = New TextBoxParam(sItems(1), Utility.ReadMsg(sItems(2)), Nothing, Nothing)
Return True
End If
Else
If Not String.IsNullOrEmpty(sErrorList) Then sErrorList &= Environment.NewLine
sErrorList &= String.Format("Error reading {0} param in {1} compo.", sItems(1), m_CompoType.DDFName)
End If
Case "TextBoxOnOff"
If sItems.Count >= 3 Then
If sItems.Count > 3 Then
Dim DDFComboValuelList As New List(Of String)
Dim sComboItemList() As String = sItems(4).Split(","c)
For ItemIndex = 0 To sComboItemList.Count - 1
DDFComboValuelList.Add(sComboItemList(ItemIndex))
Next
For ParamIndex = 0 To m_CompoParamList.Count - 1
Dim CurrCompoParam As CompoParam = m_CompoParamList(ParamIndex)
If CurrCompoParam.DDFName = sItems(3) Then
If TypeOf CurrCompoParam Is ComboBoxParam Then
NewCompoParam = New TextBoxOnOffParam(sItems(1), Utility.ReadMsg(sItems(2)), DirectCast(CurrCompoParam, ComboBoxParam), DDFComboValuelList)
Return True
Else
NewCompoParam = New TextBoxOnOffParam(sItems(1), Utility.ReadMsg(sItems(2)), Nothing, Nothing)
Return True
End If
Exit For
End If
Next
NewCompoParam = New TextBoxOnOffParam(sItems(1), Utility.ReadMsg(sItems(2)), Nothing, Nothing)
Return True
Else
NewCompoParam = New TextBoxOnOffParam(sItems(1), Utility.ReadMsg(sItems(2)), Nothing, Nothing)
Return True
End If
Else
If Not String.IsNullOrEmpty(sErrorList) Then sErrorList &= Environment.NewLine
sErrorList &= String.Format("Error reading {0} param in {1} compo.", sItems(1), m_CompoType.DDFName)
End If
End Select
If Not String.IsNullOrEmpty(sErrorList) Then sErrorList &= Environment.NewLine
If sItems.Count >= 2 Then
sErrorList &= String.Format("Erron in compo {0} param {1}: type {2} do not exist.", m_CompoType.DDFName, sItems(1), sItems(0))
Else
m_SpecialTextBox1Visibility = Visibility.Collapsed
sErrorList &= String.Format("Erron in compo {0}: type {1} do not exist.", m_CompoType.DDFName, sItems(0))
End If
NotifyPropertyChanged("SpecialTextBox1Visibility")
Return True
End If
End Set
End Property
End If
Return False
End Function
Private m_ComboBox3DDFName As String
Public Property ComboBox3DDFName As String
Get
Return m_ComboBox3DDFName
End Get
Set(value As String)
m_ComboBox3DDFName = value
End Set
End Property
Private m_ComboBox3Visibility As Visibility
Public Property ComboBox3Visibility As Visibility
Private m_TemplateVisibility As Visibility
Public Property TemplateVisibility As Visibility
Get
Return m_ComboBox3Visibility
Return m_TemplateVisibility
End Get
Set(value As Visibility)
m_ComboBox3Visibility = value
m_TemplateVisibility = value
End Set
End Property
#End Region
#End Region ' Template ComboBox
#End Region ' ComboBox
#Region "TextBox"
#Region "TextBox1"
Private m_TextBox1Name As String
Public Property TextBox1Name As String
Private m_CompoParamList As New ObservableCollection(Of CompoParam)
Public Property CompoParamList As ObservableCollection(Of CompoParam)
Get
Return m_TextBox1Name
Return m_CompoParamList
End Get
Set(value As String)
m_TextBox1Name = value
Set(value As ObservableCollection(Of CompoParam))
m_CompoParamList = value
End Set
End Property
Private m_TextBox1DDFName As String
Public Property TextBox1DDFName As String
Get
Return m_TextBox1DDFName
End Get
Set(value As String)
m_TextBox1DDFName = value
End Set
End Property
Private m_TextBox1Value As String
Public Property TextBox1Value As String
Get
Return m_TextBox1Value
End Get
Set(value As String)
m_TextBox1Value = value
End Set
End Property
Private m_TextBox1Visibility As Visibility
Public Property TextBox1Visibility As Visibility
Get
Return m_TextBox1Visibility
End Get
Set(value As Visibility)
m_TextBox1Visibility = value
End Set
End Property
#End Region
#Region "TextBox2"
Private m_TextBox2Name As String
Public Property TextBox2Name As String
Get
Return m_TextBox2Name
End Get
Set(value As String)
m_TextBox2Name = value
End Set
End Property
Private m_TextBox2DDFName As String
Public Property TextBox2DDFName As String
Get
Return m_TextBox2DDFName
End Get
Set(value As String)
m_TextBox2DDFName = value
End Set
End Property
Private m_TextBox2Value As String
Public Property TextBox2Value As String
Get
Return m_TextBox2Value
End Get
Set(value As String)
m_TextBox2Value = value
End Set
End Property
Private m_TextBox2Visibility As Visibility
Public Property TextBox2Visibility As Visibility
Get
Return m_TextBox2Visibility
End Get
Set(value As Visibility)
m_TextBox2Visibility = value
End Set
End Property
#End Region
#Region "TextBox3"
Private m_TextBox3Name As String
Public Property TextBox3Name As String
Get
Return m_TextBox3Name
End Get
Set(value As String)
m_TextBox3Name = value
End Set
End Property
Private m_TextBox3DDFName As String
Public Property TextBox3DDFName As String
Get
Return m_TextBox3DDFName
End Get
Set(value As String)
m_TextBox3DDFName = value
End Set
End Property
Private m_TextBox3Value As String
Public Property TextBox3Value As String
Get
Return m_TextBox3Value
End Get
Set(value As String)
m_TextBox3Value = value
End Set
End Property
Private m_TextBox3Visibility As Visibility
Public Property TextBox3Visibility As Visibility
Get
Return m_TextBox3Visibility
End Get
Set(value As Visibility)
m_TextBox3Visibility = value
End Set
End Property
#End Region
#Region "TextBox4"
Private m_TextBox4Name As String
Public Property TextBox4Name As String
Get
Return m_TextBox4Name
End Get
Set(value As String)
m_TextBox4Name = value
End Set
End Property
Private m_TextBox4DDFName As String
Public Property TextBox4DDFName As String
Get
Return m_TextBox4DDFName
End Get
Set(value As String)
m_TextBox4DDFName = value
End Set
End Property
Private m_TextBox4Value As String
Public Property TextBox4Value As String
Get
Return m_TextBox4Value
End Get
Set(value As String)
m_TextBox4Value = value
End Set
End Property
Private m_TextBox4Visibility As Visibility
Public Property TextBox4Visibility As Visibility
Get
Return m_TextBox4Visibility
End Get
Set(value As Visibility)
m_TextBox4Visibility = value
End Set
End Property
#End Region
#Region "TextBox5"
Private m_TextBox5Name As String
Public Property TextBox5Name As String
Get
Return m_TextBox5Name
End Get
Set(value As String)
m_TextBox5Name = value
End Set
End Property
Private m_TextBox5DDFName As String
Public Property TextBox5DDFName As String
Get
Return m_TextBox5DDFName
End Get
Set(value As String)
m_TextBox5DDFName = value
End Set
End Property
Private m_TextBox5Value As String
Public Property TextBox5Value As String
Get
Return m_TextBox5Value
End Get
Set(value As String)
m_TextBox5Value = value
End Set
End Property
Private m_TextBox5Visibility As Visibility
Public Property TextBox5Visibility As Visibility
Get
Return m_TextBox5Visibility
End Get
Set(value As Visibility)
m_TextBox5Visibility = value
End Set
End Property
#End Region
#Region "SpecialTextBox1"
Private m_SpecialTextBox1Name As String
Public Property SpecialTextBox1Name As String
Get
Return m_SpecialTextBox1Name
End Get
Set(value As String)
m_SpecialTextBox1Name = value
End Set
End Property
Private m_SpecialTextBox1DDFName As String
Public Property SpecialTextBox1DDFName As String
Get
Return m_SpecialTextBox1DDFName
End Get
Set(value As String)
m_SpecialTextBox1DDFName = value
End Set
End Property
Private m_SpecialTextBox1Value As String
Public Property SpecialTextBox1Value As String
Get
Return m_SpecialTextBox1Value
End Get
Set(value As String)
m_SpecialTextBox1Value = value
End Set
End Property
Private m_SpecialTextBox1Visibility As Visibility
Public Property SpecialTextBox1Visibility As Visibility
Get
Return m_SpecialTextBox1Visibility
End Get
Set(value As Visibility)
m_SpecialTextBox1Visibility = value
End Set
End Property
#End Region ' SpecialTextBox1
#End Region ' TextBox
#End Region ' Group
' Definizione comando
Private m_CmdApply As ICommand
Private m_CmdDelete As ICommand
Sub New(CompoType As CompoType, MyDoor As Door)
m_CompoType = CompoType
m_rfCurrDoor = MyDoor
End Sub
#Region "COMMANDS"
#Region "ApplyCommand"
@@ -607,7 +250,7 @@ Public Class Compo
''' Execute the Exec. This method is invoked by the ExecCommand.
''' </summary>
Public Sub Apply()
EgtDoorCreatorMap.m_Door.WriteDDF()
'DdfFile.WriteDDF(m_rfCurrDoor, "c:\EgtData\EgtDOORCreator\Temp\CurrDoor.ddf")
End Sub
#End Region ' ApplyCommand
@@ -630,7 +273,7 @@ Public Class Compo
''' Execute the Exec. This method is invoked by the ExecCommand.
''' </summary>
Public Sub Delete()
EgtDoorCreatorMap.m_Door.RemoveCompo(Me)
m_rfCurrDoor.RemoveCompo(Me)
End Sub
#End Region ' DeleteCommand
@@ -644,3 +287,133 @@ Public Class Compo
End Sub
End Class
Public Class CompoParam
Private m_Name As String
Public Property Name As String
Get
Return m_Name
End Get
Set(value As String)
m_Name = value
End Set
End Property
Private m_DDFName As String
Public Property DDFName As String
Get
Return m_DDFName
End Get
Set(value As String)
m_DDFName = value
End Set
End Property
Sub New(sDDFName As String, sName As String)
m_DDFName = sDDFName
m_Name = sName
End Sub
End Class
Public Class TextBoxParam
Inherits CompoParam
Private m_Value As String
Public Property Value As String
Get
Return m_Value
End Get
Set(value As String)
m_Value = value
End Set
End Property
Private m_ComboValuelList As New List(Of String)
Public Property ComboValuelList As List(Of String)
Get
Return m_ComboValuelList
End Get
Set(value As List(Of String))
m_ComboValuelList = value
End Set
End Property
Private m_ComboBox As ComboBoxParam
Private m_Visibility As Visibility
Public Property Visibility As Visibility
Get
Return m_Visibility
End Get
Set(value As Visibility)
m_Visibility = value
End Set
End Property
Sub New(sDDFName As String, sName As String, ComboBox As ComboBoxParam, ComboValuelList As List(Of String))
MyBase.New(sDDFName, sName)
m_ComboBox = ComboBox
m_ComboValuelList = ComboValuelList
End Sub
End Class
Public Class ComboBoxParam
Inherits CompoParam
Private m_ItemList As New List(Of String)
Public Property ItemList As List(Of String)
Get
Return m_ItemList
End Get
Set(value As List(Of String))
m_ItemList = value
End Set
End Property
Private m_ItemListDDF As New List(Of String)
Public Property ItemListDDF As List(Of String)
Get
Return m_ItemListDDF
End Get
Set(value As List(Of String))
m_ItemListDDF = value
End Set
End Property
Private m_SelItem As String
Public Property SelItem As String
Get
Return m_SelItem
End Get
Set(value As String)
m_SelItem = value
End Set
End Property
Sub New(sDDFName As String, sName As String, ItemList As List(Of String), ItemListDDF As List(Of String))
MyBase.New(sDDFName, sName)
m_ItemList = ItemList
m_ItemListDDF = ItemListDDF
End Sub
End Class
Public Class TextBoxOnOffParam
Inherits TextBoxParam
Private m_IsActive As Boolean
Public Property IsActive As Boolean
Get
Return m_IsActive
End Get
Set(value As Boolean)
m_IsActive = value
End Set
End Property
Sub New(sDDFName As String, sName As String, ComboBox As ComboBoxParam, ComboValuelList As List(Of String))
MyBase.New(sDDFName, sName, ComboBox, ComboValuelList)
End Sub
End Class
+242 -136
View File
@@ -17,17 +17,18 @@ Public Class Door
End Get
End Property
Private m_Height As String
Private m_Height As String = String.Empty
Public Property Height As String
Get
Return m_Height
End Get
Set(value As String)
m_Height = value
NotifyPropertyChanged("Height")
End Set
End Property
Private m_Width As String
Private m_Width As String = String.Empty
Public Property Width As String
Get
Return m_Width
@@ -37,7 +38,7 @@ Public Class Door
End Set
End Property
Private m_Thickness As String
Private m_Thickness As String = String.Empty
Public Property Thickness As String
Get
Return m_Thickness
@@ -47,7 +48,7 @@ Public Class Door
End Set
End Property
Private m_Swing As String
Private m_Swing As String = Nothing
Public Property Swing As String
Get
Return m_Swing
@@ -61,14 +62,14 @@ Public Class Door
#Region "TypeEdge"
Private m_EdgeTypeList As List(Of String) = New List(Of String)({"SQ", "B", "1B", "2B", "3B", "4B", "CV"})
Private m_EdgeTypeList As List(Of String) = New List(Of String)({"SQ", "BU", "BD", "1B", "2B", "3B", "4B", "CV"})
Public ReadOnly Property EdgeTypeList As List(Of String)
Get
Return m_EdgeTypeList
End Get
End Property
Private m_LockEdgeType As String
Private m_LockEdgeType As String = Nothing
Public Property LockEdgeType As String
Get
Return m_LockEdgeType
@@ -78,7 +79,7 @@ Public Class Door
End Set
End Property
Private m_HingeEdgeType As String
Private m_HingeEdgeType As String = Nothing
Public Property HingeEdgeType As String
Get
Return m_HingeEdgeType
@@ -88,7 +89,7 @@ Public Class Door
End Set
End Property
Private m_TopType As String
Private m_TopType As String = Nothing
Public Property TopType As String
Get
Return m_TopType
@@ -98,7 +99,7 @@ Public Class Door
End Set
End Property
Private m_BottomType As String
Private m_BottomType As String = Nothing
Public Property BottomType As String
Get
Return m_BottomType
@@ -156,7 +157,7 @@ Public Class Door
#Region "OverMaterial"
Private m_LockEdgeOverMaterial As String
Private m_LockEdgeOverMaterial As String = String.Empty
Public Property LockEdgeOverMaterial As String
Get
Return m_LockEdgeOverMaterial
@@ -166,7 +167,7 @@ Public Class Door
End Set
End Property
Private m_HingeEdgeOverMaterial As String
Private m_HingeEdgeOverMaterial As String = String.Empty
Public Property HingeEdgeOverMaterial As String
Get
Return m_HingeEdgeOverMaterial
@@ -176,7 +177,7 @@ Public Class Door
End Set
End Property
Private m_TopOverMaterial As String
Private m_TopOverMaterial As String = String.Empty
Public Property TopOverMaterial As String
Get
Return m_TopOverMaterial
@@ -186,7 +187,7 @@ Public Class Door
End Set
End Property
Private m_BottomOverMaterial As String
Private m_BottomOverMaterial As String = String.Empty
Public Property BottomOverMaterial As String
Get
Return m_BottomOverMaterial
@@ -200,12 +201,9 @@ Public Class Door
#End Region ' General
Private m_CompoList As ObservableCollection(Of Compo)
Private m_CompoList As New ObservableCollection(Of Compo)
Public Property CompoList As ObservableCollection(Of Compo)
Get
If IsNothing(m_CompoList) Then
m_CompoList = New ObservableCollection(Of Compo)
End If
Return m_CompoList
End Get
Set(value As ObservableCollection(Of Compo))
@@ -214,146 +212,254 @@ Public Class Door
End Property
'Gestione ComboBox e TextBox di ogni compo della pulsantiera letta da Compo.ini
Friend Sub AddNewCompo(IniCompoName As String)
Friend Function AddNewCompo(CurrCompoType As CompoType) As Integer
' creo la stringa che contiene la lista degli errori
Dim ErrorList As String = String.Empty
' creo il nuovo compo
Dim NewCompo As New Compo
' lo modifico in base al tipo passatomi
CompoGetPrivateProfileNameGroup(IniCompoName, ConstCompo.K_NAME, NewCompo.NameDDF, NewCompo.Name)
Dim NewCompo As New Compo(CurrCompoType, Me)
' Leggo il file ini del componente per vedere se c'è il template
If EgtUILib.GetPrivateProfileInt(S_TEMPLATE, K_ISACTIVE, 1, CurrCompoType.Path) <> 0 Then
' leggo nomi
Dim Name As String = String.Empty
Dim DDFName As String = String.Empty
IniFile.GetPrivateProfileCompoName(S_TEMPLATE, K_NAME, DDFName, Name, CurrCompoType.Path & "\" & CONFIGINI_FILE_NAME)
Dim TemplateList As New List(Of String)
IniFile.OpenDirectory(CurrCompoType.Path, TemplateList)
' aggiungo il template come parametro
NewCompo.TemplateDDFName = DDFName
NewCompo.TemplateName = Name
NewCompo.TemplateItemList = TemplateList
If NewCompo.TemplateItemList.Count > 0 Then
NewCompo.TemplateSelItem = NewCompo.TemplateItemList(0)
End If
If CompoGetPrivateProfileComboBox(IniCompoName, ConstCompo.K_COMBOBOX & 1, NewCompo.ComboBox1DDFName, NewCompo.ComboBox1Name) Then
NewCompo.ComboBox1Index = 1
Else
Return
' altrimenti leggo il nome del compo da analizzare
EgtUILib.GetPrivateProfileString(S_TEMPLATE, K_COMPO, "", NewCompo.TemplateSelItem, CurrCompoType.Path & "\" & CONFIGINI_FILE_NAME)
End If
Select Case CompoGetPrivateProfileComboBoxList(IniCompoName, ConstCompo.K_COMBOBOX & 1 & ConstCompo.K_LIST, NewCompo.ComboBox1List, NewCompo.ComboBox1ListDDF)
Case ComboListResult.NOTFOUND
NewCompo.ComboBox1Visibility = Visibility.Collapsed
Case ComboListResult.FOUND
NewCompo.ComboBox1Visibility = Visibility.Visible
Case ComboListResult.MISTAKE
Return
End Select
If CompoGetPrivateProfileComboBox(IniCompoName, ConstCompo.K_COMBOBOX & 2, NewCompo.ComboBox2DDFName, NewCompo.ComboBox2Name) Then
NewCompo.ComboBox2Index = 2
Else
NewCompo.ComboBox2Visibility = Visibility.Collapsed
'' creo path completa e controllo l'estensione del file
'Dim TemplateFilePath As String = CurrCompoType.Path & "\" & NewCompo.TemplateSelItem
'If Not Path.HasExtension(TemplateFilePath) Then
' TemplateFilePath &= ".lua"
'End If
'' carico il contenuto del file
'Dim TemplateFileContent() As String = File.ReadAllLines(TemplateFilePath)
'For LineIndex = 0 To TemplateFileContent.Count - 1
' Dim TemplateFileLine As String = TemplateFileContent(LineIndex)
' If RegexFunction.IsGraphicParametersTitle(TemplateFileLine) Then
' Dim ParamIndex As Integer = 1
' Dim NewCompoParam As CompoParam = Nothing
' While ReadParam(TemplateFileContent(LineIndex + ParamIndex), ParamIndex, NewCompoParam, NewCompo, ErrorList)
' If Not IsNothing(NewCompoParam) Then
' NewCompo.CompoParamList.Add(NewCompoParam)
' End If
' ParamIndex += 1
' End While
' Exit For
' End If
'Next
If Not IsNothing(NewCompo) Then
m_CompoList.Add(NewCompo)
End If
' creo il nuovo compo
'Dim NewCompo As New Compo(Me)
'' lo modifico in base al tipo passatomi
'CompoGetPrivateProfileNameGroup(IniCompoName, ConstCompo.K_NAME, NewCompo.NameDDF, NewCompo.Name)
Select Case CompoGetPrivateProfileComboBoxList(IniCompoName, ConstCompo.K_COMBOBOX & 2 & ConstCompo.K_LIST, NewCompo.ComboBox2List, NewCompo.ComboBox2ListDDF)
Case ComboListResult.NOTFOUND
NewCompo.ComboBox2Visibility = Visibility.Collapsed
Case ComboListResult.FOUND
NewCompo.ComboBox2Visibility = Visibility.Visible
Case ComboListResult.MISTAKE
Return
End Select
'If Not CompoGetPrivateProfileComboBox(IniCompoName, ConstCompo.K_COMBOBOX & 1, NewCompo.ComboBox1DDFName, NewCompo.ComboBox1Name) Then
' NewCompo.ComboBox2Visibility = Visibility.Collapsed
'End If
If CompoGetPrivateProfileComboBox(IniCompoName, ConstCompo.K_COMBOBOX & 3, NewCompo.ComboBox3DDFName, NewCompo.ComboBox3Name) Then
NewCompo.ComboBox3Index = 3
Else
NewCompo.ComboBox3Visibility = Visibility.Collapsed
End If
'Select Case CompoGetPrivateProfileComboBoxList(IniCompoName, ConstCompo.K_COMBOBOX & 1 & ConstCompo.K_LIST, NewCompo.ComboBox1List, NewCompo.ComboBox1ListDDF)
' Case ComboListResult.NOTFOUND
' NewCompo.ComboBox1Visibility = Visibility.Collapsed
' Case ComboListResult.FOUND
' NewCompo.ComboBox1Visibility = Visibility.Visible
' Case ComboListResult.MISTAKE
' Return -1
'End Select
Select Case CompoGetPrivateProfileComboBoxList(IniCompoName, ConstCompo.K_COMBOBOX & 3 & ConstCompo.K_LIST, NewCompo.ComboBox3List, NewCompo.ComboBox3ListDDF)
Case ComboListResult.NOTFOUND
NewCompo.ComboBox3Visibility = Visibility.Collapsed
Case ComboListResult.FOUND
NewCompo.ComboBox3Visibility = Visibility.Visible
Case ComboListResult.MISTAKE
Return
End Select
'If Not CompoGetPrivateProfileComboBox(IniCompoName, ConstCompo.K_COMBOBOX & 2, NewCompo.ComboBox2DDFName, NewCompo.ComboBox2Name) Then
' NewCompo.ComboBox2Visibility = Visibility.Collapsed
'End If
' TextBox
If Not CompoGetPrivateProfileTextBox(IniCompoName, ConstCompo.K_TEXTBOX & 1, NewCompo.TextBox1DDFName, NewCompo.TextBox1Name) Then
NewCompo.TextBox1Visibility = Visibility.Collapsed
End If
'Select Case CompoGetPrivateProfileComboBoxList(IniCompoName, ConstCompo.K_COMBOBOX & 2 & ConstCompo.K_LIST, NewCompo.ComboBox2List, NewCompo.ComboBox2ListDDF)
' Case ComboListResult.NOTFOUND
' NewCompo.ComboBox2Visibility = Visibility.Collapsed
' Case ComboListResult.FOUND
' NewCompo.ComboBox2Visibility = Visibility.Visible
' Case ComboListResult.MISTAKE
' Return -1
'End Select
If Not CompoGetPrivateProfileTextBox(IniCompoName, ConstCompo.K_TEXTBOX & 2, NewCompo.TextBox2DDFName, NewCompo.TextBox2Name) Then
NewCompo.TextBox2Visibility = Visibility.Collapsed
End If
'If Not CompoGetPrivateProfileComboBox(IniCompoName, ConstCompo.K_COMBOBOX & 3, NewCompo.ComboBox3DDFName, NewCompo.ComboBox3Name) Then
' NewCompo.ComboBox3Visibility = Visibility.Collapsed
'End If
If Not CompoGetPrivateProfileTextBox(IniCompoName, ConstCompo.K_TEXTBOX & 3, NewCompo.TextBox3DDFName, NewCompo.TextBox3Name) Then
NewCompo.TextBox3Visibility = Visibility.Collapsed
End If
'Select Case CompoGetPrivateProfileComboBoxList(IniCompoName, ConstCompo.K_COMBOBOX & 3 & ConstCompo.K_LIST, NewCompo.ComboBox3List, NewCompo.ComboBox3ListDDF)
' Case ComboListResult.NOTFOUND
' NewCompo.ComboBox3Visibility = Visibility.Collapsed
' Case ComboListResult.FOUND
' NewCompo.ComboBox3Visibility = Visibility.Visible
' Case ComboListResult.MISTAKE
' Return -1
'End Select
If Not CompoGetPrivateProfileTextBox(IniCompoName, ConstCompo.K_TEXTBOX & 4, NewCompo.TextBox4DDFName, NewCompo.TextBox4Name) Then
NewCompo.TextBox4Visibility = Visibility.Collapsed
End If
'' TextBox
'If Not CompoGetPrivateProfileTextBox(IniCompoName, ConstCompo.K_TEXTBOX & 1, NewCompo.TextBox1DDFName, NewCompo.TextBox1Name) Then
' NewCompo.TextBox1Visibility = Visibility.Collapsed
'End If
If Not CompoGetPrivateProfileTextBox(IniCompoName, ConstCompo.K_TEXTBOX & 5, NewCompo.TextBox5DDFName, NewCompo.TextBox5Name) Then
NewCompo.TextBox5Visibility = Visibility.Collapsed
End If
'If Not CompoGetPrivateProfileTextBox(IniCompoName, ConstCompo.K_TEXTBOX & 2, NewCompo.TextBox2DDFName, NewCompo.TextBox2Name) Then
' NewCompo.TextBox2Visibility = Visibility.Collapsed
'End If
'gestione SpeciaTextBox
Dim nComboIndex As Integer = 0
Dim SpecialList As New List(Of String)
If CompoGetPrivateProfileSpecialTextBox(IniCompoName, ConstCompo.K_SPECIALTEXTBOX & 1, NewCompo.SpecialTextBox1DDFName, NewCompo.SpecialTextBox1Name, nComboIndex, SpecialList) Then
Select Case nComboIndex
Case 1
NewCompo.ComboBox1SpecialList = SpecialList
Case 2
NewCompo.ComboBox2SpecialList = SpecialList
Case 3
NewCompo.ComboBox3SpecialList = SpecialList
'If Not CompoGetPrivateProfileTextBox(IniCompoName, ConstCompo.K_TEXTBOX & 3, NewCompo.TextBox3DDFName, NewCompo.TextBox3Name) Then
' NewCompo.TextBox3Visibility = Visibility.Collapsed
'End If
'If Not CompoGetPrivateProfileTextBox(IniCompoName, ConstCompo.K_TEXTBOX & 4, NewCompo.TextBox4DDFName, NewCompo.TextBox4Name) Then
' NewCompo.TextBox4Visibility = Visibility.Collapsed
'End If
'If Not CompoGetPrivateProfileTextBox(IniCompoName, ConstCompo.K_TEXTBOX & 5, NewCompo.TextBox5DDFName, NewCompo.TextBox5Name) Then
' NewCompo.TextBox5Visibility = Visibility.Collapsed
'End If
'' gestione SpecialTextBox
'Dim nComboIndex As Integer = 0
'Dim SpecialList As New List(Of String)
'If CompoGetPrivateProfileSpecialTextBox(IniCompoName, ConstCompo.K_SPECIALTEXTBOX & 1, NewCompo.SpecialTextBox1DDFName, NewCompo.SpecialTextBox1Name, nComboIndex, SpecialList) Then
' Select Case nComboIndex
' Case 1
' NewCompo.ComboBox1SpecialList = SpecialList
' Case 2
' NewCompo.ComboBox2SpecialList = SpecialList
' Case 3
' NewCompo.ComboBox3SpecialList = SpecialList
' End Select
'End If
'' nascondo la SpecialTextBox
'NewCompo.SpecialTextBox1Visibility = Visibility.Collapsed
'Dim bFound As Boolean = False
'For CompoIndex = 0 To m_CompoList.Count - 1
' If m_CompoList(CompoIndex).NameDDF = NewCompo.NameDDF Then
' bFound = True
' ElseIf bFound Then
' CompoList.Insert(CompoIndex, NewCompo)
' Return CompoIndex
' End If
'Next
'CompoList.Add(NewCompo)
'Return CompoList.Count - 1
End Function
Private Function ReadParam(sLine As String, nParamIndex As Integer, ByRef NewCompoParam As CompoParam, Compo As Compo, sErrorList As String) As Boolean
Dim ReadLine As String = ParamLine(sLine, "Param" & nParamIndex)
If Not String.IsNullOrWhiteSpace(ReadLine) Then
Dim sItems() As String = ReadLine.Split(";"c)
If sItems.Count > 0 Then
Select Case sItems(0)
Case "ComboBox"
If sItems.Count >= 4 Then
Dim sComboItemList() As String = sItems(3).Split(","c)
Dim ComboItemList As New List(Of String)
Dim DDFComboItemList As New List(Of String)
For ItemIndex = 0 To sComboItemList.Count - 1
Dim ComboItem() As String = sComboItemList(ItemIndex).Split("/"c)
DDFComboItemList.Add(ComboItem(0))
ComboItemList.Add(Utility.ReadMsg(ComboItem(1)))
Next
NewCompoParam = New ComboBoxParam(sItems(1), Utility.ReadMsg(sItems(2)), ComboItemList, DDFComboItemList)
Return True
Else
sErrorList &= String.Format("Error reading {0} param in {1} compo.", sItems(1), Compo.CompoType.DDFName)
End If
Case "TextBox"
If sItems.Count >= 3 Then
If sItems.Count > 3 Then
Dim DDFComboValuelList As New List(Of String)
Dim sComboItemList() As String = sItems(4).Split(","c)
For ItemIndex = 0 To sComboItemList.Count - 1
DDFComboValuelList.Add(sComboItemList(ItemIndex))
Next
For ParamIndex = 0 To Compo.CompoParamList.Count - 1
Dim CurrCompoParam As CompoParam = Compo.CompoParamList(ParamIndex)
If CurrCompoParam.DDFName = sItems(3) Then
If TypeOf CurrCompoParam Is ComboBoxParam Then
NewCompoParam = New TextBoxParam(sItems(1), Utility.ReadMsg(sItems(2)), DirectCast(CurrCompoParam, ComboBoxParam), DDFComboValuelList)
Return True
Else
NewCompoParam = New TextBoxParam(sItems(1), Utility.ReadMsg(sItems(2)), Nothing, Nothing)
Return True
End If
Exit For
End If
Next
NewCompoParam = New TextBoxParam(sItems(1), Utility.ReadMsg(sItems(2)), Nothing, Nothing)
Return True
Else
NewCompoParam = New TextBoxParam(sItems(1), Utility.ReadMsg(sItems(2)), Nothing, Nothing)
Return True
End If
Else
If Not String.IsNullOrEmpty(sErrorList) Then sErrorList &= Environment.NewLine
sErrorList &= String.Format("Error reading {0} param in {1} compo.", sItems(1), Compo.CompoType.DDFName)
End If
Case "TextBoxOnOff"
If sItems.Count >= 3 Then
If sItems.Count > 3 Then
Dim DDFComboValuelList As New List(Of String)
Dim sComboItemList() As String = sItems(4).Split(","c)
For ItemIndex = 0 To sComboItemList.Count - 1
DDFComboValuelList.Add(sComboItemList(ItemIndex))
Next
For ParamIndex = 0 To Compo.CompoParamList.Count - 1
Dim CurrCompoParam As CompoParam = Compo.CompoParamList(ParamIndex)
If CurrCompoParam.DDFName = sItems(3) Then
If TypeOf CurrCompoParam Is ComboBoxParam Then
NewCompoParam = New TextBoxOnOffParam(sItems(1), Utility.ReadMsg(sItems(2)), DirectCast(CurrCompoParam, ComboBoxParam), DDFComboValuelList)
Return True
Else
NewCompoParam = New TextBoxOnOffParam(sItems(1), Utility.ReadMsg(sItems(2)), Nothing, Nothing)
Return True
End If
Exit For
End If
Next
NewCompoParam = New TextBoxOnOffParam(sItems(1), Utility.ReadMsg(sItems(2)), Nothing, Nothing)
Return True
Else
NewCompoParam = New TextBoxOnOffParam(sItems(1), Utility.ReadMsg(sItems(2)), Nothing, Nothing)
Return True
End If
Else
If Not String.IsNullOrEmpty(sErrorList) Then sErrorList &= Environment.NewLine
sErrorList &= String.Format("Error reading {0} param in {1} compo.", sItems(1), Compo.CompoType.DDFName)
End If
End Select
If Not String.IsNullOrEmpty(sErrorList) Then sErrorList &= Environment.NewLine
If sItems.Count >= 2 Then
sErrorList &= String.Format("Erron in compo {0} param {1}: type {2} do not exist.", Compo.CompoType.DDFName, sItems(1), sItems(0))
Else
sErrorList &= String.Format("Erron in compo {0}: type {1} do not exist.", Compo.CompoType.DDFName, sItems(0))
End If
Return True
End If
' nascondo la SpecialTextBox
NewCompo.SpecialTextBox1Visibility = Visibility.Collapsed
' aggiungo il nuovo compo alla lista
CompoList.Add(NewCompo)
End Sub
End If
Return False
End Function
Friend Sub RemoveCompo(CompoToRemove As Compo)
CompoList.Remove(CompoToRemove)
End Sub
Friend Sub WriteDDF()
'genero le stringhe che dovranno essere scritte nel DDF
Dim m_GeneralListDDF As New List(Of String)
Dim m_CompoListDDF As New List(Of List(Of String))
'Genero una lista di stringhe senza spaziature
Dim dVal As Double = 0
m_GeneralListDDF.Add(ConstCompo.K_SIZE & ":")
StringToDouble(Width, dVal)
m_GeneralListDDF.Add(ConstCompo.K_SPACE3 & ConstCompo.K_WIDTH & ": " & DoubleToString(dVal, 3))
StringToDouble(Height, dVal)
m_GeneralListDDF.Add(ConstCompo.K_SPACE3 & ConstCompo.K_HEIGHT & ": " & DoubleToString(dVal, 3))
StringToDouble(Thickness, dVal)
m_GeneralListDDF.Add(ConstCompo.K_SPACE3 & ConstCompo.K_THICKNESS & ": " & DoubleToString(dVal, 3))
' aggiungo una riga vuota per separare la lista successiva
m_GeneralListDDF.Add("")
m_GeneralListDDF.Add("" & ConstCompo.K_SWING & ": " & Swing)
' aggiungo una riga vuota per separare la lista successiva
m_GeneralListDDF.Add("")
m_GeneralListDDF.Add("" & ConstCompo.K_PROFILES & ":")
m_GeneralListDDF.Add(ConstCompo.K_SPACE3 & ConstCompo.K_LOCKEDGE & ": " & LockEdgeType)
m_GeneralListDDF.Add(ConstCompo.K_SPACE5 & ConstCompo.K_MACHINING & ": " & ConvertBooleanToOnOff(LockEdgeMachining))
StringToDouble(LockEdgeOverMaterial, dVal)
m_GeneralListDDF.Add(ConstCompo.K_SPACE5 & ConstCompo.K_OVERMATERAL & ": " & DoubleToString(dVal, 3))
m_GeneralListDDF.Add(ConstCompo.K_SPACE3 & ConstCompo.K_HINGEEDGE & ": " & HingeEdgeType)
m_GeneralListDDF.Add(ConstCompo.K_SPACE5 & ConstCompo.K_MACHINING & ": " & ConvertBooleanToOnOff(HingeEdgeMachining))
StringToDouble(HingeEdgeOverMaterial, dVal)
m_GeneralListDDF.Add(ConstCompo.K_SPACE5 & ConstCompo.K_OVERMATERAL & ": " & DoubleToString(dVal, 3))
m_GeneralListDDF.Add(ConstCompo.K_SPACE3 & ConstCompo.K_TOP & ": " & TopType)
m_GeneralListDDF.Add(ConstCompo.K_SPACE5 & ConstCompo.K_MACHINING & ": " & ConvertBooleanToOnOff(TopMachining))
StringToDouble(TopOverMaterial, dVal)
m_GeneralListDDF.Add(ConstCompo.K_SPACE5 & ConstCompo.K_OVERMATERAL & ": " & DoubleToString(dVal, 3))
m_GeneralListDDF.Add(ConstCompo.K_SPACE3 & ConstCompo.K_BOTTOM & ": " & BottomType)
m_GeneralListDDF.Add(ConstCompo.K_SPACE5 & ConstCompo.K_MACHINING & ": " & ConvertBooleanToOnOff(BottomMachining))
StringToDouble(BottomOverMaterial, dVal)
m_GeneralListDDF.Add(ConstCompo.K_SPACE5 & ConstCompo.K_OVERMATERAL & ": " & DoubleToString(dVal, 3))
' aggiungo una riga vuota per separare la lista successiva
m_GeneralListDDF.Add("")
'per ogni compo della compolist devo stampare a video
For Each Item As Compo In CompoList
m_GeneralListDDF.AddRange(GenerateCompolistDDF(Item))
Next
File.WriteAllLines("c:\EgtData\EgtDOORCreator\MyProjects\Prova1.ddf", m_GeneralListDDF, Text.Encoding.UTF8)
End Sub
Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged
Public Sub NotifyPropertyChanged(propName As String)
+81 -75
View File
@@ -1,6 +1,12 @@
<UserControl x:Class="DoorParametersView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:EgtDOORCreator">
<UserControl.Resources>
<local:SplitConverter x:Key="SplitConverter"/>
<local:DoorVisibilityConverter x:Key="DoorVisibilityConverter"/>
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
@@ -8,7 +14,7 @@
<RowDefinition Height="5*"/>
</Grid.RowDefinitions>
<Grid>
<Grid Visibility="{Binding CurrProject.DoorList, Converter={StaticResource DoorVisibilityConverter}}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
@@ -25,132 +31,132 @@
</Grid.RowDefinitions>
<!--General-->
<TextBlock Text="{Binding WidthMsg}"/>
<TextBlock Text="{Binding WidthMsg}" />
<TextBox Grid.Column="1"
Text="{Binding Door.Width, UpdateSourceTrigger=PropertyChanged}"/>
Text="{Binding CurrDoor.Width, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
<TextBlock Grid.Row="1" Text="{Binding HeightMsg}"/>
<TextBlock Grid.Row="1" Text="{Binding HeightMsg}" />
<TextBox Grid.Column="1" Grid.Row="1"
Text="{Binding Door.Height, UpdateSourceTrigger=PropertyChanged}" />
Text="{Binding CurrDoor.Height, UpdateSourceTrigger=PropertyChanged}" />
<TextBlock Grid.Row="2" Text="{Binding ThicknessMsg}"/>
<TextBox Grid.Column="1" Grid.Row="2"
Text="{Binding Door.Thickness, UpdateSourceTrigger=PropertyChanged}"/>
Text="{Binding CurrDoor.Thickness, UpdateSourceTrigger=PropertyChanged}"/>
<TextBlock Grid.Row="3" Text="{Binding SwingMsg}"/>
<ComboBox Grid.Column="1" Grid.Row="3"
ItemsSource="{Binding Door.SwingTypeList}"
SelectedItem="{Binding Door.Swing}"/>
ItemsSource="{Binding CurrDoor.SwingTypeList}"
SelectedItem="{Binding CurrDoor.Swing}"/>
<!-- Profiles-->
<TextBlock Grid.Column="2" Text="{Binding LockedgeMsg}"/>
<ComboBox Grid.Column="3" ItemsSource="{Binding Door.EdgeTypeList}"
SelectedItem="{Binding Door.LockEdgeType}"/>
<ComboBox Grid.Column="3" ItemsSource="{Binding CurrDoor.EdgeTypeList}"
SelectedItem="{Binding CurrDoor.LockEdgeType}"/>
<TextBlock Grid.Column="2" Grid.Row="1"
Text="{Binding HingeedgeMsg}"/>
<ComboBox Grid.Column="3" Grid.Row="1"
ItemsSource="{Binding Door.EdgeTypeList}"
SelectedItem="{Binding Door.HingeEdgeType}"/>
ItemsSource="{Binding CurrDoor.EdgeTypeList}"
SelectedItem="{Binding CurrDoor.HingeEdgeType}"/>
<TextBlock Grid.Column="2" Grid.Row="2"
Text="{Binding TopMsg}"/>
<ComboBox Grid.Column="3" Grid.Row="2"
ItemsSource="{Binding Door.EdgeTypeList}"
SelectedItem="{Binding Door.TopType}"/>
ItemsSource="{Binding CurrDoor.EdgeTypeList}"
SelectedItem="{Binding CurrDoor.TopType}"/>
<TextBlock Grid.Row="3" Grid.Column="2"
Text="{Binding BottomMsg}"/>
<ComboBox Grid.Column="3" Grid.Row="3"
ItemsSource="{Binding Door.EdgeTypeList}"
SelectedItem="{Binding Door.BottomType}"/>
ItemsSource="{Binding CurrDoor.EdgeTypeList}"
SelectedItem="{Binding CurrDoor.BottomType}"/>
<!--Machining-->
<CheckBox Grid.Column="4"
IsChecked="{Binding Door.LockEdgeMachining}"
IsChecked="{Binding CurrDoor.LockEdgeMachining}"
/>
<CheckBox Grid.Column="4" Grid.Row="1"
IsChecked="{Binding Door.HingeEdgeMachining}"
IsChecked="{Binding CurrDoor.HingeEdgeMachining}"
/>
<CheckBox Grid.Column="4" Grid.Row="2"
IsChecked="{Binding Door.TopMachining}"
IsChecked="{Binding CurrDoor.TopMachining}"
/>
<CheckBox Grid.Column="4" Grid.Row="3"
IsChecked="{Binding Door.BottomMachining}"
IsChecked="{Binding CurrDoor.BottomMachining}"
/>
<TextBox Grid.Column="5" Grid.Row="0"
Text="{Binding Door.LockEdgeOverMaterial, UpdateSourceTrigger=PropertyChanged}"/>
Text="{Binding CurrDoor.LockEdgeOverMaterial, UpdateSourceTrigger=PropertyChanged}"/>
<TextBox Grid.Column="5" Grid.Row="1"
Text="{Binding Door.HingeEdgeOverMaterial, UpdateSourceTrigger=PropertyChanged}"/>
Text="{Binding CurrDoor.HingeEdgeOverMaterial, UpdateSourceTrigger=PropertyChanged}"/>
<TextBox Grid.Column="5" Grid.Row="2"
Text="{Binding Door.TopOverMaterial, UpdateSourceTrigger=PropertyChanged}"/>
Text="{Binding CurrDoor.TopOverMaterial, UpdateSourceTrigger=PropertyChanged}"/>
<TextBox Grid.Column="5" Grid.Row="3"
Text="{Binding Door.BottomOverMaterial, UpdateSourceTrigger=PropertyChanged}"/>
Text="{Binding CurrDoor.BottomOverMaterial, UpdateSourceTrigger=PropertyChanged}"/>
</Grid>
<ItemsControl Grid.Row="1" ItemsSource="{Binding Door.CompoList}" >
<ItemsControl Name="DoorParamsItemsControl" Grid.Row="1" ItemsSource="{Binding CurrDoor.CompoList}" Style="{StaticResource DoorParamsItemsControlStyle}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<GroupBox Header="{Binding Name}">
<GroupBox Header="{Binding CompoType.Name}" Width="{Binding ActualWidth,ElementName=DoorParamsItemsControl,Converter={StaticResource SplitConverter},ConverterParameter=2}">
<StackPanel>
<UniformGrid Columns="2" Visibility="{Binding ComboBox1Visibility}">
<TextBlock Text="{Binding ComboBox1Name}" />
<ComboBox ItemsSource="{Binding ComboBox1List}"
SelectedItem="{Binding ComboBox1SelItem}"/>
</UniformGrid>
<UniformGrid Columns="2" Visibility="{Binding ComboBox2Visibility}">
<TextBlock Text="{Binding ComboBox2Name}" />
<ComboBox ItemsSource="{Binding ComboBox2List}"
SelectedItem="{Binding ComboBox2SelItem}"/>
</UniformGrid>
<UniformGrid Columns="2" Visibility="{Binding ComboBox3Visibility}">
<TextBlock Text="{Binding ComboBox3Name}" />
<ComboBox ItemsSource="{Binding ComboBox3List}"
SelectedItem="{Binding ComboBox3SelItem}"/>
</UniformGrid>
<UniformGrid Columns="2" Visibility="{Binding TextBox1Visibility}">
<TextBlock Text="{Binding TextBox1Name}" />
<TextBox Text="{Binding TextBox1Value}" />
</UniformGrid>
<UniformGrid Columns="2" Visibility="{Binding TextBox2Visibility}">
<TextBlock Text="{Binding TextBox2Name}" />
<TextBox Text="{Binding TextBox2Value}" />
</UniformGrid>
<UniformGrid Columns="2" Visibility="{Binding TextBox3Visibility}">
<TextBlock Text="{Binding TextBox3Name}" />
<TextBox Text="{Binding TextBox3Value}" />
</UniformGrid>
<UniformGrid Columns="2" Visibility="{Binding TextBox4Visibility}">
<TextBlock Text="{Binding TextBox4Name}" />
<TextBox Text="{Binding TextBox4Value}" />
</UniformGrid>
<UniformGrid Columns="2" Visibility="{Binding TextBox5Visibility}">
<TextBlock Text="{Binding TextBox5Name}" />
<TextBox Text="{Binding TextBox5Value}" />
</UniformGrid>
<!--SpecialTextBox1 DataContextChanged=""-->
<UniformGrid Columns="2" Visibility="{Binding SpecialTextBox1Visibility}">
<TextBlock Text="{Binding SpecialTextBox1Name}" />
<TextBox Text="{Binding SpecialTextBox1Value}" />
<UniformGrid Columns="2" Visibility="{Binding TemplateVisibility}">
<TextBlock Text="{Binding TemplateName}" />
<ComboBox ItemsSource="{Binding TemplateItemList}"
SelectedItem="{Binding TemplateSelItem}"/>
</UniformGrid>
<ItemsControl ItemsSource="{Binding CompoParamList}">
<ItemsControl.Resources>
<DataTemplate DataType="{x:Type local:ComboBoxParam}">
<UniformGrid Columns="2">
<TextBlock Text="{Binding Name}" />
<ComboBox ItemsSource="{Binding ItemList}"
SelectedItem="{Binding SelItem}"/>
</UniformGrid>
</DataTemplate>
<DataTemplate DataType="{x:Type local:TextBoxParam}">
<UniformGrid Columns="2">
<TextBlock Text="{Binding Name}" />
<TextBox Text="{Binding Value}" />
</UniformGrid>
</DataTemplate>
<DataTemplate DataType="{x:Type local:TextBoxOnOffParam}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<CheckBox Name="ChBx" IsChecked="{Binding IsActive}"/>
<TextBlock Text="{Binding Name}" Grid.Column="1"
Margin="5,0,0,0"/>
</Grid>
<TextBox Text="{Binding Value}" Grid.Column="2"
IsEnabled="{Binding IsChecked, ElementName=ChBx}"/>
</Grid>
</DataTemplate>
</ItemsControl.Resources>
</ItemsControl>
<UniformGrid Columns="2">
<Button Content="{Binding DataContext.ApplyBtnMsg, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"
Command="{Binding ApplyCommand}"/>
Command="{Binding ApplyCommand}"/>
<Button Content="{Binding DataContext.DeleteBtnMsg, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"
Command="{Binding DeleteCommand}"/>
Command="{Binding DeleteCommand}"/>
</UniformGrid>
</StackPanel>
</StackPanel>
</GroupBox>
</DataTemplate>
</ItemsControl.ItemTemplate>
<!--<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>-->
</ItemsControl>
</Grid>
+47 -16
View File
@@ -1,61 +1,82 @@
Imports System.ComponentModel
Imports System.Collections.ObjectModel
Imports EgtUILib
'Imports System.Text.RegularExpressions
Public Class DoorParametersViewModel
Implements INotifyPropertyChanged
Private m_Door As Door
Public Property Door As Door
Private m_rfMainWindowViewModel As MainWindowViewModel
Private m_CurrDoor As Door
Public Property CurrDoor As Door
Get
Return m_Door
Return m_CurrDoor
End Get
Set(value As Door)
m_Door = value
m_CurrDoor = value
NotifyPropertyChanged("CurrDoor")
End Set
End Property
Private m_CurrProject As Project
Public ReadOnly Property CurrProject As Project
Get
Return m_CurrProject
End Get
End Property
Sub New(ByRef MainWindowViewModel As MainWindowViewModel)
m_rfMainWindowViewModel = MainWindowViewModel
Dim DoorManagerViewModel As DoorManagerViewModel = DirectCast(m_rfMainWindowViewModel.DoorManager.DataContext, DoorManagerViewModel)
Dim CurrProject As Project = DoorManagerViewModel.CurrProject
' salvo il riferimento al progetto corrente
m_CurrProject = CurrProject
End Sub
#Region "Messages"
'General'
Public ReadOnly Property WidthMsg As String
Get
Return "Width"
Return EgtMsg(50001)
End Get
End Property
Public ReadOnly Property HeightMsg As String
Get
Return "Height"
Return EgtMsg(50002)
End Get
End Property
Public ReadOnly Property ThicknessMsg As String
Get
Return "Thickness"
Return EgtMsg(50003)
End Get
End Property
Public ReadOnly Property SwingMsg As String
Get
Return "Swing"
Return EgtMsg(50004)
End Get
End Property
'Profiles'
Public ReadOnly Property LockedgeMsg As String
Get
Return "Lockedge"
Return EgtMsg(50005)
End Get
End Property
Public ReadOnly Property HingeedgeMsg As String
Get
Return "Hingeedge"
Return EgtMsg(50006)
End Get
End Property
Public ReadOnly Property TopMsg As String
Get
Return "Top"
Return EgtMsg(50007)
End Get
End Property
Public ReadOnly Property BottomMsg As String
Get
Return "Bottom"
Return EgtMsg(50008)
End Get
End Property
Public ReadOnly Property ApplyBtnMsg As String
@@ -70,10 +91,6 @@ Public Class DoorParametersViewModel
End Property
#End Region
Sub New(ByRef Door As Door)
Me.m_Door = Door
End Sub
Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged
Public Sub NotifyPropertyChanged(propName As String)
@@ -81,3 +98,17 @@ Public Class DoorParametersViewModel
End Sub
End Class
Public Class DoorVisibilityConverter
Implements IValueConverter
Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.Convert
Dim DoorList As ObservableCollection(Of String) = DirectCast(value, ObservableCollection(Of String))
Return If(DoorList.Count = 0, Visibility.Collapsed, Visibility.Visible)
End Function
Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.ConvertBack
Throw New NotImplementedException
End Function
End Class
+31 -4
View File
@@ -68,6 +68,7 @@
<HintPath>..\..\EgtProg\DllD32\EgtWPFLib5.dll</HintPath>
</Reference>
<Reference Include="System.Core" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System" />
@@ -86,20 +87,32 @@
<SubType>Designer</SubType>
</ApplicationDefinition>
<Compile Include="Command\Command.vb" />
<Compile Include="CompoPanel\CompoBtn.vb" />
<Compile Include="CompoPanel\CompoType.vb" />
<Compile Include="Constants\ConstCompo.vb" />
<Compile Include="Constants\ConstGen.vb" />
<Compile Include="Constants\ConstIni.vb" />
<Compile Include="Constants\ConstMsg.vb" />
<Compile Include="DdfFile.vb" />
<Compile Include="DoorManager\DoorManagerView.xaml.vb">
<DependentUpon>DoorManagerView.xaml</DependentUpon>
</Compile>
<Compile Include="DoorManager\DoorManagerViewModel.vb" />
<Compile Include="DoorParameters\DoorParametersViewModel.vb" />
<Compile Include="DoorParameters\Compo.vb" />
<Compile Include="CompoPanel\CompoPanelView.xaml.vb">
<DependentUpon>CompoPanelView.xaml</DependentUpon>
</Compile>
<Compile Include="CompoPanel\CompoPanelViewModel.vb" />
<Compile Include="EgtDoorCreatorMap.vb" />
<Compile Include="ProjectManager\Project.vb" />
<Compile Include="ProjectManager\ProjectManagerView.xaml.vb">
<DependentUpon>ProjectManagerView.xaml</DependentUpon>
</Compile>
<Compile Include="ProjectManager\ProjectManagerViewModel.vb" />
<Compile Include="RegexFunction.vb" />
<Compile Include="Utility.vb" />
<Page Include="DoorManager\DoorManagerView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="DoorParameters\DoorParametersView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@@ -129,6 +142,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="ProjectManager\ProjectManagerView.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
</ItemGroup>
<ItemGroup>
<Import Include="System.Threading.Tasks" />
@@ -184,7 +201,17 @@
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup />
<ItemGroup>
<Resource Include="Resources\TopCommandBar\Exec.png" />
<Resource Include="Resources\TopCommandBar\Export.png" />
<Resource Include="Resources\TopCommandBar\Import.png" />
<Resource Include="Resources\TopCommandBar\Insert.png" />
<Resource Include="Resources\TopCommandBar\New.png" />
<Resource Include="Resources\TopCommandBar\Open.png" />
<Resource Include="Resources\TopCommandBar\Options.png" />
<Resource Include="Resources\TopCommandBar\Save.png" />
<Resource Include="Resources\TopCommandBar\SaveAs.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\EgtCAM5.ico" />
</ItemGroup>
+151 -2
View File
@@ -1,5 +1,7 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:EgtDOORCreator="clr-namespace:EgtDOORCreator">
<!--Colori predefiniti-->
<SolidColorBrush x:Key="EgaltechBlue1" Color="#FF4D84C4" />
@@ -10,4 +12,151 @@
<SolidColorBrush x:Key="EgaltechGray" Color="#FF58585B" />
<SolidColorBrush x:Key="EgaltechLightGray" Color="LightGray" />
<!--
Assign a Key to every Panel ViewModel to use
it in xaml file(ProjectView.xaml).
-->
<!--<EgtDOORCreator:ProjectManagerViewModel x:Key="ProjectManagerViewModel"/>-->
<Style x:Key="DoorParamsItemsControlStyle" TargetType="{x:Type ItemsControl}">
<Setter Property="ItemsPanel">
<Setter.Value>
<ItemsPanelTemplate>
<WrapPanel Orientation="Vertical"/>
</ItemsPanelTemplate>
</Setter.Value>
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ItemsControl}">
<ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Disabled" CanContentScroll="True">
<ItemsPresenter/>
</ScrollViewer>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- ______________________________________________________________________________________________________________________________________________ -->
<!-- DoorListBox -->
<SolidColorBrush x:Key="ListBox.Static.Background" Color="#FFFFFFFF"/>
<SolidColorBrush x:Key="ListBox.Static.Border" Color="#FFABADB3"/>
<SolidColorBrush x:Key="ListBox.Disabled.Background" Color="#FFFFFFFF"/>
<SolidColorBrush x:Key="ListBox.Disabled.Border" Color="#FFD9D9D9"/>
<Style x:Key="DoorListBox" TargetType="{x:Type ListBox}">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Hidden"/>
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Hidden"/>
<Setter Property="ScrollViewer.CanContentScroll" Value="False"/>
<Setter Property="ScrollViewer.PanningMode" Value="Both"/>
<Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListBox}">
<Border x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="0" SnapsToDevicePixels="true">
<ScrollViewer Focusable="false" Padding="{TemplateBinding Padding}">
<ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
</ScrollViewer>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Background" TargetName="Bd" Value="{StaticResource ListBox.Disabled.Background}"/>
<Setter Property="BorderBrush" TargetName="Bd" Value="{StaticResource ListBox.Disabled.Border}"/>
</Trigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsGrouping" Value="true"/>
<!--<Condition Property="VirtualizingPanel.IsVirtualizingWhenGrouping" Value="false"/>-->
</MultiTrigger.Conditions>
<Setter Property="ScrollViewer.CanContentScroll" Value="false"/>
</MultiTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- ______________________________________________________________________________________________________________________________________________ -->
<!-- FocusVisual -->
<!-- FocusVisual standard-->
<Style x:Key="FocusVisual">
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate>
<Rectangle Margin="2" SnapsToDevicePixels="true" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" StrokeThickness="1" StrokeDashArray="1 2"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- ______________________________________________________________________________________________________________________________________________ -->
<!-- ToggleButton Style -->
<SolidColorBrush x:Key="Button.Static.Background" Color="#FFDDDDDD"/>
<SolidColorBrush x:Key="Button.Static.Border" Color="#FF707070"/>
<SolidColorBrush x:Key="Button.MouseOver.Background" Color="#FFBEE6FD"/>
<SolidColorBrush x:Key="Button.MouseOver.Border" Color="#FF3C7FB1"/>
<SolidColorBrush x:Key="Button.Pressed.Background" Color="#FFC4E5F6"/>
<SolidColorBrush x:Key="Button.Pressed.Border" Color="#FF2C628B"/>
<SolidColorBrush x:Key="Button.Disabled.Background" Color="#FFF4F4F4"/>
<SolidColorBrush x:Key="Button.Disabled.Border" Color="#FFADB2B5"/>
<SolidColorBrush x:Key="Button.Disabled.Foreground" Color="#FF838383"/>
<Style TargetType="{x:Type ToggleButton}">
<Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}"/>
<Setter Property="Background" Value="{StaticResource Button.Static.Background}"/>
<Setter Property="BorderBrush" Value="{StaticResource Button.Static.Border}"/>
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Padding" Value="1"/>
<Setter Property="Margin" Value="1"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ToggleButton}">
<Border x:Name="border" CornerRadius="3" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="true">
<ContentPresenter x:Name="contentPresenter" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="Button.IsDefaulted" Value="true">
<Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="Background" TargetName="border" Value="{StaticResource Button.MouseOver.Background}"/>
<Setter Property="BorderBrush" TargetName="border" Value="{StaticResource Button.MouseOver.Border}"/>
</Trigger>
<Trigger Property="IsPressed" Value="true">
<Setter Property="Background" TargetName="border" Value="{StaticResource Button.Pressed.Background}"/>
<Setter Property="BorderBrush" TargetName="border" Value="{StaticResource Button.Pressed.Border}"/>
</Trigger>
<Trigger Property="IsChecked" Value="true">
<Setter Property="Background" TargetName="border" Value="{StaticResource Button.Pressed.Background}"/>
<Setter Property="BorderBrush" TargetName="border" Value="{StaticResource Button.Pressed.Border}"/>
</Trigger>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Background" TargetName="border" Value="{StaticResource Button.Disabled.Background}"/>
<Setter Property="BorderBrush" TargetName="border" Value="{StaticResource Button.Disabled.Border}"/>
<Setter Property="TextElement.Foreground" TargetName="contentPresenter" Value="{StaticResource Button.Disabled.Foreground}"/>
<Setter Property="OpacityMask" Value="#54707070"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- ______________________________________________________________________________________________________________________________________________ -->
</ResourceDictionary>
+72 -8
View File
@@ -72,6 +72,8 @@ Friend Module IniFile
Return EgtUILib.WritePrivateProfileWinPos(IpAppName, IpKeyName, nFlag, nLeft, nTop, nWidth, nHeight, m_sIniFile)
End Function
#Region "Old Function"
' Compo
Public Function CompoGetPrivateProfileInt(IpAppName As String, IpKeyName As String, nDefault As Integer) As Integer
Return EgtUILib.GetPrivateProfileInt(IpAppName, IpKeyName, nDefault, m_sCompoIniFile)
@@ -105,7 +107,7 @@ Friend Module IniFile
Return False
End Function
' Funzione che legge valori TextBox
' Funzione che legge valori TextBox
Public Function CompoGetPrivateProfileTextBox(IpAppName As String, IpKeyName As String, ByRef DDFName As String, ByRef Name As String) As Boolean
Dim sVal As String = String.Empty
CompoGetPrivateProfileString(IpAppName, IpKeyName, "", sVal)
@@ -151,6 +153,39 @@ Friend Module IniFile
Return False
End Function
' Funzione che legge i valori della SwitchTextBox
Public Function CompoGetPrivateProfileSwitchTextBox(IpAppName As String, IpKeyName As String, ByRef DDFName As List(Of String), ByRef Name As List(Of String), ByRef ComboIndex As Integer, ByRef SelComboItemList As List(Of String)) As Boolean
Dim sVal As String = String.Empty
CompoGetPrivateProfileString(IpAppName, IpKeyName, "", sVal)
Dim sItems() As String = sVal.Split(",".ToCharArray)
If sItems.Count() >= 2 Then
DDFName(0) = sItems(0)
If IsNumeric(sItems(1)) Then
Name(0) = EgtMsg(CInt(sItems(1)))
End If
DDFName(1) = sItems(2)
If IsNumeric(sItems(3)) Then
Name(1) = EgtMsg(CInt(sItems(3)))
End If
If IsNumeric(sItems(4)) Then
ComboIndex = (CInt(sItems(1)))
End If
If sItems.Count() >= 3 Then
ComboIndex = CInt(sItems(2))
SelComboItemList = New List(Of String)
For Index = 3 To sItems.Count() - 1
If IsNumeric(sItems(Index)) Then
SelComboItemList.Add(EgtMsg(CInt(sItems(Index))))
Else
SelComboItemList.Add(sItems(Index))
End If
Next
Return True
End If
End If
Return False
End Function
' Funzione che legge valori ComboBox
Public Function CompoGetPrivateProfileComboBox(IpAppName As String, IpKeyName As String, ByRef DDFName As String, ByRef Name As String) As Boolean
Dim sVal As String = String.Empty
@@ -199,31 +234,60 @@ Friend Module IniFile
If Directory.Exists(sItems(1)) Then
ListPath = sItems(1)
ComboList = New List(Of String)
OpenDirectory(ListPath, ComboList, ListPath & "\")
OpenDirectory(ListPath, ComboList)
Else
MessageBox.Show(EgtMsg(ConstMsg.MSG_ERROR) & ListPath, EgtMsg(ConstMsg.MSG_ERROR + 1), MessageBoxButton.OK, MessageBoxImage.Error)
ListPath = String.Empty
ComboList = New List(Of String)
Return ComboListResult.Mistake
Return ComboListResult.MISTAKE
End If
End If
Return ComboListResult.Found
Return ComboListResult.FOUND
End If
Return ComboListResult.NotFound
Return ComboListResult.NOTFOUND
End Function
Private Sub OpenDirectory(DirectoryPath As String, ByRef ComboList As List(Of String), ListPath As String)
Friend Sub OpenDirectory(DirectoryPath As String, ByRef ComboList As List(Of String))
RecursiveOpenDirectory(DirectoryPath, ComboList, DirectoryPath)
End Sub
Friend Sub RecursiveOpenDirectory(DirectoryPath As String, ByRef ComboList As List(Of String), InitialDirectory As String)
Dim SubDir() As String = Directory.GetDirectories(DirectoryPath)
For Index = 0 To SubDir.Count - 1
OpenDirectory(SubDir(Index), ComboList, ListPath)
RecursiveOpenDirectory(SubDir(Index), ComboList, InitialDirectory)
Next
Dim Files() As String = Directory.GetFiles(DirectoryPath)
For Index = 0 To Files.Count - 1
ComboList.Add(Files(Index).Replace(ListPath, ""))
Dim CurrFileExtension As String = Path.GetExtension(Files(Index))
If CurrFileExtension = ".lua" Or CurrFileExtension = ".nge" Then
ComboList.Add(If(CurrFileExtension.ToLower = ".lua", Files(Index).Replace(CurrFileExtension, "").Replace(InitialDirectory & "\", ""), Files(Index).Replace(InitialDirectory & "\", "")))
End If
Next
End Sub
#End Region ' Old Funtion
' Funzione che legge valori del file Config.ini passando la path del file da leggere
Public Function GetPrivateProfileCompoName(IpAppName As String, IpKeyName As String, ByRef DDFName As String, ByRef Name As String, CompoIniPath As String) As Boolean
Dim sVal As String = String.Empty
' Carico il valore della stringa nel parametro sVal
EgtUILib.GetPrivateProfileString(IpAppName, IpKeyName, "", sVal, CompoIniPath)
Dim sItems() As String = sVal.Split("/"c)
If sItems.Count() >= 2 Then
DDFName = sItems(0)
If IsNumeric(sItems(1)) Then
Name = EgtMsg(CInt(sItems(1)))
Else
Name = DDFName
End If
Return True
End If
Return False
End Function
End Module
' Classe che identifica una lingua del programma con nome e path del file dei messaggi
+14 -5
View File
@@ -1,24 +1,33 @@
<EgtWPFLib5:EgtCustomWindow x:Class="MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:EgtDOORCreator="clr-namespace:EgtDOORCreator"
xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5"
Title="{Binding Title}" Icon="/Resources/EgtCAM5.ico"
TitleBarBrush="{StaticResource EgaltechBlue1}"
BorderBrush="{StaticResource EgaltechBlue1}" BorderThickness="2"
MinHeight="600" MinWidth="800" Height="768" Width="1366"
AboutBox="{Binding AboutBox}" WindowStyle="None" ResizeMode="NoResize" TitleBarHeight="32">
<Grid>
<EgtWPFLib5:EgtCustomWindow.TitleUserControl>
<EgtDOORCreator:ProjectManagerView DataContext="{Binding ProjectManagerViewModel}"/>
</EgtWPFLib5:EgtCustomWindow.TitleUserControl>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="5*"/>
<ColumnDefinition Width="5*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<!--ContentPresenter that contains the DoorParameters-->
<ContentPresenter Grid.Column="0" Content="{Binding CompoPanel}"/>
<ContentPresenter Grid.Column="1" Content="{Binding DoorParameters}"/>
<ContentPresenter Grid.Column="0" Grid.RowSpan="2" Content="{Binding CompoPanel}"/>
<ContentPresenter Grid.Column="1" Content="{Binding DoorManager}"/>
<ContentPresenter Grid.Column="1" Grid.Row="1" Content="{Binding DoorParameters}"/>
</Grid>
</EgtWPFLib5:EgtCustomWindow>
-29
View File
@@ -6,9 +6,6 @@ Friend Class MainWindowModel
#Region "FIELDS"
' Riferimento alla porta corrente
Friend m_Door As Door
' Mutex che permette di controllare il numero massimo di istanze aperta contemporaneamente
Private m_objMutex As New Mutex
' Variabile che indica il numero di istanze aperte del programma
@@ -110,34 +107,8 @@ Friend Class MainWindowModel
EgtLuaRequire(sLuaBaseLib)
' Prova generazione porta
'NewDoor()
DdfFile.ReadDDF("c:\EgtData\EgtDOORCreator\Myprojects\Prova1.ddf")
m_Door = DdfFile.m_Door
End Sub
Public Sub NewDoor()
m_Door = New Door
EgtDoorCreatorMap.m_Door = Me.m_Door
' m_Door.Height = "15"
' m_Door.Thickness = "1"
' m_Door.Width = "9"
' m_Door.Swing = "LH"
' m_Door.TopType = "SQ"
' m_Door.BottomType = "SQ"
' m_Door.HingeEdgeType = "2B"
' m_Door.LockEdgeType = "SQ"
' m_Door.LockEdgeMachining = False
' m_Door.HingeEdgeMachining = False
' m_Door.TopMachining = False
' m_Door.BottomMachining = True
' m_Door.LockEdgeOverMaterial = "0.2"
' m_Door.HingeEdgeOverMaterial = "0.3"
' m_Door.TopOverMaterial = "0.4"
' m_Door.BottomOverMaterial = "0"
End Sub
#End Region
#Region "METHODS"
+23 -2
View File
@@ -4,23 +4,44 @@ Public Class MainWindowViewModel
' Modello del MainWindow (classe vera e propria)
Private m_MainWindowModel As New MainWindowModel
Private m_ProjectManagerViewModel As ProjectManagerViewModel
Public ReadOnly Property ProjectManagerViewModel As ProjectManagerViewModel
Get
If IsNothing(m_ProjectManagerViewModel) Then
m_ProjectManagerViewModel = New ProjectManagerViewModel(Me)
End If
Return m_ProjectManagerViewModel
End Get
End Property
Private m_CompoPanel As CompoPanelView
Public ReadOnly Property CompoPanel As CompoPanelView
Get
If IsNothing(m_CompoPanel) Then
m_CompoPanel = New CompoPanelView
m_CompoPanel.DataContext = New CompoPanelViewModel(m_MainWindowModel.m_Door)
m_CompoPanel.DataContext = New CompoPanelViewModel(Me)
End If
Return m_CompoPanel
End Get
End Property
Private m_DoorManager As DoorManagerView
Public ReadOnly Property DoorManager As DoorManagerView
Get
If IsNothing(m_DoorManager) Then
m_DoorManager = New DoorManagerView
m_DoorManager.DataContext = New DoorManagerViewModel(Me)
End If
Return m_DoorManager
End Get
End Property
Private m_DoorParameters As DoorParametersView
Public ReadOnly Property DoorParameters As DoorParametersView
Get
If IsNothing(m_DoorParameters) Then
m_DoorParameters = New DoorParametersView
m_DoorParameters.DataContext = New DoorParametersViewModel(m_MainWindowModel.m_Door)
m_DoorParameters.DataContext = New DoorParametersViewModel(Me)
End If
Return m_DoorParameters
End Get
+2 -2
View File
@@ -72,5 +72,5 @@ Imports System.Windows
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.6.24.1")>
<Assembly: AssemblyFileVersion("1.6.24.1")>
<Assembly: AssemblyVersion("1.6.24.2")>
<Assembly: AssemblyFileVersion("1.6.24.2")>
+35
View File
@@ -40,6 +40,15 @@ Public Module Utility
End If
End Function
' converto una stringa in boolean
Public Function ConvertOnOffToBoolean(sItem As String) As Boolean
If sItem = K_ON Then
Return True
Else
Return False
End If
End Function
Friend Sub UpdateUI()
' Costringo ad aggiornare UI
Dim nDummy As Integer
@@ -47,4 +56,30 @@ Public Module Utility
New Action(Function() nDummy = 0))
End Sub
Friend Function ReadMsg(sValue As String) As String
' se numerico
If IsNumeric(sValue) Then
' ritorno il messaggio associato
Return EgtMsg(CInt(sValue))
Else
' altrimenti ritorno il nome ricevuto
Return sValue
End If
End Function
End Module
Public Class SplitConverter
Implements IValueConverter
Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.Convert
Dim dValue As Double = CDbl(value)
Dim nParam As Integer = CInt(parameter)
Return dValue / nParam
End Function
Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.ConvertBack
Throw New NotImplementedException
End Function
End Class