Compare commits
24 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8724a8cee9 | |||
| 17917c682e | |||
| d339d58ad1 | |||
| 6efad10da5 | |||
| 77a708f35f | |||
| 7668db1917 | |||
| 2ad2f50a4f | |||
| 051cbb2a5a | |||
| cf978712ba | |||
| 3e41014f5b | |||
| a62a53ea61 | |||
| 60adc08781 | |||
| 06510d5925 | |||
| d8c97cf352 | |||
| 78310cd711 | |||
| e48cbffa6b | |||
| 4e947f293e | |||
| 014ce6db17 | |||
| 705aeaaab7 | |||
| 228c4f9a48 | |||
| 375c53122c | |||
| bb22395a22 | |||
| 4eac19a2ff | |||
| c276398b29 |
@@ -223,4 +223,9 @@ Module ConstIni
|
||||
Public Const S_MRUGUNSTOCKPEZ As String = "MruGunStockPez"
|
||||
Public Const K_FILE As String = "File"
|
||||
|
||||
Public Const S_EXECUTEWINDOW As String = "ExecuteWindow"
|
||||
Public Const K_LEFT As String = "Left"
|
||||
Public Const K_TOP As String = "Top"
|
||||
Public Const K_WIDTH As String = "Width"
|
||||
Public Const K_HEIGHT As String = "Height"
|
||||
End Module
|
||||
|
||||
@@ -402,6 +402,7 @@
|
||||
</Compile>
|
||||
<Compile Include="PopUpViewPanel\PopUpViewPanelVM.vb" />
|
||||
<Compile Include="Utility\SelData.vb" />
|
||||
<Compile Include="Utility\WindowStateBehavior.vb" />
|
||||
<Compile Include="ViewPanel\ViewPanelV.xaml.vb">
|
||||
<DependentUpon>ViewPanelV.xaml</DependentUpon>
|
||||
</Compile>
|
||||
|
||||
@@ -4,13 +4,14 @@
|
||||
xmlns:EgtCAM5="clr-namespace:EgtCAM5"
|
||||
xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5"
|
||||
Title="Execute Window"
|
||||
Height="500" Width="400"
|
||||
Height="500" Width="600"
|
||||
IsResizable="True"
|
||||
IsMinimizable="False"
|
||||
WindowStartupLocation="CenterOwner"
|
||||
ShowInTaskbar="False"
|
||||
TitleBarHeight="32"
|
||||
PreviewKeyDown="EgtCustomWindow_PreviewKeyDown"
|
||||
EgtCAM5:WindowStateIniBehavior.PersistenceKey="Dimension"
|
||||
CloseCommand="{Binding Close_Command,Mode=OneWay,UpdateSourceTrigger=PropertyChanged}">
|
||||
|
||||
<Grid>
|
||||
@@ -28,7 +29,8 @@
|
||||
Grid.ColumnSpan="2"
|
||||
Content="{Binding OkMsg}"
|
||||
Command="{Binding Ok_Command}"
|
||||
Style="{StaticResource EgtCAM5_InputButton}"/>
|
||||
Style="{StaticResource EgtCAM5_InputButton}"
|
||||
Margin="0,5,0,10"/>
|
||||
<Button Grid.Column="1"
|
||||
Command="{Binding Reload_Command}"
|
||||
IsEnabled="{Binding bReload_IsEnable}"
|
||||
|
||||
@@ -4,13 +4,13 @@ Imports EgtWPFLib5
|
||||
Class MainWindowV
|
||||
Inherits EgtCustomWindow
|
||||
|
||||
Private Sub Me_Initialized(sender As Object, e As EventArgs) Handles Me.Initialized
|
||||
Private Sub MainWindow_Initialized(sender As Object, e As EventArgs) Handles Me.Initialized
|
||||
If Not ProjectVM.GetAppToShow() Then
|
||||
Me.ShowInTaskbar = False
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub EgtCustomWindow_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
|
||||
Private Sub MainWindow_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
|
||||
' Posizione e dimensioni del Form
|
||||
Dim WinPos As New WinPos
|
||||
If ProjectVM.GetAppToShow() Then
|
||||
@@ -21,6 +21,13 @@ Class MainWindowV
|
||||
WinPosToWindow(Me, WinPos)
|
||||
End Sub
|
||||
|
||||
Private Sub MainWindowV_Closing(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles Me.Closing
|
||||
If (Keyboard.Modifiers And ModifierKeys.Alt) = ModifierKeys.Alt AndAlso Keyboard.IsKeyDown(Key.F4) Then
|
||||
e.Cancel = True
|
||||
Return
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub MainWindow_Drop(sender As Object, e As DragEventArgs)
|
||||
' Se drag di file
|
||||
If e.Data.GetDataPresent(DataFormats.FileDrop) Then
|
||||
|
||||
@@ -171,7 +171,6 @@ Public Class MainWindowVM
|
||||
Public Sub CloseApplication(ByVal param As Object)
|
||||
If IniFile.m_bScriptRunning Then
|
||||
If Not IniFile.m_bFailedRun Then
|
||||
'MessageBox.Show("Can't exit now. Wait until the end of the script execution", "", MessageBoxButton.OK, MessageBoxImage.Stop)
|
||||
Return
|
||||
End If
|
||||
End If
|
||||
@@ -379,8 +378,8 @@ Public Class MainWindowVM
|
||||
EgtSetLockId(sLockId)
|
||||
End If
|
||||
' Recupero livello e opzioni della chiave
|
||||
Dim bKey As Boolean = EgtGetKeyLevel(3279, 3103, 1, IniFile.m_nKeyLevel) And
|
||||
EgtGetKeyOptions(3279, 3103, 1, IniFile.m_nKeyOptions)
|
||||
Dim bKey As Boolean = EgtGetKeyLevel(3279, 3105, 1, IniFile.m_nKeyLevel) And
|
||||
EgtGetKeyOptions(3279, 3105, 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
|
||||
@@ -609,11 +608,13 @@ Public Class MainWindowVM
|
||||
Map.refMachiningParameterExpanderVM.CurrOperation.SetShowNoteListCombo_IsEnable(True)
|
||||
End If
|
||||
ElseIf (e.Key = Key.Left OrElse e.Key = Key.Right) AndAlso Map.refTopCommandBarVM.MachiningIsChecked AndAlso Map.refOperationParametersExpanderVM.OperationParameters.IsEnabled Then
|
||||
If Map.refMachiningParameterExpanderVM.CurrOperation.AdvancedParamIsExpander Then Map.refMachiningParameterExpanderVM.CurrOperation.AdvancedParamIsExpander = True
|
||||
Map.refMachiningParameterExpanderVM.FocusSlider()
|
||||
Dim nStep As Integer = If(e.Key = Key.Right, 1, -1)
|
||||
Map.refMachiningParameterExpanderVM.SetSliderValue(nStep)
|
||||
e.Handled = True
|
||||
ElseIf (e.Key = Key.Up OrElse e.Key = Key.Down) AndAlso Map.refTopCommandBarVM.MachiningIsChecked AndAlso Map.refOperationParametersExpanderVM.OperationParameters.IsEnabled Then
|
||||
If Map.refMachiningParameterExpanderVM.CurrOperation.AdvancedParamIsExpander Then Map.refMachiningParameterExpanderVM.CurrOperation.AdvancedParamIsExpander = True
|
||||
Map.refMachiningParameterExpanderVM.FocusButtonPreview()
|
||||
If e.Key = Key.Down Then
|
||||
Map.refMachiningParameterExpanderVM.RevertPreviewMachiningTool()
|
||||
|
||||
@@ -70,6 +70,6 @@ Imports System.Windows
|
||||
' by using the '*' as shown below:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("3.1.3.2")>
|
||||
<Assembly: AssemblyFileVersion("3.1.3.2")>
|
||||
<Assembly: AssemblyVersion("3.1.5.2")>
|
||||
<Assembly: AssemblyFileVersion("3.1.5.2")>
|
||||
|
||||
|
||||
@@ -22,9 +22,9 @@ Public Class LayerTreeViewItem
|
||||
Return m_isSelected
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
If value Then Map.refDrawOptionPanelVM.SetInfoRowIsExpanded(value)
|
||||
If (value <> m_isSelected) Then
|
||||
m_isSelected = value
|
||||
Map.refDrawOptionPanelVM.SetInfoRowIsExpanded(value)
|
||||
If value Then
|
||||
' recupero l'Id del nuovo oggetto selezionato
|
||||
Map.refManageLayerExpanderVM.IsRightClickedLayerTreeItem(False)
|
||||
|
||||
+3
-10
@@ -95,16 +95,9 @@ Public Class MachiningTreeExpanderVM
|
||||
EgtRelocate(MachiningId, nSelectedOperationId, GDB_POS.AFTER)
|
||||
End If
|
||||
' Imposto geometria da lavorare (tutta quella selezionata)
|
||||
Dim vId(EgtGetSelectedObjCount() - 1) As Integer
|
||||
Dim vSub(EgtGetSelectedObjCount() - 1) As Integer
|
||||
Dim nInd As Integer = 0
|
||||
Dim EntId As Integer = EgtGetFirstSelectedObj()
|
||||
While EntId <> GDB_ID.NULL
|
||||
vId(nInd) = EntId
|
||||
SelData.GetSubFromId( EntId, vSub(nInd))
|
||||
nInd += 1
|
||||
EntId = EgtGetNextSelectedObj()
|
||||
End While
|
||||
Dim vId() As Integer = Nothing
|
||||
Dim vSub() As Integer = Nothing
|
||||
SelData.GetAllSelectedGeom(vId, vSub)
|
||||
EgtSetMachiningGeometry(vId, vSub)
|
||||
' Calcolo la lavorazione con la nuova geometria
|
||||
EgtApplyMachining(True)
|
||||
|
||||
+9
-13
@@ -13,7 +13,7 @@ Public Class MachiningParameterExpanderVM
|
||||
''' </summary>
|
||||
Friend Event m_EventFocusOnButtonPreview()
|
||||
|
||||
Private m_nPreviewMachiningTool As Integer
|
||||
Private m_nPreviewMachiningTool As Integer = MCH_LOOK.NONE
|
||||
Public ReadOnly Property nPreviewMachiningTool As Integer
|
||||
Get
|
||||
Return m_nPreviewMachiningTool
|
||||
@@ -188,7 +188,11 @@ Public Class MachiningParameterExpanderVM
|
||||
Dim nType As Integer
|
||||
EgtGetMachiningParam(MCH_MP.NAME, sName)
|
||||
EgtGetMachiningParam(MCH_MP.TYPE, nType)
|
||||
Dim oldValue As Boolean = If(Not IsNothing(m_CurrOperation), m_CurrOperation.AdvancedParamIsExpander, False)
|
||||
Dim oldOperation As MachiningTreeViewItem = If(Not IsNothing(m_CurrOperation), m_CurrOperation, Nothing)
|
||||
|
||||
m_CurrOperation = New MachiningTreeViewItem(sName, DirectCast(nType, MCH_MY))
|
||||
m_CurrOperation.AdvancedParamIsExpander = oldValue
|
||||
|
||||
m_CurrOperation.ReadOperationParam()
|
||||
|
||||
@@ -251,8 +255,7 @@ Public Class MachiningParameterExpanderVM
|
||||
If MatType = MaterialType.STONE5 Then
|
||||
' se macchina di tipo STONE ricavo il tipo di utensile
|
||||
Dim sMachiningToolName = String.Empty
|
||||
EgtMdbSetCurrMachining(sName)
|
||||
EgtMdbGetCurrMachiningParam(MCH_MP.TOOL, sMachiningToolName)
|
||||
EgtGetMachiningParam(MCH_MP.TOOL, sMachiningToolName)
|
||||
EgtTdbSetCurrTool(sMachiningToolName)
|
||||
Dim dValue As Double = 0
|
||||
Dim nToolType As Integer
|
||||
@@ -440,16 +443,9 @@ Public Class MachiningParameterExpanderVM
|
||||
m_CurrOperation.WriteOperationParam()
|
||||
|
||||
' Imposto geometria da lavorare (tutta quella selezionata)
|
||||
Dim vId(EgtGetSelectedObjCount() - 1) As Integer
|
||||
Dim vSub(EgtGetSelectedObjCount() - 1) As Integer
|
||||
Dim nInd As Integer = 0
|
||||
Dim EntId As Integer = EgtGetFirstSelectedObj()
|
||||
While EntId <> GDB_ID.NULL
|
||||
vId(nInd) = EntId
|
||||
SelData.GetSubFromId(EntId, vSub(nInd))
|
||||
nInd += 1
|
||||
EntId = EgtGetNextSelectedObj()
|
||||
End While
|
||||
Dim vId() As Integer = Nothing
|
||||
Dim vSub() As Integer = Nothing
|
||||
SelData.GetAllSelectedGeom(vId, vSub)
|
||||
EgtSetMachiningGeometry(vId, vSub)
|
||||
|
||||
' Rigenero la lavorazione
|
||||
|
||||
+9
-9
@@ -129,13 +129,8 @@
|
||||
UpdateSourceTrigger=PropertyChanged,
|
||||
ValidatesOnDataErrors=True}"
|
||||
Style="{DynamicResource StringParamV_Margin}"/>
|
||||
<EgtWPFLib5:StringParamV ParamTxBl="{Binding OffsetSrTxBl}"
|
||||
ParamTxBx="{Binding Path=OffSr,
|
||||
UpdateSourceTrigger=PropertyChanged,
|
||||
ValidatesOnDataErrors=True}"
|
||||
Style="{DynamicResource StringParamV_Margin}"/>
|
||||
<EgtWPFLib5:StringParamV ParamTxBl="{Binding OffsetSlTxBl}"
|
||||
ParamTxBx="{Binding Path=OffSl,
|
||||
<EgtWPFLib5:StringParamV ParamTxBl="{Binding SideAngleTxBl}"
|
||||
ParamTxBx="{Binding Path=SideAngle,
|
||||
UpdateSourceTrigger=PropertyChanged,
|
||||
ValidatesOnDataErrors=True}"
|
||||
Style="{DynamicResource StringParamV_Margin}"/>
|
||||
@@ -151,8 +146,13 @@
|
||||
ValidatesOnDataErrors=True}"
|
||||
Style="{DynamicResource StringParamV_Margin}"
|
||||
Visibility="{Binding Epicycles_Visibility}"/>
|
||||
<EgtWPFLib5:StringParamV ParamTxBl="{Binding SideAngleTxBl}"
|
||||
ParamTxBx="{Binding Path=SideAngle,
|
||||
<EgtWPFLib5:StringParamV ParamTxBl="{Binding OffsetSrTxBl}"
|
||||
ParamTxBx="{Binding Path=OffSr,
|
||||
UpdateSourceTrigger=PropertyChanged,
|
||||
ValidatesOnDataErrors=True}"
|
||||
Style="{DynamicResource StringParamV_Margin}"/>
|
||||
<EgtWPFLib5:StringParamV ParamTxBl="{Binding OffsetSlTxBl}"
|
||||
ParamTxBx="{Binding Path=OffSl,
|
||||
UpdateSourceTrigger=PropertyChanged,
|
||||
ValidatesOnDataErrors=True}"
|
||||
Style="{DynamicResource StringParamV_Margin}"/>
|
||||
|
||||
+66
-13
@@ -119,24 +119,21 @@
|
||||
UpdateSourceTrigger=PropertyChanged,
|
||||
ValidatesOnDataErrors=True}"
|
||||
Style="{DynamicResource StringParamV_Margin}"/>
|
||||
<EgtWPFLib5:ComboParamV ParamTxBl="{Binding LeadInTypeTxBl}"
|
||||
ParamCmBxList="{Binding Path=LeadInTypeList,
|
||||
UpdateSourceTrigger=PropertyChanged,
|
||||
ValidatesOnDataErrors=True}"
|
||||
ParamCmBxSelIndex="{Binding Path=SelectedLeadInType}"
|
||||
Style="{DynamicResource ComboParamV_Margin}"/>
|
||||
<EgtWPFLib5:ComboParamV ParamTxBl="{Binding LeadOutTypeTxBl}"
|
||||
ParamCmBxList="{Binding Path=LeadOutTypeList,
|
||||
UpdateSourceTrigger=PropertyChanged,
|
||||
ValidatesOnDataErrors=True}"
|
||||
ParamCmBxSelIndex="{Binding Path=SelectedLeadOutType}"
|
||||
Style="{DynamicResource ComboParamV_Margin}"/>
|
||||
<EgtWPFLib5:StringParamV ParamTxBl="{Binding StepParTxBl}"
|
||||
ParamTxBx="{Binding Path=StepPar,
|
||||
UpdateSourceTrigger=PropertyChanged,
|
||||
ValidatesOnDataErrors=True}"
|
||||
Style="{DynamicResource StringParamV_Margin}"/>
|
||||
|
||||
<EgtWPFLib5:StringParamV ParamTxBl="{Binding OffsetSrTxBl}"
|
||||
ParamTxBx="{Binding Path=OffSr,
|
||||
UpdateSourceTrigger=PropertyChanged,
|
||||
ValidatesOnDataErrors=True}"
|
||||
Style="{DynamicResource StringParamV_Margin}"/>
|
||||
<EgtWPFLib5:StringParamV ParamTxBl="{Binding OffsetSlTxBl}"
|
||||
ParamTxBx="{Binding Path=OffSl,
|
||||
UpdateSourceTrigger=PropertyChanged,
|
||||
ValidatesOnDataErrors=True}"
|
||||
Style="{DynamicResource StringParamV_Margin}"/>
|
||||
</StackPanel>
|
||||
</Expander>
|
||||
|
||||
@@ -252,6 +249,62 @@
|
||||
</Grid>
|
||||
</Expander>
|
||||
|
||||
<Expander Style="{StaticResource ExpanderStyle}">
|
||||
<Expander.Header>
|
||||
<EgtWPFLib5:ComboParamV ParamTxBl="{Binding LeadInTypeTxBl}"
|
||||
ParamCmBxList="{Binding Path=LeadInTypeList,
|
||||
UpdateSourceTrigger=PropertyChanged,
|
||||
ValidatesOnDataErrors=True}"
|
||||
ParamCmBxSelIndex="{Binding Path=SelectedLeadInType}"
|
||||
Style="{DynamicResource ComboParamV_Margin}"/>
|
||||
</Expander.Header>
|
||||
<StackPanel>
|
||||
<EgtWPFLib5:StringParamV ParamTxBl="{Binding StartAddLenTxBl}"
|
||||
ParamTxBx="{Binding Path=StartAddLen,
|
||||
UpdateSourceTrigger=PropertyChanged,
|
||||
ValidatesOnDataErrors=True}"
|
||||
Style="{DynamicResource StringParamV_Margin}"/>
|
||||
<EgtWPFLib5:StringParamV ParamTxBl="{Binding LiTangTxBl}"
|
||||
ParamTxBx="{Binding Path=LiTang,
|
||||
UpdateSourceTrigger=PropertyChanged,
|
||||
ValidatesOnDataErrors=True}"
|
||||
Style="{DynamicResource StringParamV_Margin}"/>
|
||||
<EgtWPFLib5:StringParamV ParamTxBl="{Binding LiElevTxBl}"
|
||||
ParamTxBx="{Binding Path=LiElev,
|
||||
UpdateSourceTrigger=PropertyChanged,
|
||||
ValidatesOnDataErrors=True}"
|
||||
Style="{DynamicResource StringParamV_Margin}"/>
|
||||
</StackPanel>
|
||||
</Expander>
|
||||
|
||||
<Expander Style="{StaticResource ExpanderStyle}">
|
||||
<Expander.Header>
|
||||
<EgtWPFLib5:ComboParamV ParamTxBl="{Binding LeadOutTypeTxBl}"
|
||||
ParamCmBxList="{Binding Path=LeadOutTypeList,
|
||||
UpdateSourceTrigger=PropertyChanged,
|
||||
ValidatesOnDataErrors=True}"
|
||||
ParamCmBxSelIndex="{Binding Path=SelectedLeadOutType}"
|
||||
Style="{DynamicResource ComboParamV_Margin}"/>
|
||||
</Expander.Header>
|
||||
<StackPanel>
|
||||
<EgtWPFLib5:StringParamV ParamTxBl="{Binding EndAddLenTxBl}"
|
||||
ParamTxBx="{Binding Path=EndAddLen,
|
||||
UpdateSourceTrigger=PropertyChanged,
|
||||
ValidatesOnDataErrors=True}"
|
||||
Style="{DynamicResource StringParamV_Margin}"/>
|
||||
<EgtWPFLib5:StringParamV ParamTxBl="{Binding LoTangTxBl}"
|
||||
ParamTxBx="{Binding Path=LoTang,
|
||||
UpdateSourceTrigger=PropertyChanged,
|
||||
ValidatesOnDataErrors=True}"
|
||||
Style="{DynamicResource StringParamV_Margin}"/>
|
||||
<EgtWPFLib5:StringParamV ParamTxBl="{Binding LoElevTxBl}"
|
||||
ParamTxBx="{Binding Path=LoElev,
|
||||
UpdateSourceTrigger=PropertyChanged,
|
||||
ValidatesOnDataErrors=True}"
|
||||
Style="{DynamicResource StringParamV_Margin}"/>
|
||||
</StackPanel>
|
||||
</Expander>
|
||||
|
||||
<Expander Style="{StaticResource ExpanderStyle}">
|
||||
<Expander.Header>
|
||||
<TextBlock Text="{Binding ToolExpanderHeader}"/>
|
||||
|
||||
+6
-1
@@ -92,7 +92,12 @@
|
||||
ValidatesOnDataErrors=True}"
|
||||
ParamCmBxSelIndex="{Binding Path=SelectedSubType}"
|
||||
Style="{DynamicResource ComboParamV_Margin}"/>
|
||||
<UniformGrid Columns="2">
|
||||
<EgtWPFLib5:StringParamV ParamTxBl="{Binding OverLapTxBl}"
|
||||
ParamTxBx="{Binding Path=OverLap,
|
||||
UpdateSourceTrigger=PropertyChanged,
|
||||
ValidatesOnDataErrors=True}"
|
||||
Style="{DynamicResource StringParamV_Margin}"/>
|
||||
<UniformGrid Columns="2">
|
||||
<TextBlock Text="{Binding UserNotesTxBl}"
|
||||
Style="{DynamicResource MPExpander_UserNotesTxBlMargin}"/>
|
||||
<EgtWPFLib5:EgtTextBox Text="{Binding UserNotes, UpdateSourceTrigger=PropertyChanged}"
|
||||
|
||||
+14
-3
@@ -37,14 +37,23 @@ Public Class OperationListBoxItem
|
||||
If Not IsNothing(value) Then
|
||||
|
||||
Dim indexes As List(Of OperationListBoxItem) = New List(Of OperationListBoxItem)
|
||||
Dim Count As Integer = 0
|
||||
Dim nLastInd As Integer = -1
|
||||
Dim nInd As Integer = 0
|
||||
For Each OperationListBoxItem In Map.refOperationsListExpanderVM.OperationList
|
||||
If OperationListBoxItem.IsSelected And OperationListBoxItem.Id <> m_Id Then
|
||||
Count = Count + 1
|
||||
indexes.Add(OperationListBoxItem)
|
||||
nLastInd = nInd
|
||||
End If
|
||||
nInd += 1
|
||||
Next
|
||||
|
||||
' Per evitare problemi con primo Item selezionato quando ListView non ancora esistente
|
||||
If indexes.Count = 1 And nLastInd = 0 Then
|
||||
Map.refOperationsListExpanderVM.OperationList(0).IsSelected = False
|
||||
indexes.Clear()
|
||||
End If
|
||||
|
||||
' E' possibile selezionare più lavorazioni solo se della stessa fase
|
||||
If indexes.Count > 0 Then
|
||||
If EgtGetOperationPhase(Id) <> EgtGetOperationPhase(indexes(0).Id) Then
|
||||
Return
|
||||
@@ -52,10 +61,11 @@ Public Class OperationListBoxItem
|
||||
End If
|
||||
|
||||
m_IsSelected = value
|
||||
|
||||
' Verifico se c'è l'operazione precedente
|
||||
If Not value Or
|
||||
indexes.Any(Function(i) i.Type = MCH_OY.DISP) Or
|
||||
(Not indexes.Any(Function(i) i.Type = MCH_OY.DISP) And Type = MCH_OY.DISP And Count > 0) Then
|
||||
(Not indexes.Any(Function(i) i.Type = MCH_OY.DISP) And Type = MCH_OY.DISP And indexes.Count > 0) Then
|
||||
|
||||
m_IsSelected = False
|
||||
|
||||
@@ -77,6 +87,7 @@ Public Class OperationListBoxItem
|
||||
If Map.refOperationsListExpanderVM.ForceDrawInIsSelected Then EgtDraw()
|
||||
Return
|
||||
End If
|
||||
|
||||
' Imposto la fase di lavorazione corrente
|
||||
EgtSetCurrPhase(EgtGetOperationPhase(Id))
|
||||
' Abilito la selezione dei Percorsi di Lavorazione
|
||||
|
||||
+4
-3
@@ -179,10 +179,11 @@ Public Class OperationParametersExpanderVM
|
||||
Map.refProjectVM.SceneSelMode = OptionModule.m_SelGeomProbing
|
||||
End Select
|
||||
' Imposto visualizzazione utensile
|
||||
Map.refMachiningParameterExpanderVM.SetPreviewMachiningTool(MCH_LOOK.TAB_TOOL)
|
||||
Map.refMachiningParameterExpanderVM.SetToolPreview_Image("pack://application:,,,/Resources/ToolPreview/Tool.png")
|
||||
Map.refMachiningParameterExpanderVM.SetSlider_IsEnable(True)
|
||||
'Map.refMachiningParameterExpanderVM.SetPreviewMachiningTool(MCH_LOOK.TAB_TOOL)
|
||||
'Map.refMachiningParameterExpanderVM.SetToolPreview_Image("pack://application:,,,/Resources/ToolPreview/Tool.png")
|
||||
'Map.refMachiningParameterExpanderVM.SetSlider_IsEnable(True)
|
||||
EgtPreparePreviewMachiningTool()
|
||||
Map.refMachiningParameterExpanderVM.PreviewMachiningTool()
|
||||
EgtDraw()
|
||||
End If
|
||||
OnPropertyChanged("ParametersIsExpanded")
|
||||
|
||||
+1
-1
@@ -28,8 +28,8 @@
|
||||
</UniformGrid>
|
||||
|
||||
<ListBox Grid.Row="1"
|
||||
IsSynchronizedWithCurrentItem="False"
|
||||
ItemsSource="{Binding OperationList}"
|
||||
IsSynchronizedWithCurrentItem="True"
|
||||
x:Name="OperationList" IsEnabled="{Binding IsEnabledOperationList}" SelectionMode="Extended">
|
||||
<ListBox.Resources>
|
||||
<DataTemplate DataType="{x:Type EgtCAM5:MachiningOpListBoxItem}">
|
||||
|
||||
@@ -654,20 +654,17 @@ Public Class OperationsListExpanderVM
|
||||
Dim sErr As String = String.Empty
|
||||
Dim bOk As Boolean = EgtApplyAllMachinings(bRecalc, False, sErr)
|
||||
EgtSetModified()
|
||||
' Deseleziono l'Operazione selezionata e la de-evidenzio nel Disegno
|
||||
' Aggiorno geometrie di lavorazione selezionate e marcate
|
||||
m_ForceDrawInIsSelected = False
|
||||
For Each Operation In OperationList
|
||||
If Operation.IsSelected Then
|
||||
Operation.IsSelected = False
|
||||
Operation.IsSelected = True
|
||||
End If
|
||||
Next
|
||||
' Ricarico la lista delle Operazioni
|
||||
LoadOperationList(GDB_ID.NULL)
|
||||
' Rimetto le lampadine in modo corretto
|
||||
tmpStatusLamp.UpdateStatusLamp()
|
||||
m_ForceDrawInIsSelected = True
|
||||
' Aggiorno visualizzazione e ritorno a cursore standard
|
||||
EgtDraw()
|
||||
' Ripristino cursore
|
||||
Application.Current.MainWindow.ForceCursor = False
|
||||
Application.Current.MainWindow.Cursor = Cursors.Arrow
|
||||
' In caso di errori, li segnalo
|
||||
|
||||
+18
-14
@@ -1456,7 +1456,7 @@ Public Class ProjectVM
|
||||
m_Controller.MouseMoveInSelectionPoint(PtP)
|
||||
End Sub
|
||||
|
||||
Private Sub OnMouseAnalyzedEx(sender As Object, nId As Integer, nSub As Integer, ptSel As Point3d) Handles m_ProjectScene.OnMouseAnalyzedEx
|
||||
Private Sub OnMouseAnalyzedEx(sender As Object, nId As Integer, nSub As Integer, ptSel As Point3d, nModKey As Integer) Handles m_ProjectScene.OnMouseAnalyzedEx
|
||||
Map.refManageLayerExpanderVM.UpdateObjInObjTree(nId)
|
||||
Map.refManageLayerExpanderVM.SelectIdInObjTree(nId)
|
||||
' Cancello geometria e info di eventuale precedente analisi
|
||||
@@ -1470,16 +1470,14 @@ Public Class ProjectVM
|
||||
' Se superficie trimesh, visualizzo dati faccetta toccata
|
||||
ElseIf EgtGetType(nId) = GDB_TY.SRF_MESH Then
|
||||
Dim nFac As Integer = EgtSurfTmFacetFromTria(nId, nSub)
|
||||
If nFac <> -1 Then
|
||||
If nFac >= 0 Then
|
||||
' Visualizzo la normale e il contorno della faccia
|
||||
Analyze.CreateAnalyzeGroup()
|
||||
Analyze.CreateFacetNormal(nId, nFac)
|
||||
Analyze.CreateFacetLoops(nId, nFac)
|
||||
|
||||
If (Keyboard.Modifiers And ModifierKeys.Shift) = ModifierKeys.Shift Then
|
||||
If nModKey = Scene.MODKEY.SHIFT Then
|
||||
Analyze.CreateTriaLoop(nId, nSub)
|
||||
End If
|
||||
|
||||
' Recupero i dati (in globale o griglia a seconda della impostazione)
|
||||
Dim ptC As Point3d
|
||||
Dim vtN As Vector3d
|
||||
@@ -1491,8 +1489,7 @@ Public Class ProjectVM
|
||||
" : C(" + LenToString(ptC.x, 3) + "," + LenToString(ptC.y, 3) + "," + LenToString(ptC.z, 3) + ")" +
|
||||
" N(" + DoubleToString(vtN.x, 4) + "," + DoubleToString(vtN.y, 4) + "," + DoubleToString(vtN.z, 4) + ")" +
|
||||
" / φ=" + DoubleToString(dPhi, 2) + " θ=" + DoubleToString(dTheta, 2)
|
||||
|
||||
If (Keyboard.Modifiers And ModifierKeys.Shift) = ModifierKeys.Shift Then
|
||||
If nModKey = Scene.MODKEY.SHIFT Then
|
||||
sOut &= ", Triangle " + nSub.ToString()
|
||||
End If
|
||||
Map.refStatusBarVM.NotifyStatusOutput(sOut)
|
||||
@@ -1518,20 +1515,25 @@ Public Class ProjectVM
|
||||
" / φ=" + DoubleToString(dPhi, 2) + " θ=" + DoubleToString(dTheta, 2)
|
||||
Map.refStatusBarVM.NotifyStatusOutput(sOut)
|
||||
End If
|
||||
' Se Superficie di Bezier
|
||||
ElseIf EgtGetType(nId) = GDB_TY.SRF_BEZ Then
|
||||
' Visualizzo il punto selezionato, la normale e le tangenti nelle direzioni dei parametri
|
||||
Analyze.CreateAnalyzeGroup()
|
||||
Dim dU As Double
|
||||
Dim dV As Double
|
||||
If Analyze.CreateSBzPointNormalAndTangents(nId, ptSel, dU, dV) Then
|
||||
Dim sOut As String = "U = " + dU.ToString("F3") +
|
||||
"; V = " + dV.ToString("F3")
|
||||
Dim dU, dV As Double
|
||||
Dim vtN As Vector3d
|
||||
If Analyze.CreateSBzPointNormalAndTangents(nId, ptSel, dU, dV, vtN) Then
|
||||
Dim dLen, dPhi, dTheta As Double
|
||||
vtN.ToSpherical(dLen, dTheta, dPhi)
|
||||
' Emetto info sulla barra di stato
|
||||
Dim sOut As String = "U=" + DoubleToString(dU, 4) + ",V=" + DoubleToString(dV, 4) +
|
||||
" : P(" + LenToString(ptSel.x, 3) + "," + LenToString(ptSel.y, 3) + "," + LenToString(ptSel.z, 3) + ")" +
|
||||
" N(" + DoubleToString(vtN.x, 4) + "," + DoubleToString(vtN.y, 4) + "," + DoubleToString(vtN.z, 4) + ")" +
|
||||
" / φ=" + DoubleToString(dPhi, 2) + " θ=" + DoubleToString(dTheta, 2)
|
||||
Map.refStatusBarVM.NotifyStatusOutput(sOut)
|
||||
If (Keyboard.Modifiers And ModifierKeys.Shift) = ModifierKeys.Shift Then
|
||||
If nModKey = Scene.MODKEY.SHIFT Then
|
||||
Analyze.CreateSBzIsoParam(nId, dU, dV)
|
||||
End If
|
||||
End If
|
||||
|
||||
End If
|
||||
' Aggiorno la visualizzazione
|
||||
EgtDraw()
|
||||
@@ -1546,6 +1548,8 @@ Public Class ProjectVM
|
||||
If e.KeyData = System.Windows.Forms.Keys.Delete AndAlso Map.refTopCommandBarVM.DrawIsChecked Then
|
||||
m_Controller.SetLastInteger(GDB_ID.SEL)
|
||||
m_Controller.ExecuteCommand(Controller.CMD.DELETE)
|
||||
' controllo per chiudere expander info
|
||||
If Not Map.refInfoExpanderVM.IsEnabled Then Map.refDrawOptionPanelV.DrawGrid.RowDefinitions(1).Height = New GridLength(1, GridUnitType.Auto)
|
||||
' Con END eseguo deselezione di tutto
|
||||
ElseIf e.KeyData = System.Windows.Forms.Keys.End Then
|
||||
m_Controller.MouseDeselectedAll(True)
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 774 B After Width: | Height: | Size: 797 B |
+49
-38
@@ -1,4 +1,5 @@
|
||||
Imports EgtUILib
|
||||
Imports System.Data
|
||||
Imports EgtUILib
|
||||
|
||||
Module Analyze
|
||||
|
||||
@@ -76,20 +77,6 @@ Module Analyze
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Function CreateTriaNormal( nId As Integer, nT As Integer) As Boolean
|
||||
'If m_AnaGrpId = GDB_ID.NULL Then Return False
|
||||
'Dim bEnMod As Boolean = EgtGetEnableModified()
|
||||
'EgtDisableModified()
|
||||
'Dim ptC As Point3d
|
||||
'Dim vtN As Vector3d
|
||||
'If EgtSurfTmTriangleNormVersor( nId, nT, GDB_ID.ROOT, ptC, vtN) Then
|
||||
' Dim nNormId As Integer = EgtCreateGeoVector( m_AnaGrpId, 50 * vtN, ptC, GDB_RT.GLOB)
|
||||
' EgtSetColor( nNormId, New Color3d( 255, 0,0))
|
||||
'End If
|
||||
'If bEnMod Then EgtEnableModified()
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Function CreateChunkNormal( nId As Integer, nChk As Integer) As Boolean
|
||||
If m_AnaGrpId = GDB_ID.NULL Then Return False
|
||||
Dim bEnMod As Boolean = EgtGetEnableModified()
|
||||
@@ -123,26 +110,26 @@ Module Analyze
|
||||
If m_AnaGrpId = GDB_ID.NULL Then Return False
|
||||
Dim bEnMod As Boolean = EgtGetEnableModified()
|
||||
EgtDisableModified()
|
||||
'Riferimento della griglia corrente
|
||||
' Salvo riferimento della griglia corrente
|
||||
Dim refGrid As Frame3d = EgtGetGridFrame()
|
||||
'Nuovo riferimento griglia con Z come versore estrusione della curva
|
||||
' Nuovo riferimento griglia con Z come versore estrusione della curva
|
||||
Dim vtExtr As Vector3d : EgtCurveExtrusion( nId, vtExtr)
|
||||
If Not vtExtr.IsSmall() Then
|
||||
Dim refCrv As New Frame3d : refCrv.Setup( EgtGetGridOrigin(), vtExtr)
|
||||
EgtSetGridFrame( refCrv)
|
||||
End If
|
||||
'Recupero il numero di curve semplici
|
||||
' Recupero il numero di curve semplici
|
||||
Dim dStart, dEnd As Double
|
||||
EgtCurveDomain( nId, dStart, dEnd)
|
||||
Dim nCount As Integer = CInt( dEnd - dStart) - 1
|
||||
' Ciclo sulle curve semplici
|
||||
For i As Integer = 0 To nCount
|
||||
'Scrivo il punto iniziale di ogni curva componente
|
||||
' Scrivo il punto iniziale di ogni curva componente
|
||||
Dim ptS As Point3d
|
||||
EgtAtParamPoint( nId, i, GDB_ID.GRID, ptS)
|
||||
Dim nPntId As Integer = EgtCreateGeoPoint( m_AnaGrpId, ptS, GDB_RT.GRID)
|
||||
EgtSetColor( nPntId, New Color3d( 255, 0,0))
|
||||
'Scrivo il numero identificativo di ogni curva componente
|
||||
' Scrivo il numero identificativo di ogni curva componente
|
||||
Dim ptP As Point3d
|
||||
EgtAtParamPoint( nId, i + 0.5, GDB_ID.GRID, ptP)
|
||||
Dim dLen As Double = 2 * Point3d.Dist( ptS, ptP)
|
||||
@@ -150,27 +137,52 @@ Module Analyze
|
||||
Dim nTxtId As Integer = EgtCreateTextAdv( m_AnaGrpId, ptP, 0, i.ToString(), "", 100, False, dH, 1, 0, INS_POS.MC, GDB_RT.GRID)
|
||||
EgtSetColor( nTxtId, New Color3d( 255, 0,0))
|
||||
Next
|
||||
'Se curva aperta aggiungo il punto finale
|
||||
' Se curva aperta aggiungo il punto finale
|
||||
If Not EgtCurveIsClosed( nId) Then
|
||||
Dim ptE As Point3d
|
||||
EgtEndPoint( nId, GDB_ID.GRID, ptE)
|
||||
Dim nPntId As Integer = EgtCreateGeoPoint( m_AnaGrpId, ptE, GDB_RT.GRID)
|
||||
EgtSetColor( nPntId, New Color3d( 255, 0,0))
|
||||
End If
|
||||
'Reimposto il riferimento originale alla griglia
|
||||
' Reimposto il riferimento originale alla griglia
|
||||
EgtSetGridFrame( refGrid)
|
||||
If bEnMod Then EgtEnableModified()
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Function CreateSBzPointNormalAndTangents( nId As Integer, ptBez As Point3d, ByRef dU As Double, ByRef dV As Double) As Boolean
|
||||
If m_AnaGrpId = GDB_ID.NULL Then Return False
|
||||
Dim bEnMod As Boolean = EgtGetEnableModified()
|
||||
EgtDisableModified()
|
||||
|
||||
Dim bOk As Boolean = EgtSurfBezParamsFromPoint( nId, ptBez, m_AnaGrpId, dU, dV)
|
||||
|
||||
If bEnMod Then EgtEnableModified()
|
||||
Function CreateSBzPointNormalAndTangents( nId As Integer, ptBez As Point3d, ByRef dU As Double, ByRef dV As Double, ByRef vtN As Vector3d) As Boolean
|
||||
Dim ptP As Point3d
|
||||
Dim vtDirU, vtDirV As Vector3d
|
||||
Dim bOk As Boolean = EgtSurfBezierParamsFromPoint( nId, ptBez, GDB_ID.ROOT, dU, dV) AndAlso
|
||||
EgtSurfBezierGetPointNrmD1( nId, dU, dV, SRF_SIDE.FROM_MINUS, SRF_SIDE.FROM_MINUS, GDB_ID.ROOT,
|
||||
ptP, vtN, vtDirU, vtDirV)
|
||||
If bOk AndAlso m_AnaGrpId <> GDB_ID.NULL Then
|
||||
Dim bEnMod As Boolean = EgtGetEnableModified()
|
||||
EgtDisableModified()
|
||||
' Disegno Punto
|
||||
Dim nPntId As Integer = EgtCreateGeoPoint( m_AnaGrpId, ptBez, GDB_RT.GLOB)
|
||||
EgtSetColor( nPntId, New Color3d( 255, 0, 0))
|
||||
EgtSetStatus( nPntId, GDB_ST.SEL)
|
||||
' Disegno Vettore Normale
|
||||
Dim nNormId As Integer = EgtCreateGeoVector( m_AnaGrpId, 50 * vtN, ptBez, GDB_RT.GLOB)
|
||||
EgtSetColor( nNormId, New Color3d( 255, 0, 0))
|
||||
EgtSetStatus( nNormId, GDB_ST.SEL)
|
||||
' Disegno tangente in U
|
||||
Dim dModU As Double = vtDirU.Len()
|
||||
If dModU > EPS_ZERO Then
|
||||
Dim nTgUId As Integer = EgtCreateGeoVector( m_AnaGrpId, 25 / dModU * vtDirU, ptBez, GDB_RT.GLOB)
|
||||
EgtSetColor( nTgUId, New Color3d( 0, 128, 192))
|
||||
EgtSetStatus( nTgUId, GDB_ST.SEL)
|
||||
End If
|
||||
' Disegno tangente in V
|
||||
Dim dModV As Double = vtDirV.Len()
|
||||
If dModV > EPS_ZERO Then
|
||||
Dim nTgVId As Integer = EgtCreateGeoVector( m_AnaGrpId, 25 / dModV * vtDirV, ptBez, GDB_RT.GLOB)
|
||||
EgtSetColor( nTgVId, New Color3d( 255, 128, 0))
|
||||
EgtSetStatus( nTgVId, GDB_ST.SEL)
|
||||
End If
|
||||
If bEnMod Then EgtEnableModified()
|
||||
End If
|
||||
Return bOk
|
||||
End Function
|
||||
|
||||
@@ -178,15 +190,14 @@ Module Analyze
|
||||
If m_AnaGrpId = GDB_ID.NULL Then Return False
|
||||
Dim bEnMod As Boolean = EgtGetEnableModified()
|
||||
EgtDisableModified()
|
||||
Dim nIdCrv As Integer = EgtSurfBezierGetCurveU( nId, dV, m_AnaGrpId)
|
||||
EgtSetColor( nIdCrv, New Color3d(128,128,255))
|
||||
Dim bOk As Boolean = nIdCrv <> GDB_ID.NULL
|
||||
nIdCrv = EgtSurfBezierGetCurveV( nId, dU, m_AnaGrpId)
|
||||
bOk = bOk And nIdCrv <> GDB_ID.NULL
|
||||
EgtSetColor( nIdCrv, New Color3d(255,128,128))
|
||||
|
||||
Dim nCrvUId As Integer = EgtSurfBezierGetCurveU( nId, dV, m_AnaGrpId)
|
||||
EgtSetColor( nCrvUId, New Color3d( 0, 128, 192))
|
||||
EgtSetStatus( nCrvUId, GDB_ST.SEL)
|
||||
Dim nCrvVId As Integer = EgtSurfBezierGetCurveV( nId, dU, m_AnaGrpId)
|
||||
EgtSetColor( nCrvVId, New Color3d( 255, 128, 0))
|
||||
EgtSetStatus( nCrvVId, GDB_ST.SEL)
|
||||
If bEnMod Then EgtEnableModified()
|
||||
Return bOk
|
||||
Return ( nCrvUId <> GDB_ID.NULL And nCrvVId <> GDB_ID.NULL)
|
||||
End Function
|
||||
|
||||
End Module
|
||||
|
||||
@@ -794,6 +794,8 @@
|
||||
<Style x:Key="ExecuteWindow_TextBox" TargetType="{x:Type TextBox}" BasedOn="{StaticResource {x:Type TextBox}}">
|
||||
<Setter Property="AcceptsReturn" Value="True"/>
|
||||
<Setter Property="TextWrapping" Value="Wrap"/>
|
||||
<Setter Property="FontFamily" Value="Consolas"/>
|
||||
<Setter Property="FontSize" Value="12"/>
|
||||
<Setter Property="Margin" Value="5"/>
|
||||
</Style>
|
||||
|
||||
|
||||
+21
-27
@@ -96,40 +96,34 @@ Module SelData
|
||||
Return False
|
||||
End Function
|
||||
|
||||
Friend Function GetIdSubCount() As Integer
|
||||
Return m_IdSub.Count()
|
||||
End Function
|
||||
|
||||
Friend Function GetIdSub(nInd As Integer, ByRef nId As Integer, ByRef nSub As Integer) As Boolean
|
||||
If nInd < 0 Or nInd > m_IdSub.Count() - 1 Then
|
||||
nId = GDB_ID.NULL
|
||||
Return False
|
||||
End If
|
||||
nId = m_IdSub(nInd).m_nId
|
||||
nSub = m_IdSub(nInd).m_nSub
|
||||
Friend Function GetAllSelectedGeom(ByRef vId() As Integer, ByRef vSub() As Integer) As Boolean
|
||||
VerifyIdSub()
|
||||
' Recupero tutte le entità selezionate con le loro eventuali sotto-parti
|
||||
Dim MyId As New List(Of Integer)
|
||||
Dim MySub As New List(Of Integer)
|
||||
Dim nEntId As Integer = EgtGetFirstSelectedObj()
|
||||
While nEntId <> GDB_ID.NULL
|
||||
Dim MyEntSub As New List(Of Integer)
|
||||
GetSubFromId( nEntId, MyEntSub)
|
||||
For Each nEntSub As Integer In MyEntSub
|
||||
MyId.Add(nEntId)
|
||||
MySub.Add(nEntSub)
|
||||
Next
|
||||
nEntId = EgtGetNextSelectedObj()
|
||||
End While
|
||||
vId = MyId.ToArray()
|
||||
vSub = MySub.ToArray()
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Friend Function GetAllIdSub(ByRef vId() As Integer, ByRef vSub() As Integer) As Boolean
|
||||
Dim MyId(m_IdSub.Count() - 1) As Integer
|
||||
Dim MySub(m_IdSub.Count() - 1) As Integer
|
||||
For i As Integer = 0 To m_IdSub.Count() - 1
|
||||
MyId(i) = m_IdSub(i).m_nId
|
||||
MySub(i) = m_IdSub(i).m_nSub
|
||||
Next
|
||||
vId = MyId
|
||||
vSub = MySub
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Friend Function GetSubFromId( nId As Integer, ByRef nSub As Integer) As Boolean
|
||||
Friend Function GetSubFromId(nId As Integer, ByRef vSub As List(Of Integer)) As Boolean
|
||||
For i As Integer = 0 To m_IdSub.Count() - 1
|
||||
If m_IdSub(i).m_nId = nId Then
|
||||
nSub = m_IdSub(i).m_nSub
|
||||
Return True
|
||||
vSub.Add(m_IdSub(i).m_nSub)
|
||||
End If
|
||||
Next
|
||||
nSub = -1
|
||||
If vSub.Count > 0 Then Return True
|
||||
vSub.Add(-1)
|
||||
Return False
|
||||
End Function
|
||||
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
Public Class WindowStateIniBehavior
|
||||
|
||||
Private Shared ReadOnly IsReady As New Dictionary(Of Window, Boolean)
|
||||
|
||||
Public Shared Function GetPersistenceKey(obj As DependencyObject) As String
|
||||
Return CStr(obj.GetValue(PersistenceKeyProperty))
|
||||
End Function
|
||||
|
||||
Public Shared Sub SetPersistenceKey(obj As DependencyObject, value As String)
|
||||
obj.SetValue(PersistenceKeyProperty, value)
|
||||
End Sub
|
||||
|
||||
Public Shared ReadOnly PersistenceKeyProperty As DependencyProperty =
|
||||
DependencyProperty.RegisterAttached(
|
||||
"PersistenceKey",
|
||||
GetType(String),
|
||||
GetType(WindowStateIniBehavior),
|
||||
New PropertyMetadata(Nothing, AddressOf OnKeyChanged)
|
||||
)
|
||||
|
||||
Private Shared Sub OnKeyChanged(d As DependencyObject, e As DependencyPropertyChangedEventArgs)
|
||||
Dim Window = TryCast(d, Window)
|
||||
If IsNothing(Window) Then Return
|
||||
|
||||
IsReady(Window) = False
|
||||
|
||||
AddHandler Window.Loaded, Sub() LoadState(Window)
|
||||
|
||||
AddHandler Window.ContentRendered,
|
||||
Sub()
|
||||
IsReady(Window) = True
|
||||
End Sub
|
||||
|
||||
AddHandler Window.LocationChanged, Sub() SaveState(Window)
|
||||
AddHandler Window.SizeChanged, Sub() SaveState(Window)
|
||||
End Sub
|
||||
|
||||
Private Shared Sub SaveState(Window As Window)
|
||||
If Not IsReady(Window) Then Return
|
||||
|
||||
EgtUILib.WritePrivateProfileString(S_EXECUTEWINDOW, K_LEFT, Window.Left.ToString(), Map.refMainWindowVM.DimensionDir)
|
||||
EgtUILib.WritePrivateProfileString(S_EXECUTEWINDOW, K_TOP, Window.Top.ToString(), Map.refMainWindowVM.DimensionDir)
|
||||
EgtUILib.WritePrivateProfileString(S_EXECUTEWINDOW, K_WIDTH, Window.Width.ToString(), Map.refMainWindowVM.DimensionDir)
|
||||
EgtUILib.WritePrivateProfileString(S_EXECUTEWINDOW, K_HEIGHT, Window.Height.ToString(), Map.refMainWindowVM.DimensionDir)
|
||||
End Sub
|
||||
|
||||
Private Shared Sub LoadState(Window As Window)
|
||||
Dim sLeft As String = String.Empty
|
||||
Dim dLeft As Double = 0
|
||||
EgtUILib.GetPrivateProfileString(S_EXECUTEWINDOW, K_LEFT, String.Empty, sLeft, Map.refMainWindowVM.DimensionDir)
|
||||
If sLeft IsNot String.Empty Then StringToDouble(sLeft, dLeft)
|
||||
|
||||
Dim sTopD As String = String.Empty
|
||||
Dim dTop As Double = 0.0
|
||||
EgtUILib.GetPrivateProfileString(S_EXECUTEWINDOW, K_TOP, String.Empty, sTopD, Map.refMainWindowVM.DimensionDir)
|
||||
If sTopD IsNot String.Empty Then StringToDouble(sTopD, dTop)
|
||||
|
||||
Dim sWidth As String = String.Empty
|
||||
Dim dWidth As Double = 0.0
|
||||
EgtUILib.GetPrivateProfileString(S_EXECUTEWINDOW, K_WIDTH, String.Empty, sWidth, Map.refMainWindowVM.DimensionDir)
|
||||
If sWidth IsNot String.Empty Then StringToDouble(sWidth, dWidth)
|
||||
|
||||
Dim sHeight As String = String.Empty
|
||||
Dim dHeight As Double = 0.0
|
||||
EgtUILib.GetPrivateProfileString(S_EXECUTEWINDOW, K_HEIGHT, String.Empty, sHeight, Map.refMainWindowVM.DimensionDir)
|
||||
If sWidth IsNot String.Empty Then StringToDouble(sHeight, dHeight)
|
||||
|
||||
If dLeft > 0 Then Window.Left = dLeft
|
||||
If dTop > 0 Then Window.Top = dTop
|
||||
If dWidth > 0 Then Window.Width = dWidth
|
||||
If dHeight > 0 Then Window.Height = dHeight
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
Reference in New Issue
Block a user