From 11316a5a5ce7557e1ce9c2d824bddf10c75fb0a4 Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Sat, 21 Sep 2024 11:54:28 +0200 Subject: [PATCH 01/36] EgtCAM5 2.6i1 : - ricompilazione con cambio versione. --- MainWindow/MainWindowVM.vb | 4 ++-- My Project/AssemblyInfo.vb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/MainWindow/MainWindowVM.vb b/MainWindow/MainWindowVM.vb index 9f244ac..5006ded 100644 --- a/MainWindow/MainWindowVM.vb +++ b/MainWindow/MainWindowVM.vb @@ -385,8 +385,8 @@ Public Class MainWindowVM EgtSetLockId(sLockId) End If ' Recupero livello e opzioni della chiave - Dim bKey As Boolean = EgtGetKeyLevel(3279, 2608, 1, IniFile.m_nKeyLevel) And - EgtGetKeyOptions(3279, 2608, 1, IniFile.m_nKeyOptions) + Dim bKey As Boolean = EgtGetKeyLevel(3279, 2609, 1, IniFile.m_nKeyLevel) And + EgtGetKeyOptions(3279, 2609, 1, IniFile.m_nKeyOptions) ' Leggo e imposto livello utilizzatore IniFile.m_nUserLevel = Math.Min(IniFile.m_nKeyLevel, GetPrivateProfileInt(S_GENERAL, K_USERLEVEL, 1)) ' Imposto abilitazione lavorazioni avanzate diff --git a/My Project/AssemblyInfo.vb b/My Project/AssemblyInfo.vb index 81f3937..963a21d 100644 --- a/My Project/AssemblyInfo.vb +++ b/My Project/AssemblyInfo.vb @@ -70,6 +70,6 @@ Imports System.Windows ' by using the '*' as shown below: ' - - + + From 5490884eb4102516da67c794c4630b50db92b9b9 Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Wed, 25 Sep 2024 09:23:02 +0200 Subject: [PATCH 02/36] EgtCAM5 : - migliorata gestione anteprima utensile in lavorazione con frecce senza focus. --- MainWindow/MainWindowVM.vb | 6 ++++-- .../MachiningParameterExpanderVM.vb | 8 +++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/MainWindow/MainWindowVM.vb b/MainWindow/MainWindowVM.vb index 742ec8d..d09fa12 100644 --- a/MainWindow/MainWindowVM.vb +++ b/MainWindow/MainWindowVM.vb @@ -597,9 +597,11 @@ Public Class MainWindowVM ' pulisco output Map.refStatusBarVM.NotifyStatusOutput("") Map.refInputExpanderVM.ResetInputBox() - ElseIf e.Key = Key.Left OrElse e.Key = Key.Right OrElse e.Key = Key.Up OrElse e.Key = Key.Down AndAlso Map.refTopCommandBarVM.MachiningIsChecked AndAlso Map.refOperationParametersExpanderVM.OperationParameters.IsEnabled Then + ElseIf e.Key = Key.Left OrElse e.Key = Key.Right OrElse e.Key = Key.Up OrElse e.Key = Key.Down AndAlso + Map.refTopCommandBarVM.MachiningIsChecked AndAlso Map.refOperationParametersExpanderVM.OperationParameters.IsEnabled Then Map.refMachiningParameterExpanderVM.FocusSlider() - Map.refMachiningParameterExpanderVM.SetSliderValue(1) + Dim nStep As Integer = If( e.Key = Key.Right OrElse e.Key = Key.Up, 1, -1) + Map.refMachiningParameterExpanderVM.SetSliderValue(nStep) e.Handled = True End If End Sub diff --git a/OptionPanel/MachiningOptionPanel/OperationExpander/MachiningParameterExpander/MachiningParameterExpanderVM.vb b/OptionPanel/MachiningOptionPanel/OperationExpander/MachiningParameterExpander/MachiningParameterExpanderVM.vb index be1241c..2264a78 100644 --- a/OptionPanel/MachiningOptionPanel/OperationExpander/MachiningParameterExpander/MachiningParameterExpanderVM.vb +++ b/OptionPanel/MachiningOptionPanel/OperationExpander/MachiningParameterExpander/MachiningParameterExpanderVM.vb @@ -127,7 +127,13 @@ Public Class MachiningParameterExpanderVM NotifyPropertyChanged(NameOf(SliderValue)) End Sub Friend Sub SetSliderValue(value As Integer) - m_SliderValue += value + Dim nOldSliderValue As Integer = m_SliderValue + m_SliderValue = Math.Min( Math.Max( m_SliderValue + value, 1), m_SliderScale) + Dim nStep As Integer = m_SliderValue - nOldSliderValue + If nStep = 0 Then Return + Dim nId As Integer = EgtPreviewMachiningTool(m_nPtEntId, nStep) + If nId <> GDB_ID.NULL Then m_nPtEntId = nId + EgtDraw() NotifyPropertyChanged(NameOf(SliderValue)) End Sub From bfc4af4c1eb5995199fc32960aacf8c918aea468 Mon Sep 17 00:00:00 2001 From: Demetrio Cassarino Date: Mon, 30 Sep 2024 10:08:44 +0200 Subject: [PATCH 03/36] -aggiunto in opzioni virtualmillingquality --- Constants/ConstIni.vb | 1 + OptionsWindow/OptionModule.vb | 3 + OptionsWindow/OptionWindowV.xaml | 12 +- OptionsWindow/OptionWindowVM.vb | 277 ++++++++++++++++++------------- Utility/IniFile.vb | 8 + 5 files changed, 187 insertions(+), 114 deletions(-) diff --git a/Constants/ConstIni.vb b/Constants/ConstIni.vb index 7c0766c..46aff0e 100644 --- a/Constants/ConstIni.vb +++ b/Constants/ConstIni.vb @@ -184,6 +184,7 @@ Module ConstIni Public Const K_SELGEOMSURFFINISHING As String = "SelGeomSurfFinishing" Public Const K_SELGEOMSURFROUGHING As String = "SelGeomSurfRoughing" Public Const K_SELGEOMFIVEAXMILLING As String = "SelGeomFiveAxMilling" + Public Const K_SELVMILLQUALITY As String = "VMillQuality" Public Const K_MACHININGGROUP As String = "MachiningGroup" Public Const K_SHOWONLYTABLE As String = "ShowOnlyTable" Public Const K_MOVETHROUGHDISPS As String = "MoveThroughDisps" diff --git a/OptionsWindow/OptionModule.vb b/OptionsWindow/OptionModule.vb index f29421e..0ace471 100644 --- a/OptionsWindow/OptionModule.vb +++ b/OptionsWindow/OptionModule.vb @@ -56,6 +56,7 @@ Friend Module OptionModule Friend m_SelGeomSurfRoughing As SceneSelModeOpt Friend m_SelGeomWaterJetting As SceneSelModeOpt Friend m_SelGeomFiveAxMilling As SceneSelModeOpt + Friend m_SelVMillQuality As VMillSelTypeOpt ' Flag per aggiungere una nuova lavorazione alla fine della fase o subito dopo la lavorazione selezionata Friend m_bNewMachiningIsLastOne As Boolean ' Variabile che indica se usare lo script per calcolare automaticamente la disposizione quando si passa in lavorazione @@ -147,6 +148,8 @@ Friend Module OptionModule m_SelGeomSurfRoughing = If(Temp < 0 Or Temp > 3, SceneSelModeOpt.PARTCURVESANDSURFACES, DirectCast(Temp, SceneSelModeOpt)) Temp = GetPrivateProfileInt(S_MACH, K_SELGEOMFIVEAXMILLING, -1) m_SelGeomFiveAxMilling = If(Temp < 0 Or Temp > 3, SceneSelModeOpt.PARTCURVESANDSURFACES, DirectCast(Temp, SceneSelModeOpt)) + Temp = GetPrivateProfileInt(S_MACH, K_SELVMILLQUALITY, -1) + m_SelVMillQuality = If(Temp < -2 Or Temp > 2, VMillSelTypeOpt.HIGH, DirectCast(Temp, VMillSelTypeOpt)) m_SelGeomWaterJetting = SceneSelModeOpt.PARTCURVES ' Inizializzo variabile che indica posizione nuova operazione di lavorazione m_bNewMachiningIsLastOne = (GetPrivateProfileInt(S_OPTIONS, K_NEWMACHININGISLASTONE, 0) <> 0) diff --git a/OptionsWindow/OptionWindowV.xaml b/OptionsWindow/OptionWindowV.xaml index f70e3ef..a44fb65 100644 --- a/OptionsWindow/OptionWindowV.xaml +++ b/OptionsWindow/OptionWindowV.xaml @@ -9,11 +9,12 @@ WindowStyle="None" ResizeMode="NoResize" TitleBarHeight="30" IsResizable="False" IsMinimizable="False" WindowStartupLocation="CenterScreen" ShowInTaskbar="False" MinWidth="400" MinHeight="382" - Width="400" Height="520" + Width="400" Height="550" CloseCommand="{Binding CloseOptionsCommand,Mode=OneWay,UpdateSourceTrigger=PropertyChanged}"> + @@ -313,6 +314,15 @@ + + + + + + + + diff --git a/OptionsWindow/OptionWindowVM.vb b/OptionsWindow/OptionWindowVM.vb index b3e43a3..93fab31 100644 --- a/OptionsWindow/OptionWindowVM.vb +++ b/OptionsWindow/OptionWindowVM.vb @@ -2,6 +2,7 @@ Imports System.Collections.ObjectModel Imports System.IO Imports EgtUILib +Imports System.Globalization Public Class OptionWindowVM Inherits VMBase @@ -19,6 +20,13 @@ Public Class OptionWindowVM End Get End Property + Private m_VMillTypeList As ObservableCollection(Of VMillSelTypeOpt) = New ObservableCollection(Of VMillSelTypeOpt)({VMillSelTypeOpt.POOR, VMillSelTypeOpt.LOW, VMillSelTypeOpt.STANDARD, VMillSelTypeOpt.BETTER, VMillSelTypeOpt.HIGH}) + Public ReadOnly Property VMillTypeList As ObservableCollection(Of VMillSelTypeOpt) + Get + Return m_VMillTypeList + End Get + End Property + Private m_UnitMeasureList As List(Of String) = New List(Of String)({"mm", "inch", EgtMsg(MSG_OPTIONPAGE + 45)}) Public ReadOnly Property UnitMeasureList As List(Of String) Get @@ -192,6 +200,17 @@ Public Class OptionWindowVM End Set End Property + Public Property SelectedVMillTypeType As VMillSelTypeOpt + Get + Return OptionModule.m_SelVMillQuality + End Get + Set(value As VMillSelTypeOpt) + If WritePrivateProfileString(S_MACH, K_SELVMILLQUALITY, CInt(value).ToString()) Then + OptionModule.m_SelVMillQuality = value + End If + End Set + End Property + Public Property GeometryTolerance As String Get Return LenToString(OptionModule.m_dGeometryTolerance, 5) @@ -268,8 +287,8 @@ Public Class OptionWindowVM End Get Set(value As Boolean) OptionModule.m_bThickLine = value - WritePrivateProfileString(S_SCENE, K_LINEWIDTH, If( value, "2", "1")) - EgtSetLineAttribs( If( value, 2, 1)) + WritePrivateProfileString(S_SCENE, K_LINEWIDTH, If(value, "2", "1")) + EgtSetLineAttribs(If(value, 2, 1)) End Set End Property @@ -589,7 +608,7 @@ Public Class OptionWindowVM End Get Set(value As Boolean) OptionModule.m_bSpecialOn = value - WritePrivateProfileString(S_SPECIAL, K_SPECIALENABLE, If( value, "1", "0")) + WritePrivateProfileString(S_SPECIAL, K_SPECIALENABLE, If(value, "1", "0")) End Set End Property @@ -609,7 +628,7 @@ Public Class OptionWindowVM End Get Set(value As Boolean) OptionModule.m_bBeamOn = value - WritePrivateProfileString(S_BEAM, K_BEAMENABLE, If( value, "1", "0")) + WritePrivateProfileString(S_BEAM, K_BEAMENABLE, If(value, "1", "0")) End Set End Property @@ -629,7 +648,7 @@ Public Class OptionWindowVM End Get Set(value As Boolean) OptionModule.m_bWallOn = value - WritePrivateProfileString(S_WALL, K_WALLENABLE, If( value, "1", "0")) + WritePrivateProfileString(S_WALL, K_WALLENABLE, If(value, "1", "0")) End Set End Property @@ -644,7 +663,7 @@ Public Class OptionWindowVM End Get Set(value As Boolean) OptionModule.m_bDoorsOn = value - WritePrivateProfileString(S_DOORS, K_DDFENABLE, If( value, "1", "0")) + WritePrivateProfileString(S_DOORS, K_DDFENABLE, If(value, "1", "0")) End Set End Property @@ -659,7 +678,7 @@ Public Class OptionWindowVM End Get Set(value As Boolean) OptionModule.m_bGunstockOn = value - WritePrivateProfileString(S_GUNSTOCK, K_GUNSTOCKENABLE, If( value, "1", "0")) + WritePrivateProfileString(S_GUNSTOCK, K_GUNSTOCKENABLE, If(value, "1", "0")) End Set End Property @@ -717,17 +736,17 @@ Public Class OptionWindowVM End Property Public ReadOnly Property ThickLineMsg As String Get - Return EgtMsg( 6536) ' Linee spesse + Return EgtMsg(6536) ' Linee spesse End Get End Property Public ReadOnly Property SmoothTriMeshMsg As String Get - Return EgtMsg( 6518) ' Superfici smussate + Return EgtMsg(6518) ' Superfici smussate End Get End Property Public ReadOnly Property UpdateLicenceMsg As String Get - Return EgtMsg( 6553) ' Aggiorna licenza + Return EgtMsg(6553) ' Aggiorna licenza End Get End Property @@ -966,6 +985,13 @@ Public Class OptionWindowVM End Get End Property + Public ReadOnly Property VMillQualityMsg As String + Get + Return EgtMsg(31214) + End Get + End Property + + #End Region #Region "COMMANDS" @@ -1179,135 +1205,135 @@ Public Class OptionWindowVM Dim sMachDir As String = Path.Combine(IniFile.m_sMachinesRoot, sMachName) ' Preparo direttorio temporaneo Dim sTempDir As String = Path.Combine(IniFile.m_sMachinesRoot, "Temp") - If My.Computer.FileSystem.DirectoryExists( sTempDir) Then - My.Computer.FileSystem.DeleteDirectory( sTempDir, FileIO.DeleteDirectoryOption.DeleteAllContents) + If My.Computer.FileSystem.DirectoryExists(sTempDir) Then + My.Computer.FileSystem.DeleteDirectory(sTempDir, FileIO.DeleteDirectoryOption.DeleteAllContents) End If - My.Computer.FileSystem.CreateDirectory( sTempDir) + My.Computer.FileSystem.CreateDirectory(sTempDir) ' Unzip nel direttorio temporaneo Using zip As New Ionic.Zip.ZipFile(sMachZip) - zip.ExtractAll( sTempDir, Ionic.Zip.ExtractExistingFileAction.DoNotOverwrite) + zip.ExtractAll(sTempDir, Ionic.Zip.ExtractExistingFileAction.DoNotOverwrite) End Using ' Se non è una macchina segnalo il problema ed esco - If Not My.Computer.FileSystem.FileExists( Path.Combine( sTempDir, sMachName, sMachName & ".ini")) Or - Not My.Computer.FileSystem.FileExists( Path.Combine( sTempDir, sMachName, sMachName & ".mlde")) Then + If Not My.Computer.FileSystem.FileExists(Path.Combine(sTempDir, sMachName, sMachName & ".ini")) Or + Not My.Computer.FileSystem.FileExists(Path.Combine(sTempDir, sMachName, sMachName & ".mlde")) Then ' Il file {0} non contiene una macchina - Avviso Dim sOut As String = String.Format(EgtMsg(MSG_OPTIONPAGE + 29), sMachZip) MessageBox.Show(sOut, EgtMsg(MSG_MESSAGEBOX + 2), MessageBoxButton.OK, MessageBoxImage.Warning) ' Rimuovo il direttorio temporaneo ed esco - My.Computer.FileSystem.DeleteDirectory( sTempDir, FileIO.DeleteDirectoryOption.DeleteAllContents) + My.Computer.FileSystem.DeleteDirectory(sTempDir, FileIO.DeleteDirectoryOption.DeleteAllContents) Return End If ' Imposto data e ora correnti al file mlde della macchina Try - File.SetLastWriteTime( Path.Combine( sTempDir, sMachName, sMachName & ".mlde"), System.DateTime.Now) + File.SetLastWriteTime(Path.Combine(sTempDir, sMachName, sMachName & ".mlde"), System.DateTime.Now) Catch ex As Exception End Try ' Verifico esistenza di una macchina con lo stesso nome - Dim bOldExists As Boolean = My.Computer.FileSystem.DirectoryExists( sMachDir) + Dim bOldExists As Boolean = My.Computer.FileSystem.DirectoryExists(sMachDir) Dim bUpdate As Boolean = True If bOldExists Then - Dim MachBox As New MachineBox( Application.Current.MainWindow, sMachName) - Select MachBox.ShowDialog() - Case MessageBoxResult.Yes - bUpdate = False - Case MessageBoxResult.No - bUpdate = True - Case MessageBoxResult.Cancel - ' Rimuovo il direttorio temporaneo ed esco - My.Computer.FileSystem.DeleteDirectory( sTempDir, FileIO.DeleteDirectoryOption.DeleteAllContents) - Return + Dim MachBox As New MachineBox(Application.Current.MainWindow, sMachName) + Select Case MachBox.ShowDialog() + Case MessageBoxResult.Yes + bUpdate = False + Case MessageBoxResult.No + bUpdate = True + Case MessageBoxResult.Cancel + ' Rimuovo il direttorio temporaneo ed esco + My.Computer.FileSystem.DeleteDirectory(sTempDir, FileIO.DeleteDirectoryOption.DeleteAllContents) + Return End Select ' Faccio una copia di backup della macchina corrente Dim sBackupDir As String = sMachDir & ".old" - If My.Computer.FileSystem.DirectoryExists( sBackupDir) Then - My.Computer.FileSystem.DeleteDirectory( sBackupDir, FileIO.DeleteDirectoryOption.DeleteAllContents) + If My.Computer.FileSystem.DirectoryExists(sBackupDir) Then + My.Computer.FileSystem.DeleteDirectory(sBackupDir, FileIO.DeleteDirectoryOption.DeleteAllContents) End If Try - My.Computer.FileSystem.MoveDirectory( sMachDir, sBackupDir, True) + My.Computer.FileSystem.MoveDirectory(sMachDir, sBackupDir, True) Catch ex As Exception ' Ripristino lo stato originale ed esco - My.Computer.FileSystem.MoveDirectory( sBackupDir, sMachDir, True) + My.Computer.FileSystem.MoveDirectory(sBackupDir, sMachDir, True) ' L'aggiornamento della macchina "{0}" non è riuscito. Dim sKo As String = String.Format(EgtMsg(MSG_OPTIONPAGE + 35), sMachName) - EgtOutLog( sKo) + EgtOutLog(sKo) MessageBox.Show(sKo, EgtMsg(MSG_MESSAGEBOX + 1), MessageBoxButton.OK) Return End Try End If ' Installo la macchina - My.Computer.FileSystem.MoveDirectory( Path.Combine( sTempDir, sMachName), sMachDir, True) + My.Computer.FileSystem.MoveDirectory(Path.Combine(sTempDir, sMachName), sMachDir, True) ' Se è un aggiornamento, recupero utensili, lavorazioni, attrezzaggi e dati per travi If bOldExists And bUpdate Then Dim sBackupDir As String = sMachDir & ".old" - If My.Computer.FileSystem.DirectoryExists( sBackupDir & "\Tools") Then - If My.Computer.FileSystem.DirectoryExists( sMachDir & "\Tools") Then - My.Computer.FileSystem.DeleteDirectory( sMachDir & "\Tools", FileIO.DeleteDirectoryOption.DeleteAllContents) + If My.Computer.FileSystem.DirectoryExists(sBackupDir & "\Tools") Then + If My.Computer.FileSystem.DirectoryExists(sMachDir & "\Tools") Then + My.Computer.FileSystem.DeleteDirectory(sMachDir & "\Tools", FileIO.DeleteDirectoryOption.DeleteAllContents) End If - My.Computer.FileSystem.CopyDirectory( sBackupDir & "\Tools", sMachDir & "\Tools", True) + My.Computer.FileSystem.CopyDirectory(sBackupDir & "\Tools", sMachDir & "\Tools", True) End If - If My.Computer.FileSystem.DirectoryExists( sBackupDir & "\Machinings") Then - If My.Computer.FileSystem.DirectoryExists( sMachDir & "\Machinings") Then - My.Computer.FileSystem.DeleteDirectory( sMachDir & "\Machinings", FileIO.DeleteDirectoryOption.DeleteAllContents) + If My.Computer.FileSystem.DirectoryExists(sBackupDir & "\Machinings") Then + If My.Computer.FileSystem.DirectoryExists(sMachDir & "\Machinings") Then + My.Computer.FileSystem.DeleteDirectory(sMachDir & "\Machinings", FileIO.DeleteDirectoryOption.DeleteAllContents) End If - My.Computer.FileSystem.CopyDirectory( sBackupDir & "\Machinings", sMachDir & "\Machinings", True) + My.Computer.FileSystem.CopyDirectory(sBackupDir & "\Machinings", sMachDir & "\Machinings", True) End If - If My.Computer.FileSystem.DirectoryExists( sBackupDir & "\SetUp") Then - If My.Computer.FileSystem.DirectoryExists( sMachDir & "\SetUp") Then - My.Computer.FileSystem.DeleteDirectory( sMachDir & "\SetUp", FileIO.DeleteDirectoryOption.DeleteAllContents) + If My.Computer.FileSystem.DirectoryExists(sBackupDir & "\SetUp") Then + If My.Computer.FileSystem.DirectoryExists(sMachDir & "\SetUp") Then + My.Computer.FileSystem.DeleteDirectory(sMachDir & "\SetUp", FileIO.DeleteDirectoryOption.DeleteAllContents) End If - My.Computer.FileSystem.CopyDirectory( sBackupDir & "\SetUp", sMachDir & "\SetUp", True) + My.Computer.FileSystem.CopyDirectory(sBackupDir & "\SetUp", sMachDir & "\SetUp", True) End If - If My.Computer.FileSystem.DirectoryExists( sBackupDir & "\Beam") Then + If My.Computer.FileSystem.DirectoryExists(sBackupDir & "\Beam") Then ' Flag per sovrascrivere vecchio file BeamData.lua con nuovo Dim bBeamDataExists As Boolean = False Const sBeamData As String = "\BeamData.lua" ' Flag per sovrascrivere vecchio file MachiningTypes.ini Dim bMchgTypesExists As Boolean = False Const sMchgTypes As String = "\MachiningTypes.ini" - If My.Computer.FileSystem.DirectoryExists( sMachDir & "\Beam") Then - If My.Computer.FileSystem.FileExists( sMachDir & "\Beam" & sBeamData) Then + If My.Computer.FileSystem.DirectoryExists(sMachDir & "\Beam") Then + If My.Computer.FileSystem.FileExists(sMachDir & "\Beam" & sBeamData) Then bBeamDataExists = True - My.Computer.FileSystem.MoveFile( sMachDir & "\Beam" & sBeamData, sMachDir & sBeamData, True) + My.Computer.FileSystem.MoveFile(sMachDir & "\Beam" & sBeamData, sMachDir & sBeamData, True) End If - If My.Computer.FileSystem.FileExists( sMachDir & "\Beam" & sMchgTypes) Then + If My.Computer.FileSystem.FileExists(sMachDir & "\Beam" & sMchgTypes) Then bMchgTypesExists = True - My.Computer.FileSystem.MoveFile( sMachDir & "\Beam" & sMchgTypes, sMachDir & sMchgTypes, True) + My.Computer.FileSystem.MoveFile(sMachDir & "\Beam" & sMchgTypes, sMachDir & sMchgTypes, True) End If - My.Computer.FileSystem.DeleteDirectory( sMachDir & "\Beam", FileIO.DeleteDirectoryOption.DeleteAllContents) + My.Computer.FileSystem.DeleteDirectory(sMachDir & "\Beam", FileIO.DeleteDirectoryOption.DeleteAllContents) End If - My.Computer.FileSystem.CopyDirectory( sBackupDir & "\Beam", sMachDir & "\Beam", True) - If bBeamDataExists Then My.Computer.FileSystem.MoveFile( sMachDir & sBeamData, sMachDir & "\Beam" & sBeamData, True) - If bMchgTypesExists Then My.Computer.FileSystem.MoveFile( sMachDir & sMchgTypes, sMachDir & "\Beam" & sMchgTypes, True) + My.Computer.FileSystem.CopyDirectory(sBackupDir & "\Beam", sMachDir & "\Beam", True) + If bBeamDataExists Then My.Computer.FileSystem.MoveFile(sMachDir & sBeamData, sMachDir & "\Beam" & sBeamData, True) + If bMchgTypesExists Then My.Computer.FileSystem.MoveFile(sMachDir & sMchgTypes, sMachDir & "\Beam" & sMchgTypes, True) End If - If My.Computer.FileSystem.DirectoryExists( sBackupDir & "\Wall") Then + If My.Computer.FileSystem.DirectoryExists(sBackupDir & "\Wall") Then ' Flag per sovrascrittura vecchio file WallData.lua con nuovo Dim bWallDataExists As Boolean = False Const sWallData As String = "\WallData.lua" ' Flag per sovrascrivere vecchio file MachiningTypes.ini Dim bMchgTypesExists As Boolean = False Const sMchgTypes As String = "\MachiningTypes.ini" - If My.Computer.FileSystem.DirectoryExists( sMachDir & "\Wall") Then - If My.Computer.FileSystem.FileExists( sMachDir & "\Wall" & sWallData) Then + If My.Computer.FileSystem.DirectoryExists(sMachDir & "\Wall") Then + If My.Computer.FileSystem.FileExists(sMachDir & "\Wall" & sWallData) Then bWallDataExists = True - My.Computer.FileSystem.MoveFile( sMachDir & "\Wall" & sWallData, sMachDir & sWallData, True) + My.Computer.FileSystem.MoveFile(sMachDir & "\Wall" & sWallData, sMachDir & sWallData, True) End If - If My.Computer.FileSystem.FileExists( sMachDir & "\Wall" & sMchgTypes) Then + If My.Computer.FileSystem.FileExists(sMachDir & "\Wall" & sMchgTypes) Then bMchgTypesExists = True - My.Computer.FileSystem.MoveFile( sMachDir & "\Wall" & sMchgTypes, sMachDir & sMchgTypes, True) + My.Computer.FileSystem.MoveFile(sMachDir & "\Wall" & sMchgTypes, sMachDir & sMchgTypes, True) End If - My.Computer.FileSystem.DeleteDirectory( sMachDir & "\Wall", FileIO.DeleteDirectoryOption.DeleteAllContents) + My.Computer.FileSystem.DeleteDirectory(sMachDir & "\Wall", FileIO.DeleteDirectoryOption.DeleteAllContents) End If - My.Computer.FileSystem.CopyDirectory( sBackupDir & "\Wall", sMachDir & "\Wall", True) - If bWallDataExists Then My.Computer.FileSystem.MoveFile( sMachDir & sWallData, sMachDir & "\Wall" & sWallData, True) - If bMchgTypesExists Then My.Computer.FileSystem.MoveFile( sMachDir & sMchgTypes, sMachDir & "\Wall" & sMchgTypes, True) + My.Computer.FileSystem.CopyDirectory(sBackupDir & "\Wall", sMachDir & "\Wall", True) + If bWallDataExists Then My.Computer.FileSystem.MoveFile(sMachDir & sWallData, sMachDir & "\Wall" & sWallData, True) + If bMchgTypesExists Then My.Computer.FileSystem.MoveFile(sMachDir & sMchgTypes, sMachDir & "\Wall" & sMchgTypes, True) End If End If 'La macchina "{0}" è stata aggiornata con successo. Dim sOk As String = String.Format(EgtMsg(MSG_OPTIONPAGE + 30), sMachName) - EgtOutLog( sOk) + EgtOutLog(sOk) MessageBox.Show(sOk, EgtMsg(MSG_MESSAGEBOX + 3), MessageBoxButton.OK) ' Rimuovo il direttorio temporaneo - My.Computer.FileSystem.DeleteDirectory( sTempDir, FileIO.DeleteDirectoryOption.DeleteAllContents) + My.Computer.FileSystem.DeleteDirectory(sTempDir, FileIO.DeleteDirectoryOption.DeleteAllContents) ' Aggiorno la lista delle macchina Map.refMachinePanelVM.InsertMachine(sMachDir) End Sub @@ -1355,7 +1381,7 @@ Public Class OptionWindowVM ' aggiungo i file della Macchina Dim sMachineDir As String = IniFile.m_sMachinesRoot & "\" & sCurrMachineName If Directory.Exists(sMachineDir) Then - zip.AddSelectedFiles( "name != *\.git\*.* and name != *.git*", sMachineDir, sCurrMachineName, True) + zip.AddSelectedFiles("name != *\.git\*.* and name != *.git*", sMachineDir, sCurrMachineName, True) End If ' salvo lo zip zip.Save() @@ -1366,7 +1392,7 @@ Public Class OptionWindowVM Dim sKo As String = String.Format(EgtMsg(6551), sCurrMachineName) EgtOutLog(sKo) MessageBox.Show(sKo, EgtMsg(MSG_MESSAGEBOX + 1), MessageBoxButton.OK) - return + Return End Try 'La macchina "{0}" è stata esportata con successo. Dim sOk As String = String.Format(EgtMsg(6552), sCurrMachineName) @@ -1391,10 +1417,10 @@ Public Class OptionWindowVM Dim sExeVer As String = IniFile.GetProgramVersion() ' Verifico presenza di una precedente installazione del Beam Dim sBeamVer As String = "" - IniFile.GetSpecialLuaVersion( IniFile.m_sBeamDirPath, sBeamVer) - If String.IsNullOrEmpty( sBeamVer) Then + IniFile.GetSpecialLuaVersion(IniFile.m_sBeamDirPath, sBeamVer) + If String.IsNullOrEmpty(sBeamVer) Then ' Il modulo "{0}" non è stato trovato, impossibile aggiornare. - Avviso - Dim sOut As String = String.Format(EgtMsg(6555), "Beam") + Dim sOut As String = String.Format(EgtMsg(6555), "Beam") MessageBox.Show(Application.Current.MainWindow, sOut, EgtMsg(15002), MessageBoxButton.OK, MessageBoxImage.Warning) ' Esco Return @@ -1410,26 +1436,26 @@ Public Class OptionWindowVM Dim sBeamZip As String = BeamDlg.FileName ' Preparo direttorio temporaneo Dim sTempDir As String = Path.Combine(IniFile.m_sTempDir, "Beam") - If My.Computer.FileSystem.DirectoryExists( sTempDir) Then - My.Computer.FileSystem.DeleteDirectory( sTempDir, FileIO.DeleteDirectoryOption.DeleteAllContents) + If My.Computer.FileSystem.DirectoryExists(sTempDir) Then + My.Computer.FileSystem.DeleteDirectory(sTempDir, FileIO.DeleteDirectoryOption.DeleteAllContents) End If - My.Computer.FileSystem.CreateDirectory( sTempDir) + My.Computer.FileSystem.CreateDirectory(sTempDir) ' Unzip nel direttorio temporaneo Using zip As New Ionic.Zip.ZipFile(sBeamZip) - zip.ExtractAll( sTempDir, Ionic.Zip.ExtractExistingFileAction.DoNotOverwrite) + zip.ExtractAll(sTempDir, Ionic.Zip.ExtractExistingFileAction.DoNotOverwrite) End Using ' Recupero i dati del nuovo Beam Dim sNewName = "" Dim sNewVer = "" Dim sNewMinExe = "" - IniFile.GetSpecialLuaData( sTempDir, sNewName, sNewVer, sNewMinExe) + IniFile.GetSpecialLuaData(sTempDir, sNewName, sNewVer, sNewMinExe) ' Verifico che sia veramente il Beam If String.Compare(sNewName, "Beam") <> 0 Then ' Il file zip non contiene il modulo "{0}". - Avviso - Dim sOut As String = String.Format(EgtMsg(6556), "Beam") + Dim sOut As String = String.Format(EgtMsg(6556), "Beam") MessageBox.Show(Application.Current.MainWindow, sOut, EgtMsg(15002), MessageBoxButton.OK, MessageBoxImage.Warning) ' Rimuovo il direttorio temporaneo ed esco - My.Computer.FileSystem.DeleteDirectory( sTempDir, FileIO.DeleteDirectoryOption.DeleteAllContents) + My.Computer.FileSystem.DeleteDirectory(sTempDir, FileIO.DeleteDirectoryOption.DeleteAllContents) Return End If ' Verifico la versione minima del programma @@ -1438,42 +1464,42 @@ Public Class OptionWindowVM Dim sOut As String = String.Format(EgtMsg(6557), "Beam", sNewMinExe) MessageBox.Show(Application.Current.MainWindow, sOut, EgtMsg(15002), MessageBoxButton.OK, MessageBoxImage.Warning) ' Rimuovo il direttorio temporaneo ed esco - My.Computer.FileSystem.DeleteDirectory( sTempDir, FileIO.DeleteDirectoryOption.DeleteAllContents) + My.Computer.FileSystem.DeleteDirectory(sTempDir, FileIO.DeleteDirectoryOption.DeleteAllContents) Return End If ' Verifico la versione del Beam e se più vecchia chiedo cosa fare If String.Compare(sNewVer, sBeamVer) < 0 Then ' La versione del nuovo modulo "{0}" è più vecchia dell'attuale. Vuoi sovrascrivere lo stesso ? Dim sOut As String = String.Format(EgtMsg(6558), "Beam") - if MessageBox.Show(Application.Current.MainWindow, sOut, EgtMsg(15003), MessageBoxButton.YesNo, MessageBoxImage.Question) = MessageBoxResult.No Then + If MessageBox.Show(Application.Current.MainWindow, sOut, EgtMsg(15003), MessageBoxButton.YesNo, MessageBoxImage.Question) = MessageBoxResult.No Then ' Rimuovo il direttorio temporaneo ed esco - My.Computer.FileSystem.DeleteDirectory( sTempDir, FileIO.DeleteDirectoryOption.DeleteAllContents) + My.Computer.FileSystem.DeleteDirectory(sTempDir, FileIO.DeleteDirectoryOption.DeleteAllContents) Return End If End If ' Faccio una copia di backup del Beam corrente Dim sBackupDir As String = IniFile.m_sBeamDirPath & ".old" - If My.Computer.FileSystem.DirectoryExists( sBackupDir) Then - My.Computer.FileSystem.DeleteDirectory( sBackupDir, FileIO.DeleteDirectoryOption.DeleteAllContents) + If My.Computer.FileSystem.DirectoryExists(sBackupDir) Then + My.Computer.FileSystem.DeleteDirectory(sBackupDir, FileIO.DeleteDirectoryOption.DeleteAllContents) End If Try - My.Computer.FileSystem.MoveDirectory( IniFile.m_sBeamDirPath, sBackupDir, True) + My.Computer.FileSystem.MoveDirectory(IniFile.m_sBeamDirPath, sBackupDir, True) Catch ex As Exception ' Ripristino lo stato originale ed esco - My.Computer.FileSystem.MoveDirectory( sBackupDir, IniFile.m_sBeamDirPath, True) + My.Computer.FileSystem.MoveDirectory(sBackupDir, IniFile.m_sBeamDirPath, True) ' L'aggiornamento del modulo "{0}" non è riuscito. - Errore Dim sOut As String = String.Format(EgtMsg(6559), "Beam") - EgtOutLog( sOut) + EgtOutLog(sOut) MessageBox.Show(Application.Current.MainWindow, sOut, EgtMsg(15001), MessageBoxButton.OK, MessageBoxImage.Error) ' Rimuovo il direttorio temporaneo ed esco - My.Computer.FileSystem.DeleteDirectory( sTempDir, FileIO.DeleteDirectoryOption.DeleteAllContents) + My.Computer.FileSystem.DeleteDirectory(sTempDir, FileIO.DeleteDirectoryOption.DeleteAllContents) Return End Try ' Installo il Beam - My.Computer.FileSystem.MoveDirectory( sTempDir, IniFile.m_sBeamDirPath, True) + My.Computer.FileSystem.MoveDirectory(sTempDir, IniFile.m_sBeamDirPath, True) ' Il modulo "{0}" è stata aggiornato con successo. - Info Dim sOk As String = String.Format(EgtMsg(6560), "Beam") - EgtOutLog( sOk) + EgtOutLog(sOk) MessageBox.Show(Application.Current.MainWindow, sOk, EgtMsg(15003), MessageBoxButton.OK) End Sub @@ -1495,10 +1521,10 @@ Public Class OptionWindowVM Dim sExeVer As String = IniFile.GetProgramVersion() ' Verifico presenza di una precedente installazione del Wall Dim sWallVer As String = "" - IniFile.GetSpecialLuaVersion( IniFile.m_sWallDirPath, sWallVer) - If String.IsNullOrEmpty( sWallVer) Then + IniFile.GetSpecialLuaVersion(IniFile.m_sWallDirPath, sWallVer) + If String.IsNullOrEmpty(sWallVer) Then ' Il modulo "{0}" non è stato trovato, impossibile aggiornare. - Avviso - Dim sOut As String = String.Format(EgtMsg(6555), "Wall") + Dim sOut As String = String.Format(EgtMsg(6555), "Wall") MessageBox.Show(Application.Current.MainWindow, sOut, EgtMsg(15002), MessageBoxButton.OK, MessageBoxImage.Warning) ' Esco Return @@ -1514,26 +1540,26 @@ Public Class OptionWindowVM Dim sWallZip As String = WallDlg.FileName ' Preparo direttorio temporaneo Dim sTempDir As String = Path.Combine(IniFile.m_sTempDir, "Wall") - If My.Computer.FileSystem.DirectoryExists( sTempDir) Then - My.Computer.FileSystem.DeleteDirectory( sTempDir, FileIO.DeleteDirectoryOption.DeleteAllContents) + If My.Computer.FileSystem.DirectoryExists(sTempDir) Then + My.Computer.FileSystem.DeleteDirectory(sTempDir, FileIO.DeleteDirectoryOption.DeleteAllContents) End If - My.Computer.FileSystem.CreateDirectory( sTempDir) + My.Computer.FileSystem.CreateDirectory(sTempDir) ' Unzip nel direttorio temporaneo Using zip As New Ionic.Zip.ZipFile(sWallZip) - zip.ExtractAll( sTempDir, Ionic.Zip.ExtractExistingFileAction.DoNotOverwrite) + zip.ExtractAll(sTempDir, Ionic.Zip.ExtractExistingFileAction.DoNotOverwrite) End Using ' Recupero i dati del nuovo Wall Dim sNewName = "" Dim sNewVer = "" Dim sNewMinExe = "" - IniFile.GetSpecialLuaData( sTempDir, sNewName, sNewVer, sNewMinExe) + IniFile.GetSpecialLuaData(sTempDir, sNewName, sNewVer, sNewMinExe) ' Verifico che sia veramente il Wall If String.Compare(sNewName, "Wall") <> 0 Then ' Il file zip non contiene il modulo "{0}". - Avviso - Dim sOut As String = String.Format(EgtMsg(6556), "Wall") + Dim sOut As String = String.Format(EgtMsg(6556), "Wall") MessageBox.Show(Application.Current.MainWindow, sOut, EgtMsg(15002), MessageBoxButton.OK, MessageBoxImage.Warning) ' Rimuovo il direttorio temporaneo ed esco - My.Computer.FileSystem.DeleteDirectory( sTempDir, FileIO.DeleteDirectoryOption.DeleteAllContents) + My.Computer.FileSystem.DeleteDirectory(sTempDir, FileIO.DeleteDirectoryOption.DeleteAllContents) Return End If ' Verifico la versione minima del programma @@ -1542,42 +1568,42 @@ Public Class OptionWindowVM Dim sOut As String = String.Format(EgtMsg(6557), "Wall", sNewMinExe) MessageBox.Show(Application.Current.MainWindow, sOut, EgtMsg(15002), MessageBoxButton.OK, MessageBoxImage.Warning) ' Rimuovo il direttorio temporaneo ed esco - My.Computer.FileSystem.DeleteDirectory( sTempDir, FileIO.DeleteDirectoryOption.DeleteAllContents) + My.Computer.FileSystem.DeleteDirectory(sTempDir, FileIO.DeleteDirectoryOption.DeleteAllContents) Return End If ' Verifico la versione del Wall e se più vecchia chiedo cosa fare If String.Compare(sNewVer, sWallVer) < 0 Then ' La versione del nuovo modulo "{0}" è più vecchia dell'attuale. Vuoi sovrascrivere lo stesso ? Dim sOut As String = String.Format(EgtMsg(6558), "Wall") - if MessageBox.Show(Application.Current.MainWindow, sOut, EgtMsg(15003), MessageBoxButton.YesNo, MessageBoxImage.Question) = MessageBoxResult.No Then + If MessageBox.Show(Application.Current.MainWindow, sOut, EgtMsg(15003), MessageBoxButton.YesNo, MessageBoxImage.Question) = MessageBoxResult.No Then ' Rimuovo il direttorio temporaneo ed esco - My.Computer.FileSystem.DeleteDirectory( sTempDir, FileIO.DeleteDirectoryOption.DeleteAllContents) + My.Computer.FileSystem.DeleteDirectory(sTempDir, FileIO.DeleteDirectoryOption.DeleteAllContents) Return End If End If ' Faccio una copia di backup del Wall corrente Dim sBackupDir As String = IniFile.m_sWallDirPath & ".old" - If My.Computer.FileSystem.DirectoryExists( sBackupDir) Then - My.Computer.FileSystem.DeleteDirectory( sBackupDir, FileIO.DeleteDirectoryOption.DeleteAllContents) + If My.Computer.FileSystem.DirectoryExists(sBackupDir) Then + My.Computer.FileSystem.DeleteDirectory(sBackupDir, FileIO.DeleteDirectoryOption.DeleteAllContents) End If Try - My.Computer.FileSystem.MoveDirectory( IniFile.m_sWallDirPath, sBackupDir, True) + My.Computer.FileSystem.MoveDirectory(IniFile.m_sWallDirPath, sBackupDir, True) Catch ex As Exception ' Ripristino lo stato originale ed esco - My.Computer.FileSystem.MoveDirectory( sBackupDir, IniFile.m_sWallDirPath, True) + My.Computer.FileSystem.MoveDirectory(sBackupDir, IniFile.m_sWallDirPath, True) ' L'aggiornamento del modulo "{0}" non è riuscito. - Errore Dim sOut As String = String.Format(EgtMsg(6559), "Wall") - EgtOutLog( sOut) + EgtOutLog(sOut) MessageBox.Show(Application.Current.MainWindow, sOut, EgtMsg(15001), MessageBoxButton.OK, MessageBoxImage.Error) ' Rimuovo il direttorio temporaneo ed esco - My.Computer.FileSystem.DeleteDirectory( sTempDir, FileIO.DeleteDirectoryOption.DeleteAllContents) + My.Computer.FileSystem.DeleteDirectory(sTempDir, FileIO.DeleteDirectoryOption.DeleteAllContents) Return End Try ' Installo il Wall - My.Computer.FileSystem.MoveDirectory( sTempDir, IniFile.m_sWallDirPath, True) + My.Computer.FileSystem.MoveDirectory(sTempDir, IniFile.m_sWallDirPath, True) ' Il modulo "{0}" è stata aggiornato con successo. - Info Dim sOk As String = String.Format(EgtMsg(6560), "Wall") - EgtOutLog( sOk) + EgtOutLog(sOk) MessageBox.Show(Application.Current.MainWindow, sOk, EgtMsg(15003), MessageBoxButton.OK) End Sub @@ -1665,4 +1691,29 @@ Public Class GeomTypeConverter Throw New NotImplementedException End Function +End Class + +Public Class VMillTypeConverter + Implements IValueConverter + + Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object Implements IValueConverter.Convert + Select Case CInt(value) + Case VMillSelTypeOpt.POOR + Return EgtMsg(31215) + Case VMillSelTypeOpt.LOW + Return EgtMsg(31216) + Case VMillSelTypeOpt.STANDARD + Return EgtMsg(31217) + Case VMillSelTypeOpt.BETTER + Return EgtMsg(31218) + Case VMillSelTypeOpt.HIGH + Return EgtMsg(31219) + Case Else + Return "" + End Select + End Function + + Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object Implements IValueConverter.ConvertBack + Throw New NotImplementedException() + End Function End Class \ No newline at end of file diff --git a/Utility/IniFile.vb b/Utility/IniFile.vb index f56ff77..c88edf1 100644 --- a/Utility/IniFile.vb +++ b/Utility/IniFile.vb @@ -34,6 +34,14 @@ Public Module IniFile MACHPATH = 5 End Enum + Public Enum VMillSelTypeOpt As Integer + POOR = -2 + LOW = -1 + STANDARD = 0 + BETTER = 1 + HIGH = 2 + End Enum + ' MainWindow Page Friend m_nInstance As Integer = 0 Friend m_nUserLevel As Integer = 1 From cdc9caf4ee899e650a7cf513ae1037d6a8281b4d Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Mon, 30 Sep 2024 15:10:26 +0200 Subject: [PATCH 04/36] =?UTF-8?q?EgtCAM5=20:=20-=20piccole=20modifiche=20i?= =?UTF-8?q?n=20Opzioni=20per=20qualit=C3=A0=20VM.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OptionsWindow/OptionWindowV.xaml | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/OptionsWindow/OptionWindowV.xaml b/OptionsWindow/OptionWindowV.xaml index a44fb65..82e21da 100644 --- a/OptionsWindow/OptionWindowV.xaml +++ b/OptionsWindow/OptionWindowV.xaml @@ -314,15 +314,6 @@ - - - - - - - - @@ -334,15 +325,25 @@ + + + + + + + + + - - - + +