Migliorata gestione cambio configurazione
This commit is contained in:
@@ -255,7 +255,6 @@
|
||||
</GroupBox>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
|
||||
<TabItem Header="{Binding ConfigOption}" IsEnabled="{Binding EnableConfig}">
|
||||
<Grid Margin="3,3,3,3">
|
||||
<Grid.ColumnDefinitions>
|
||||
@@ -284,7 +283,7 @@
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Text="{Binding ConfigDirectoryMsg}" Grid.Row="1" Grid.Column="0" Margin="2,10,5,5"
|
||||
Style="{StaticResource DoorParamsTxBl}" Grid.ColumnSpan="2"/>
|
||||
<TextBlock Text="{Binding ConfigDir}" Grid.Row="1" Grid.Column="2" Margin="2,10,5,5"
|
||||
<TextBlock Text="{Binding BaseDir}" Grid.Row="1" Grid.Column="2" Margin="2,10,5,5"
|
||||
Style="{StaticResource DoorParamsTxBl}"/>
|
||||
<Button Content="{Binding ChangeConfigMsg}" Grid.Row="1" Grid.Column="3"
|
||||
Command="{Binding BrowseCommand}" Margin="5"
|
||||
|
||||
@@ -83,6 +83,8 @@ Public Class OptionsVM
|
||||
If m_SelectedTabGeneral = 2 Then
|
||||
OptionModule.GetCurrentMachineInMTable()
|
||||
NotifyPropertyChanged("CurrentMachine")
|
||||
m_OrigBaseDir = IniFile.m_sDoorsDirPath
|
||||
m_OrigMTable = OptionModule.m_SelectedMTable.Name
|
||||
End If
|
||||
End Set
|
||||
End Property
|
||||
@@ -94,6 +96,9 @@ Public Class OptionsVM
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_OrigBaseDir As String = String.Empty
|
||||
Private m_OrigMTable As String = String.Empty
|
||||
|
||||
|
||||
#End Region ' Hardware_part
|
||||
|
||||
@@ -117,7 +122,7 @@ Public Class OptionsVM
|
||||
|
||||
Public ReadOnly Property EnableConfig As Boolean
|
||||
Get
|
||||
If GetMainPrivateProfileInt(S_GENERAL, K_DEBUG, 0) > 4 Then
|
||||
If GetMainPrivateProfileInt(S_GENERAL, K_DEBUG, 0) > 4 And File.Exists(IniFile.m_sConfigDir & "\ChangeConfig.lua") Then
|
||||
Return True
|
||||
Else
|
||||
Return False
|
||||
@@ -146,7 +151,7 @@ Public Class OptionsVM
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property ConfigDir As String
|
||||
Public Property BaseDir As String
|
||||
Get
|
||||
Return IniFile.m_sDoorsDirPath
|
||||
End Get
|
||||
@@ -1184,9 +1189,9 @@ Public Class OptionsVM
|
||||
Public ReadOnly Property Title As String
|
||||
Get
|
||||
Dim sTitle As String = EgtMsg(MSG_MAINWINDOW + 209)
|
||||
If Map.refMainWindowVM.SelectedPage =MainWindowVM.ListPageEnum.nDDFPage then
|
||||
If Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nDDFPage Then
|
||||
sTitle = "DOOR - " & sTitle
|
||||
else
|
||||
Else
|
||||
sTitle = "HARDWARE - " & sTitle
|
||||
End If
|
||||
Return sTitle
|
||||
@@ -1400,7 +1405,7 @@ Public Class OptionsVM
|
||||
|
||||
Public ReadOnly Property MachMsg As String
|
||||
Get
|
||||
' Mach.
|
||||
' Mach.
|
||||
Return EgtMsg(50711)
|
||||
End Get
|
||||
End Property
|
||||
@@ -1638,14 +1643,14 @@ Public Class OptionsVM
|
||||
|
||||
Public ReadOnly Property LightUpMsg As String
|
||||
Get
|
||||
' Light Up
|
||||
' Light Up
|
||||
Return EgtMsg(50056)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property LightLockMsg As String
|
||||
Get
|
||||
' Light Lock
|
||||
' Light Lock
|
||||
Return EgtMsg(50057)
|
||||
End Get
|
||||
End Property
|
||||
@@ -1838,10 +1843,17 @@ Public Class OptionsVM
|
||||
Return m_EnableAssembly
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
Dim sMessage As String = "The program will be shut down, do you want to proced?"
|
||||
Dim bRestartProgram As Boolean = EnableConfig
|
||||
If bRestartProgram Then
|
||||
sMessage = "The program will be restart, do you want to proced?"
|
||||
End If
|
||||
|
||||
' chiedo se desidera procedere con lo spegnimento del programma
|
||||
If MessageBox.Show("The program will be shut down, do you want to proced?", "Warning", MessageBoxButton.OKCancel, MessageBoxImage.Exclamation, MessageBoxResult.Cancel) = MessageBoxResult.OK Then
|
||||
If MessageBox.Show(sMessage, "Warning", MessageBoxButton.OKCancel, MessageBoxImage.Exclamation, MessageBoxResult.Cancel) = MessageBoxResult.OK Then
|
||||
' procedo alla chiusura del programma
|
||||
Map.refMainWindowVM.CloseApplication()
|
||||
If bRestartProgram Then Process.Start(Application.ResourceAssembly.Location)
|
||||
Else
|
||||
' esco senza salvare la selezione
|
||||
Return
|
||||
@@ -2031,12 +2043,12 @@ Public Class OptionsVM
|
||||
End If
|
||||
Next
|
||||
|
||||
If m_IsChangedConfig AndAlso EnableConfig Then
|
||||
If m_IsChangedConfig AndAlso EnableConfig AndAlso m_OrigBaseDir <> IniFile.m_sDoorsDirPath AndAlso m_OrigMTable <> OptionModule.m_SelectedMTable.Name Then
|
||||
' aggiorno il file Config.ini dell'EgtCAM5
|
||||
EgtLuaExecFile(IniFile.m_sConfigDir & "\ChangeConfig.lua")
|
||||
' assegno variabili
|
||||
EgtLuaSetGlobStringVar("CCD.NewBaseDir", ConfigDir)
|
||||
EgtLuaSetGlobStringVar("CCD.NewMTable", SelectedMTable.Name)
|
||||
EgtLuaSetGlobStringVar("CCD.NewBaseDir", IniFile.m_sDoorsDirPath)
|
||||
EgtLuaSetGlobStringVar("CCD.NewMTable", OptionModule.m_SelectedMTable.Name)
|
||||
' eseguo la funzione che esegue la scrittura delle variabili
|
||||
EgtLuaCallFunction("CCD.ChangeConfigDirectory")
|
||||
Dim sVal As String = ""
|
||||
@@ -2100,7 +2112,7 @@ Public Class OptionsVM
|
||||
' se la risposta è diversa da OK esce
|
||||
Return
|
||||
End If
|
||||
ConfigDir = FolderBrowserDialog.SelectedPath
|
||||
BaseDir = FolderBrowserDialog.SelectedPath
|
||||
End Select
|
||||
|
||||
End Sub
|
||||
|
||||
Reference in New Issue
Block a user