diff --git a/AssemblyManager/AssemblyManagerV.xaml b/AssemblyManager/AssemblyManagerV.xaml index c8a6254..0f61dc7 100644 --- a/AssemblyManager/AssemblyManagerV.xaml +++ b/AssemblyManager/AssemblyManagerV.xaml @@ -23,8 +23,9 @@ + SelectedItem="{Binding CurrProject.SelAssemblyName,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" + Style="{StaticResource DoorListBox}" Name="AssemblyList" Grid.ColumnSpan="2" Margin="0,0,28,0.4" Grid.RowSpan="2"> + @@ -52,7 +53,7 @@ Style="{StaticResource {x:Type ToggleButton}}" IsChecked="{Binding Path=IsSelected, RelativeSource={ RelativeSource AncestorType={x:Type ListBoxItem}}}"> - + diff --git a/AssemblyManager/AssemblyManagerV.xaml.vb b/AssemblyManager/AssemblyManagerV.xaml.vb index 14a607c..ed7cf55 100644 --- a/AssemblyManager/AssemblyManagerV.xaml.vb +++ b/AssemblyManager/AssemblyManagerV.xaml.vb @@ -3,18 +3,21 @@ Private Sub Door_MouseLeftButtonUp(sender As Object, e As MouseButtonEventArgs) Dim Item As ListBoxItem = DirectCast(sender, ListBoxItem) ' Gestisco porta corrente modificata - Dim IsModified As Boolean = Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified - If Not Map.refAssemblyManagerVM.ManageModified() Then + If Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified + If Not Map.refAssemblyManagerVM.ManageModified() Then + Return + End If + Item.IsSelected=Not Map.refAssemblyManagerVM.CurrProject.IsBlockedSelAssemblyName(DirectCast(Item.DataContext, AssemblyName)) Return End If ' verifico se il progetto cliccato è quello già selezionato - If Map.refAssemblyManagerVM.CurrProject.SelAssemblyName Is DirectCast(Item.DataContext, AssemblyName) Then - ' ricarico la porta - Map.refAssemblyManagerVM.Open(DirectCast(Item.DataContext, AssemblyName)) - End If - If IsModified Then - Map.refAssemblyManagerVM.CurrProject.SelAssemblyName = DirectCast(Item.DataContext, AssemblyName) - End If + 'If Map.refAssemblyManagerVM.CurrProject.SelAssemblyName Is DirectCast(Item.DataContext, AssemblyName) Then + ' ricarico la porta + e.Handled= Map.refAssemblyManagerVM.CurrProject.IsBlockedSelAssemblyName(DirectCast(Item.DataContext, AssemblyName)) + 'End If + 'If IsModified Then + ' Map.refAssemblyManagerVM.CurrProject.SelAssemblyName = DirectCast(Item.DataContext, AssemblyName) + 'End If End Sub End Class diff --git a/AssemblyManager/AssemblyManagerVM.vb b/AssemblyManager/AssemblyManagerVM.vb index 8952892..3aa0276 100644 --- a/AssemblyManager/AssemblyManagerVM.vb +++ b/AssemblyManager/AssemblyManagerVM.vb @@ -938,6 +938,8 @@ Public Class AssemblyManagerVM Public Sub Delete(DeleteAssName As AssemblyName) ' Se il file esiste eliminalo + Utility.OutLog("Chiudo progetto") + Utility.UnLockDir() If File.Exists(DeleteAssName.Name) Then Try File.Delete(DeleteAssName.Name) @@ -961,13 +963,19 @@ Public Class AssemblyManagerVM If SelIndex > m_CurrProject.AssemblyList.Count - 1 Then m_CurrProject.SelAssemblyName = m_CurrProject.AssemblyList(m_CurrProject.AssemblyList.Count - 1) Open(m_CurrProject.SelAssemblyName) + Utility.OutLog("Apro Progetto: " & m_CurrProject.SelAssemblyName.Name) + Utility.LockDir(m_CurrProject.Name, m_CurrProject.SelAssemblyName.GraphicName) Else m_CurrProject.SelAssemblyName = m_CurrProject.AssemblyList(SelIndex) Open(m_CurrProject.SelAssemblyName) + Utility.OutLog("Apro Progetto: " & m_CurrProject.SelAssemblyName.Name) + Utility.LockDir(m_CurrProject.Name, m_CurrProject.SelAssemblyName.GraphicName) End If ' se non ci sono altre porte nella lista allora Else Dim LastProject As String = m_CurrProject.Name + ' confermo che non devono essere prese inconsiderazione le modifiche + m_CurrProject.SelAssemblyName.IsModified = False ' elimino qualsiasi resto di porta m_CurrProject.SelAssemblyName = Nothing ' pulisco entry page @@ -1226,6 +1234,8 @@ Public Class AssemblyManagerVM Local_PartDoor.IsChecked = True CreateNewPropertiesList(Local_PartDoor.Door.PropertiesList, Local_PartDoor.Door.SelectedMaterial) CurrAssembly.ListPartDoor.Add(Local_PartDoor) + Else + CurrAssembly.ListPartDoor.Add(ReserchPartDoor(Type)) End If Next @@ -1516,11 +1526,20 @@ Public Class AssemblyManagerVM Else SaveFileDialog.FileName &= DDF_EXTENSION End If + ' verifico che non sia bloccato (in fase di creazione di una nuova porta posso avere il file .lck senza il ddf) + If Utility.IsFileLocked(Path.GetDirectoryName(SaveFileDialog.FileName), Path.GetFileNameWithoutExtension(SaveFileDialog.FileName)) then + If Not IsNothing(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName) Then + Utility.OutLog("Apertura progetto : " & Map.refAssemblyManagerVM.CurrProject.Name) + Utility.LockDir(Map.refAssemblyManagerVM.CurrProject.Name, Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.GraphicName) + End If + Return + End If + ' controllo che il nome non sia presente nella lista degli assemblati Dim bNameExist As Boolean = False Dim IndexDoorList As Integer For IndexDoorList = 0 To m_CurrProject.AssemblyList.Count - 1 - If m_CurrProject.AssemblyList(IndexDoorList).Name = SaveFileDialog.FileName Then + If m_CurrProject.AssemblyList(IndexDoorList).Name.ToLower = SaveFileDialog.FileName.ToLower Then ' se il nome è nella lista allora esco dal ciclo e rendo falsa la variabile bNameExist bNameExist = True Exit For @@ -1551,10 +1570,17 @@ Public Class AssemblyManagerVM ' aggiorno la lista '------------------------------------------------------------------------------------------------------------------------------------------------ ' LETTURA DI UN FILE DI TIPO TEMPLATE - If ImportTemplate(sImportTemplate) Then Return + If ImportTemplate(sImportTemplate) Then + Utility.OutLog("Apertura progetto : " & Local_AssemblyName.Name) + Utility.LockDir(Path.GetDirectoryName(Local_AssemblyName.Name), Path.GetFileNameWithoutExtension(Local_AssemblyName.Name)) + Return + End If + '------------------------------------------------------------------------------------------------------------------------------------------------ ' Creo nuovo assembly (Solo se non ho importato un template!) NewCmd(Local_AssemblyName) + Utility.OutLog("Apertura progetto : " & Local_AssemblyName.Name) + Utility.LockDir(Path.GetDirectoryName(Local_AssemblyName.Name), Path.GetFileNameWithoutExtension(Local_AssemblyName.Name)) ' carico il nome come Assemblato selezionato If Not OptionModule.m_DisableWindowOrder Then Dim OrderWindow As New OrderV(Application.Current.MainWindow, New OrderVM()) diff --git a/Constants/ConstCompo.vb b/Constants/ConstCompo.vb index 77c7cb7..252ac51 100644 --- a/Constants/ConstCompo.vb +++ b/Constants/ConstCompo.vb @@ -111,6 +111,7 @@ Module ConstCompo Public Const INI_EXTENSION As String = ".ini" Public Const TEMPL_EXTENSION As String = ".templ" Public Const FRAME_FOLDER As String = ".frame" + Public Const LCK_EXTENSION as string = ".lck" Public Const FOLDERDIR As String = "Folder" ' Nome file di matching tra componenti su ante e telaio diff --git a/DoorParameters/Part.vb b/DoorParameters/Part.vb index fc1fbed..527758e 100644 --- a/DoorParameters/Part.vb +++ b/DoorParameters/Part.vb @@ -212,6 +212,7 @@ Public Class Part PropertiesIsVisible = Visibility.Collapsed End if NotifyPropertyChanged("SelectedMaterial") + OptionModule.m_CurrMaterial = m_SelectedMaterial Map.refSceneManagerVM.RefreshBtn() Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = True End if @@ -222,6 +223,7 @@ Public Class Part For Each Item In m_MaterilaList If ItemMaterial.NameDDF = Item.NameDDF then m_SelectedMaterial = Item + OptionModule.m_CurrMaterial = m_SelectedMaterial NotifyPropertyChanged("SelectedMaterial") Exit for End If @@ -1774,6 +1776,7 @@ Public Class Part ' se trovo il materiale allora carico la sua lista di proprietà ed esco If Trim(MaterialItem.NameDDF) = Trim(sMaterial) then m_SelectedMaterial = MaterialItem + OptionModule.m_CurrMaterial = m_SelectedMaterial If Not IsNothing (MaterialItem.PropertiesList) then PropertiesList = MaterialItem.PropertiesList SelectedProperty = m_PropertiesList(0) @@ -2857,7 +2860,15 @@ Public Class Part Me.m_Height = OptionModule.m_Height Me.m_Thickness = OptionModule.m_ThicknessJamb Me.SetSwing(OptionModule.m_Swing) - Me.SetMaterial(OptionModule.m_MaterialList(0)) + If Not IsNothing(OptionModule.m_CurrMaterial) then + Try + Me.SetMaterial(m_MaterialList.First(Function(x) x.Name = Trim(OptionModule.m_CurrMaterial.Name))) + Catch ex As Exception + Me.SetMaterial(OptionModule.m_MaterialList(0)) + End Try + Else + Me.SetMaterial(OptionModule.m_MaterialList(0)) + End If Me.m_IsActive = True Me.m_Measure = ConvertMmUnitsToString(OptionModule.m_bIsMmUnit) Me.m_Weight = OptionModule.m_Weight @@ -2881,7 +2892,15 @@ Public Class Part Me.m_Height = OptionModule.m_Height Me.m_Thickness = OptionModule.m_Thickness Me.SetSwing(OptionModule.m_Swing) - Me.SetMaterial(OptionModule.m_MaterialList(0)) + If Not IsNothing(OptionModule.m_CurrMaterial) then + Try + Me.SetMaterial(m_MaterialList.First(Function(x) x.Name = Trim(OptionModule.m_CurrMaterial.Name))) + Catch ex As Exception + Me.SetMaterial(OptionModule.m_MaterialList(0)) + End Try + Else + Me.SetMaterial(OptionModule.m_MaterialList(0)) + End If Me.m_IsActive = True Me.m_Measure = ConvertMmUnitsToString(OptionModule.m_bIsMmUnit) Me.m_Weight = OptionModule.m_Weight diff --git a/HardwarePart/HardwarePartV.xaml b/HardwarePart/HardwarePartV.xaml index 4553d64..be52af0 100644 --- a/HardwarePart/HardwarePartV.xaml +++ b/HardwarePart/HardwarePartV.xaml @@ -116,16 +116,18 @@ --> -