diff --git a/AboutBoxWindow/AboutBoxViewModel.vb b/AboutBoxWindow/AboutBoxViewModel.vb index ac88907..2878733 100644 --- a/AboutBoxWindow/AboutBoxViewModel.vb +++ b/AboutBoxWindow/AboutBoxViewModel.vb @@ -1,65 +1,62 @@ Imports System.ComponentModel -Namespace EgtCAM5 - Public Class AboutBoxViewModel - Implements INotifyPropertyChanged - 'Inherits ViewModelBase +Public Class AboutBoxViewModel + Implements INotifyPropertyChanged + 'Inherits ViewModelBase - Private m_AboutBoxVisibility As Visibility - Public Property AboutBoxVisibility As Visibility - Get - Return m_AboutBoxVisibility - End Get - Set(value As Visibility) - If value <> m_AboutBoxVisibility Then - m_AboutBoxVisibility = value - NotifyPropertyChanged("AboutBoxVisibility") - End If - End Set - End Property - ' Definizione comandi - Private m_cmdClose As ICommand + Private m_AboutBoxVisibility As Visibility + Public Property AboutBoxVisibility As Visibility + Get + Return m_AboutBoxVisibility + End Get + Set(value As Visibility) + If value <> m_AboutBoxVisibility Then + m_AboutBoxVisibility = value + NotifyPropertyChanged("AboutBoxVisibility") + End If + End Set + End Property + ' Definizione comandi + Private m_cmdClose As ICommand #Region "COMMANDS" #Region "CloseCommand" - ''' - ''' Returns a command that do Point. - ''' - Public ReadOnly Property CloseCommand As ICommand - Get - If m_cmdClose Is Nothing Then - m_cmdClose = New Command(AddressOf Close, AddressOf CanClose) - End If - Return m_cmdClose - End Get - End Property + ''' + ''' Returns a command that do Point. + ''' + Public ReadOnly Property CloseCommand As ICommand + Get + If m_cmdClose Is Nothing Then + m_cmdClose = New Command(AddressOf Close, AddressOf CanClose) + End If + Return m_cmdClose + End Get + End Property - ''' - ''' Execute the Point. This method is invoked by the PointCommand. - ''' - Public Sub Close(ByVal param As Object) - AboutBoxVisibility = Visibility.Hidden - End Sub + ''' + ''' Execute the Point. This method is invoked by the PointCommand. + ''' + Public Sub Close(ByVal param As Object) + AboutBoxVisibility = Visibility.Hidden + End Sub - ''' - ''' Returns always true. - ''' - Private Function CanClose(ByVal param As Object) As Boolean - Return True - End Function + ''' + ''' Returns always true. + ''' + Private Function CanClose(ByVal param As Object) As Boolean + Return True + End Function #End Region ' CloseCommand #End Region ' Commands - Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged + Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged - Public Sub NotifyPropertyChanged(propName As String) - RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propName)) - End Sub - End Class - -End Namespace \ No newline at end of file + Public Sub NotifyPropertyChanged(propName As String) + RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propName)) + End Sub +End Class diff --git a/Constants/ConstGen.vb b/Constants/ConstGen.vb index 76cf966..93fabbb 100644 --- a/Constants/ConstGen.vb +++ b/Constants/ConstGen.vb @@ -39,6 +39,8 @@ Module ConstGen Public Const SAVE_DFL_NAMEDIR As String = "MyProjects" ' sottodirettorio Help Public Const HELP_DIR As String = "Help" + ' sottodirettorio Template + Public Const TEMPLATE_DIR As String = "Template" ' File ddf utilizzato per il disegno corrente Public Const TEMP_FILE As String = "CurrDoor.ddf" Public Const TEMP_FILE_TXT As String = "CurrDoor.txt" diff --git a/DoorManager/DoorManagerViewModel.vb b/DoorManager/DoorManagerViewModel.vb index e4b9b57..97942ff 100644 --- a/DoorManager/DoorManagerViewModel.vb +++ b/DoorManager/DoorManagerViewModel.vb @@ -32,112 +32,6 @@ Public Class DoorManagerViewModel Set(value As String) m_SelectedDoor = value NotifyPropertyChanged("SelectedDoor") - 'Dim Index As Integer = -1 - - 'If IsNothing(value) Then Return - '' riferimento alla porta (per stampare il DDF) - 'Dim DoorParametersViewModel As DoorParametersViewModel = DirectCast(m_rfMainWindowViewModel.DoorParameters.DataContext, DoorParametersViewModel) - '' se eiste il file selezionato - 'If File.Exists(m_SelectedDoor) Then - ' ' prima di cambiare porta selezionata chiedo il salvataggio il quella precedente - ' ' se esiste una porta corrente associata al nome allora scrivo il file ddf per il disegno - ' If Not IsNothing(DoorParametersViewModel.CurrDoor) Then - ' ' è necessario che il file passato alla grafica non presenti espressioni numeriche - ' DdfFile.WriteDDF(DoorParametersViewModel.CurrDoor, IniFile.m_sTempDir & "\CurrDoor.ddf", True) - - ' Select Case DeleteNewDoor - ' ' se è una porta appena creata - ' Case 0 - ' ' chiedo se deve essere eliminata la porta che era stata creata - ' RemoveDoor() - ' DeleteNewDoor = 1 - ' ' se è una porta "vecchia" - ' Case 1 - ' ' confronto il file della porta originale e quello aggiornato: se i due file sono uguali eccetto la data - ' ' non faccio nulla - ' If DdfFile.SetModify(m_rfMainWindowViewModel) Then - - ' Else - ' ' altrimenti chiedo di salvare il file di disegno - ' MsgResult = MessageBox.Show(String.Format(EgtMsg(50109), Path.GetFileNameWithoutExtension(m_SelectedDoor)), EgtMsg(50110), MessageBoxButton.YesNoCancel, MessageBoxImage.Warning) - ' If MsgResult = MessageBoxResult.Yes Then - ' DdfFile.WriteDDF(DoorParametersViewModel.CurrDoor, m_SelectedDoor, True) - ' DirectCast(m_rfMainWindowViewModel.DoorParameters.DataContext, DoorParametersViewModel).bSetChange = False - ' ElseIf MsgResult = MessageBoxResult.Cancel Then - - ' NotifyPropertyChanged("SelectedDoor") - ' Exit Property - ' ElseIf MsgResult = MessageBoxResult.No Then - ' RemoveDoor() - ' End If - ' End If - - ' End Select - ' End If - 'End If - '' tolgo l'* dal titolo a prescindere che il file sia stato o no salvato - 'Dim SetTitle = DirectCast(m_rfMainWindowViewModel.DoorParameters.DataContext, DoorParametersViewModel).CurrProject.Name - 'm_rfMainWindowViewModel.ProjectNameMsg = SetTitle - '' se non esisteva nessuna porta allora posso procedere - 'm_SelectedDoor = value - 'NotifyPropertyChanged("SelectedDoor") - 'SelDoor = Nothing - 'SelDoor = New Door - 'SelDoor.NewDoor = NewDoor - 'If SelDoor.NewDoor Then - ' 'OptionModule.GeneralDoor.CompoList.Clear() - ' SelDoor.Width = OptionModule.m_Width - ' SelDoor.Height = OptionModule.m_Height - ' SelDoor.Thickness = OptionModule.m_Thickness - ' SelDoor.Weight = OptionModule.m_Weight - ' SelDoor.Swing = OptionModule.m_Swing - - ' SelDoor.LockEdgeType = OptionModule.m_LockEdgeType - ' SelDoor.HingeEdgeType = OptionModule.m_HingeEdgeType - ' SelDoor.TopType = OptionModule.m_TopType - ' SelDoor.BottomType = OptionModule.m_BottomType - - ' SelDoor.LockEdgeMachining = OptionModule.m_LockEdgeMachining - ' SelDoor.HingeEdgeMachining = OptionModule.m_HingeEdgeMachining - ' SelDoor.TopMachining = OptionModule.m_TopMachining - ' SelDoor.BottomMachining = OptionModule.m_BottomMachining - ' SelDoor.LockEdgeOverMaterial = OptionModule.m_LockEdgeOverMaterial - ' SelDoor.HingeEdgeOverMaterial = OptionModule.m_HingeEdgeOverMaterial - ' SelDoor.TopOverMaterial = OptionModule.m_TopOverMaterial - ' SelDoor.BottomOverMaterial = OptionModule.m_BottomOverMaterial - ' ' assegno la porta creata alla Programma come porta corrente - ' DoorParametersViewModel.CurrDoor = SelDoor - ' ' scrivo il ddf della nuova porta come file temp - ' If Not IsNothing(DoorParametersViewModel.CurrDoor) Then DdfFile.WriteDDF(DoorParametersViewModel.CurrDoor, IniFile.m_sTempDir & "\CurrDoor.ddf", True) - ' ' e stampo il nuovo ddf - ' DdfFile.WriteDDF(DoorParametersViewModel.CurrDoor, m_SelectedDoor, True) - ' ' quindi da ora la nuova porta ha un suo DDF che possiamo trattare come tutti gli altri - ' ' assegno il valore falso cosi da non ripetere questa operazione nel caso in cui si arrivi dalla funzione AddDoor - ' SelDoor.NewDoor = True - ' NewDoor = False - 'End If - '' per aggiornare la parte grafica - '' se il nome della porta è uno spazio vuoto allora non genero la porta ( per esempio sto aprendo una cartella vuota) - 'If Not String.IsNullOrWhiteSpace(m_SelectedDoor) Then - ' ' leggo il file ddf - ' Door.ReadDDF(m_SelectedDoor, SelDoor) - ' ' assegno come porta del programma quella aperta - ' DoorParametersViewModel.CurrDoor = SelDoor - ' ' copio il file DDF come file DDF temporaneo - ' If Not IsNothing(DoorParametersViewModel.CurrDoor) Then - ' DdfFile.WriteDDF(SelDoor, IniFile.m_sTempDir & "\CurrDoor.ddf", True) - ' ExecDoors(DirectCast(m_rfMainWindowViewModel.SceneManager.DataContext, SceneManagerViewModel).ProjectScene, IniFile.m_sTempDir & "\CurrDoor.ddf") - ' ' dal MainWindowViewModel accediamo alla ScenaManagerViewModel (primo DirectCast) - ' ' dalla StatusBar accediamo alla proprietà pubblica UnitMeasure - ' DirectCast(DirectCast(m_rfMainWindowViewModel.SceneManager.DataContext, SceneManagerViewModel).StatusBar.DataContext, StatusBarViewModel).UnitMeasure = SelDoor.Measure - ' End If - 'End If - 'If IsNothing(SelDoor) Then - ' MessageBox.Show(EgtMsg(50145), EgtMsg(50118), MessageBoxButton.OK, MessageBoxImage.Exclamation) - ' DoorParametersViewModel.CurrDoor = Nothing - ' DeleteDoorFromList() - 'End If - End Set End Property @@ -198,6 +92,10 @@ Public Class DoorManagerViewModel ' riferimento alla porta (per stampare il DDF) Dim DoorParametersViewModel As DoorParametersViewModel = DirectCast(m_rfMainWindowViewModel.DoorParameters.DataContext, DoorParametersViewModel) ' se eiste il file selezionato + If value = m_SelectedDoor Then + Return True + Exit Function + End If If File.Exists(m_SelectedDoor) Then ' prima di cambiare porta selezionata chiedo il salvataggio il quella precedente ' se esiste una porta corrente associata al nome allora scrivo il file ddf per il disegno @@ -327,6 +225,8 @@ Public Class DoorManagerViewModel If MessageBox.Show(EgtMsg(50146), EgtMsg(50110), MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.Yes) = MessageBoxResult.Yes Then ' Apro la finestra di dailogo aperta direttamente sulla cartella cercata Dim OpenFileDialog As New System.Windows.Forms.OpenFileDialog + + OpenFileDialog.InitialDirectory = IniFile.m_TemplateDir If OpenFileDialog.ShowDialog <> Forms.DialogResult.OK Then ' se la risposta è diversa da OK esce diff --git a/DoorParameters/Door.vb b/DoorParameters/Door.vb index 3670bce..deea63b 100644 --- a/DoorParameters/Door.vb +++ b/DoorParameters/Door.vb @@ -607,7 +607,12 @@ Public Class Door ' Genero una nuova porta da usare nella lettura di un DDF Private FileContent As String() Shared Sub ReadDDF(sPathDDF As String, ByRef ReadDoor As Door) - + If Not Directory.Exists(IniFile.m_CompoDir) Then + EgtOutLog("CompoDir not found : " & IniFile.m_CompoDir) + MessageBox.Show("CompoDir not found : " & IniFile.m_CompoDir, "ERROR!", MessageBoxButton.OK, MessageBoxImage.Error) + End + Return + End If ReadDoor.m_IsModifyDoor = False 'm_Door = ReadDoor ' restituisce un problema nella lettura di un valore della compo @@ -782,7 +787,7 @@ Public Class Door Exit For End If Next - + ' quando finisce la lettura di tutte le righe esci dal ciclo If Not String.IsNullOrWhiteSpace(InvalidValue) Then MessageBox.Show(InvalidValue, EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error) diff --git a/EgtDOORCreator.vbproj b/EgtDOORCreator.vbproj index c723777..a52381a 100644 --- a/EgtDOORCreator.vbproj +++ b/EgtDOORCreator.vbproj @@ -12,9 +12,24 @@ v4.0 Custom Client + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.%2a + false + false + true - On + Off Binary @@ -352,6 +367,28 @@ + + + False + Microsoft .NET Framework 4 Client Profile %28x86 and x64%29 + true + + + False + .NET Framework 3.5 SP1 Client Profile + false + + + False + .NET Framework 3.5 SP1 + false + + + False + Windows Installer 4.5 + true + + IF "$(PlatformName)"=="x86" IF "$(ConfigurationName)" == "Release" copy $(TargetPath) c:\EgtProg\EgtDOORCreator\EgtDOORCreatorR32.exe diff --git a/IniFile.vb b/IniFile.vb index 11c1cc1..87c7d52 100644 --- a/IniFile.vb +++ b/IniFile.vb @@ -35,9 +35,11 @@ Friend Module IniFile Friend m_TemplateDir As String = String.Empty ' Path Compo directory Friend m_CompoDir As String = String.Empty + ' Path Help directory Friend m_sHelpDir As String = String.Empty - ' Path del file ddf + ' Path del file ddf --> nome file della porta corrente Friend m_DDFFilePath As String = String.Empty + Friend m_sDoorsDirPath As String = String.Empty ' IniFile diff --git a/MainWindow/MainWindowModel.vb b/MainWindow/MainWindowModel.vb index fdccb10..4259f7f 100644 --- a/MainWindow/MainWindowModel.vb +++ b/MainWindow/MainWindowModel.vb @@ -37,10 +37,16 @@ Friend Class MainWindowModel IniFile.m_sConfigDir = m_sDataRoot & "\" & CONF_DIR ' Impostazione direttorio per file temporanei IniFile.m_sTempDir = m_sDataRoot & "\" & TEMP_DIR - ' Impostazione path Ini file + ' Impostazione direttorio Ini file IniFile.m_sIniFile = IniFile.m_sConfigDir & "\" & INI_FILE_NAME - ' Impostazoione path della cartella Help + ' Impostazoione direttorio della cartella Help IniFile.m_sHelpDir = m_sDataRoot & "\" & HELP_DIR + + '' Impostazoione direttorio della cartella Template + IniFile.m_TemplateDir = m_sDataRoot & "\" & TEMPLATE_DIR + ' Impostazoione direttorio della cartella MyProject di default + IniFile.m_MyProjectDir = m_sDataRoot & "\" & SAVE_DFL_NAMEDIR + ' Verifico indice di istanza ManageIstance() ' Imposto tipo di chiave diff --git a/My Project/AssemblyInfo.vb b/My Project/AssemblyInfo.vb index 17a95dd..c5836f9 100644 --- a/My Project/AssemblyInfo.vb +++ b/My Project/AssemblyInfo.vb @@ -72,5 +72,5 @@ Imports System.Windows ' by using the '*' as shown below: ' - - + + diff --git a/OptionsWindow/OptionModule.vb b/OptionsWindow/OptionModule.vb index 6703e66..4eac6a4 100644 --- a/OptionsWindow/OptionModule.vb +++ b/OptionsWindow/OptionModule.vb @@ -1,5 +1,6 @@ Imports System.Collections.ObjectModel Imports EgtUILib +Imports System.IO Friend Module OptionModule @@ -96,12 +97,34 @@ Friend Module OptionModule ' leggo il direttorio di salvataggio dei progetti Dim sMyProjectDir As String = String.Empty If GetPrivateProfileString(S_DOORS, K_MYPROJECTDIR, "", sMyProjectDir) <> 0 Then - IniFile.m_MyProjectDir = sMyProjectDir + ' se non esiste il direttorio + If Not Directory.Exists(sMyProjectDir) Then + ' manntego l'accesso a quello di default + EgtOutLog("Warning : " & sMyProjectDir & " does not exist") + ' controllo che il direttorio che era stato passato di default esista + If Not Directory.Exists(IniFile.m_MyProjectDir) Then + ' creo il direttorio + Directory.CreateDirectory(IniFile.m_MyProjectDir) + End If + Else + IniFile.m_MyProjectDir = sMyProjectDir + End If End If Dim sTemplateDir As String = String.Empty If GetPrivateProfileString(S_DOORS, K_TEMPLATEDIR, "", sTemplateDir) <> 0 Then - IniFile.m_TemplateDir = sTemplateDir + ' se non esiste il direttorio + If Not Directory.Exists(sTemplateDir) Then + ' manntego l'accesso a quello di default + EgtOutLog("Warning : " & sTemplateDir & " does not exist") + ' controllo che il direttorio che era stato passato di default esista + If Not Directory.Exists(IniFile.m_TemplateDir) Then + ' creo il direttorio + Directory.CreateDirectory(IniFile.m_TemplateDir) + End If + Else + IniFile.m_TemplateDir = sTemplateDir + End If End If ' leggo il tipo di Bevel selezionato diff --git a/ProjectManager/ProjectManagerViewModel.vb b/ProjectManager/ProjectManagerViewModel.vb index 6a4a462..f6caedf 100644 --- a/ProjectManager/ProjectManagerViewModel.vb +++ b/ProjectManager/ProjectManagerViewModel.vb @@ -169,11 +169,11 @@ Public Class ProjectManagerViewModel ' Ripulisco lista porte CurrProject.DoorList.Clear() ' se una porta è già aperta - If Not String.IsNullOrWhiteSpace(DirectCast(m_rfMainWindowViewModel.DoorManager.DataContext, DoorManagerViewModel).SelectedDoor) Then - DirectCast(m_rfMainWindowViewModel.DoorParameters.DataContext, DoorParametersViewModel).CurrDoor = Nothing - ' assegno all'inidirizzo della porta uno spazio vuoto - DirectCast(m_rfMainWindowViewModel.DoorManager.DataContext, DoorManagerViewModel).SelectedDoor = Nothing - End If + 'If String.IsNullOrWhiteSpace(DirectCast(m_rfMainWindowViewModel.DoorManager.DataContext, DoorManagerViewModel).SelectedDoor) Then + DirectCast(m_rfMainWindowViewModel.DoorParameters.DataContext, DoorParametersViewModel).CurrDoor = Nothing + '' assegno all'inidirizzo della porta uno spazio vuoto + 'DirectCast(m_rfMainWindowViewModel.DoorManager.DataContext, DoorManagerViewModel).SelectedDoor = Nothing + 'End If EgtNewFile() EgtZoom(ZM.ALL) ' Notifico aggiornamento DoorList e Name per aggiornare la grafica @@ -532,6 +532,7 @@ Public Class ProjectManagerViewModel Dim SaveFileDialog As New EgtWPFLib5.EgtSaveFileDialog SaveFileDialog.Title = K_NEWTEMPLATE + SaveFileDialog.Directory = IniFile.m_TemplateDir & "\" SaveFileDialog.Extension = K_DDTEXTENSION 'SaveFileDialog.FileName = m_CurrProject.Name & "\"