EgtCAM5 2.2c1 :

- Gestione dei parametri da visualizzare per ciascun utensile del DB Utensile ora è spostata sulla libreria EgtWPFLib5 (come già fatto per Db Lavorazioni)
- Cancellati file non più necessari grazie alla nuova gestione
This commit is contained in:
Renzo Lanza
2020-03-04 11:29:23 +00:00
parent 4e3aaf96fe
commit 9b836645ff
9 changed files with 130 additions and 3780 deletions
+1 -9
View File
@@ -191,6 +191,7 @@
<DependentUpon>SpecialPanelV.xaml</DependentUpon>
</Compile>
<Compile Include="SpecialPanel\SpecialPanelVM.vb" />
<Compile Include="ToolsDbWindow\MyToolDbWindowVM.vb" />
<Compile Include="Utility\Analyze.vb" />
<Compile Include="Utility\BindingProxy.vb" />
<Compile Include="Utility\Map.vb" />
@@ -336,12 +337,7 @@
<Compile Include="Utility\TMDbParamVisibility.vb" />
<Compile Include="StructureDataForMessenger.vb" />
<Compile Include="OptionPanel\MachiningOptionPanel\OperationExpander\DispositionParameterExpander\DispositionUtility.vb" />
<Compile Include="ToolsDbWindow\ToolsDbV.xaml.vb">
<DependentUpon>ToolsDbV.xaml</DependentUpon>
</Compile>
<Compile Include="ToolsDbWindow\ToolsDbVM.vb" />
<Compile Include="ToolsDbWindow\ToolsUpdate.vb" />
<Compile Include="ToolsDbWindow\ToolTreeView.vb" />
<Compile Include="TopCommandBar\TopCommandBarV.xaml.vb">
<DependentUpon>TopCommandBarV.xaml</DependentUpon>
</Compile>
@@ -525,10 +521,6 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="ToolsDbWindow\ToolsDbV.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="TopCommandBar\TopCommandBarV.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
+17 -6
View File
@@ -128,12 +128,23 @@ Public Class MachinePanelVM
MessageBox.Show(EgtMsg(MSG_TOOLSERRORS + 30), EgtMsg(MSG_MESSAGEBOX + 1), MessageBoxButton.OK, MessageBoxImage.Error)
Return
End If
Dim ToolDbWindow As New ToolsDbV
ToolDbWindow.Height = 640
ToolDbWindow.Width = 1024
ToolDbWindow.DataContext = New ToolsDbVM
ToolDbWindow.Owner = Application.Current.MainWindow
ToolDbWindow.ShowDialog()
'Dim ToolDbWindow As New ToolsDbV
'ToolDbWindow.Height = 640
'ToolDbWindow.Width = 1024
'ToolDbWindow.DataContext = New ToolsDbVM
'ToolDbWindow.Owner = Application.Current.MainWindow
'ToolDbWindow.ShowDialog()
Dim sMachineDir As String = IniFile.m_sMachinesRoot & "\" & IniFile.m_sMachineName
Dim ToolDbWindowVM As New MyToolDbWindowVM(sMachineDir, IniFile.m_sCurrMachIniFilePath, IniFile.m_ProjectSceneContext, "Wood")
Dim ToolDbWindowV As New EgtWPFLib5.ToolDbWindowV(Application.Current.MainWindow, ToolDbWindowVM)
If ToolDbWindowVM.MatType <> 0 Then
ToolDbWindowV.Height = 674
ToolDbWindowV.Width = 1024
ToolDbWindowV.Owner = Application.Current.MainWindow
ToolDbWindowV.ShowDialog()
End If
End Sub
#End Region ' ToolDbCommand
+2 -2
View File
@@ -19,8 +19,8 @@
</EgtWPFLib5:EgtCustomWindow.InputBindings>
<EgtWPFLib5:EgtCustomWindow.Resources>
<local:DepthUnitConverter x:Key="DepthUnitConverter"/>
<local:ErrorVisibilityConverter x:Key="ErrorVisibilityConverter"/>
<EgtWPFLib5:DepthUnitConverter x:Key="DepthUnitConverter"/>
<EgtWPFLib5:ErrorVisibilityConverter x:Key="ErrorVisibilityConverter"/>
<sys:Int32 x:Key="Invert">0</sys:Int32>
<sys:Int32 x:Key="LeaveTab">1</sys:Int32>
<sys:Int32 x:Key="WorkSide">2</sys:Int32>
+2 -2
View File
@@ -70,5 +70,5 @@ Imports System.Windows
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("2.2.2.7")>
<Assembly: AssemblyFileVersion("2.2.2.7")>
<Assembly: AssemblyVersion("2.2.3.1")>
<Assembly: AssemblyFileVersion("2.2.3.1")>
+108
View File
@@ -0,0 +1,108 @@
Imports System.Windows.Forms.Integration
Imports System.Collections.ObjectModel
Imports System.Reflection
Imports System.IO
Imports EgtUILib
Imports EgtWPFLib5
Public Class MyToolDbWindowVM
Inherits ToolDbWindowVM
Private Const SETUP_FILEEXTENSION As String = ".stu"
#Region "CONSTRUCTOR"
Sub New(sMachineDirPath As String, sMachineIniPath As String, ProjectSceneContext As Integer, Optional sMatType As String = "Wood")
MyBase.New(sMachineDirPath, sMachineIniPath, ProjectSceneContext, sMatType)
End Sub
#End Region ' Constructor
#Region "METHODS"
' Funzione che aggiorna setup default con tool che hanno parametro Active
Public Overrides Function UpdateDefSetup() As Boolean
InitSetupFile()
' Creo Setup
Dim DefSetup As New SetUpVM
' inizializzo ambiente setup
DefSetup.InitSetUp()
' resetto lista utensili e posizioni
DefSetup.ToolsList.Clear()
DefSetup.ClearAllPos()
DefSetup.LoadMachineTools()
' ciclo sugli utensili del db
For Each ToolFamily In ToolsList
For Each Tool In ToolFamily.Items
Dim ToolItem As EgtWPFLib5.ToolTreeViewItem = DirectCast(Tool, EgtWPFLib5.ToolTreeViewItem)
' verifico se Active
If ToolItem.Active Then
For Each TF In DefSetup.ToolsList
For TIndex = TF.Items.Count - 1 To 0 Step -1
Dim T As ToolItem = DirectCast(TF.Items(TIndex), ToolItem)
If ToolItem.Name = T.Name Then
DefSetup.ToolDoubleClick(T)
End If
Next
Next
End If
Next
Next
Dim DefSetupPath As String = IniFile.m_sMachinesRoot & "\" & IniFile.m_sMachineName & "\SetUp"
Dim DefSetupName As String = String.Empty
EgtUILib.GetPrivateProfileString(S_SETUP, K_DEFAULT, "", DefSetupName, IniFile.m_sCurrMachIniFilePath)
DefSetupPath += "\" & DefSetupName & SETUP_FILEEXTENSION
If Not DefSetup.Save(DefSetupPath) Then EgtOutLog("Impossible to save default setup.")
Return True
End Function
' Inizializzo file Setup
Private Sub InitSetupFile()
' verifico che il file di configurazione attrezzaggio (lua) della macchina esista
If Not File.Exists(IniFile.m_sCurrMachScriptsDirPath & "\" & SETUP_LUA) Then
EgtOutLog("SetUp error: SetUp configuration file doesn't exist ")
MessageBox.Show(EgtMsg(MSG_SETUPERRORS + 7), EgtMsg(MSG_SETUPERRORS + 1), MessageBoxButton.OK, MessageBoxImage.Error)
Return
End If
' carico Lua che contiene le funzioni per ottenere le posizioni valide dell'utensile selezionato,
' e testa e uscita dell'utensile attrezzato
EgtLuaExecFile(IniFile.m_sCurrMachScriptsDirPath & "\" & SETUP_LUA)
' verifico che le teste riportate in configurazione esistano
Dim Index As Integer = 1
Dim nErr As Integer = 0
While nErr = 0
Dim sHead As String = String.Empty
nErr = 999
EgtLuaSetGlobIntVar("STU.INDEX", Index)
EgtLuaCallFunction("STU.GetTcPosHeadGroupFromPos")
' Leggo variabili
EgtLuaGetGlobStringVar("STU.HEAD", sHead)
EgtLuaGetGlobIntVar("STU.ERR", nErr)
If nErr = 0 Then
If EgtGetHeadExitCount(sHead) = 0 Then
MessageBox.Show(EgtMsg(MSG_SETUPERRORS + 8), EgtMsg(MSG_SETUPERRORS + 1), MessageBoxButton.OK, MessageBoxImage.Error)
Return
End If
End If
Index += 1
End While
' Verifico esistenza direttorio per attrezzaggi
Dim sDir As String = IniFile.m_sMachinesRoot & "\" & IniFile.m_sMachineName & "\SetUp"
If Not Directory.Exists(sDir) Then
Try
Directory.CreateDirectory(sDir)
Catch ex As Exception
EgtOutLog("Error in SetupDir creation " & ex.ToString())
Return
End Try
End If
End Sub
Public Overrides Sub OnCursorPos(ByVal sender As Object, ByVal sCursorPos As String) 'Handles m_ToolScene.OnCursorPos
Application.Msn.NotifyColleagues(Application.NOTIFYCURRPOS, sCursorPos)
End Sub
#End Region ' Methods
End Class
File diff suppressed because it is too large Load Diff
-924
View File
@@ -1,924 +0,0 @@
<EgtWPFLib5:EgtCustomWindow x:Class="ToolsDbV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:local="clr-namespace:EgtCAM5"
xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5"
Title="{Binding Title}" Icon="/Resources/EgtCAM5.ico"
TitleBarBrush="{StaticResource EgaltechBlue1}"
BorderBrush="{StaticResource EgaltechBlue1}"
WindowStyle="None" ResizeMode="NoResize" TitleBarHeight="30" IsResizable="False"
IsMinimizable="False" WindowStartupLocation="CenterScreen" ShowInTaskbar="False"
CloseCommand="{Binding CloseToolsDbCommand,Mode=OneWay,UpdateSourceTrigger=PropertyChanged}"
CloseCommandParameter="{Binding Path=SelectedItem, ElementName=ToolsTreeView}">
<EgtWPFLib5:EgtCustomWindow.InputBindings>
<KeyBinding Key="Escape" Command="{Binding ReloadToolCommand}"
CommandParameter="{Binding Path=SelectedItem,ElementName=ToolsTreeView}"/>
</EgtWPFLib5:EgtCustomWindow.InputBindings>
<EgtWPFLib5:EgtCustomWindow.Resources>
<local:ToolParamVisibilityConverter x:Key="ToolParamVisibilityConverter"/>
<local:ToolDrawUUIDConverter x:Key="ToolDrawUUIDConverter"/>
<local:ErrorVisibilityConverter x:Key="ErrorVisibilityConverter"/>
<sys:Int32 x:Key="Corr">0</sys:Int32>
<sys:Int32 x:Key="ExitPar">1</sys:Int32>
<sys:Int32 x:Key="Coolant">2</sys:Int32>
<sys:Int32 x:Key="CornRad">3</sys:Int32>
<sys:Int32 x:Key="Diam">4</sys:Int32>
<sys:Int32 x:Key="TotDiam">5</sys:Int32>
<sys:Int32 x:Key="Feed">6</sys:Int32>
<sys:Int32 x:Key="EndFeed">7</sys:Int32>
<sys:Int32 x:Key="StartFeed">8</sys:Int32>
<sys:Int32 x:Key="TipFeed">9</sys:Int32>
<sys:Int32 x:Key="Len">10</sys:Int32>
<sys:Int32 x:Key="TotLen">11</sys:Int32>
<sys:Int32 x:Key="MaxMat">12</sys:Int32>
<sys:Int32 x:Key="LonOffset">13</sys:Int32>
<sys:Int32 x:Key="RadOffset">14</sys:Int32>
<sys:Int32 x:Key="Speed">15</sys:Int32>
<sys:Int32 x:Key="SideAng">16</sys:Int32>
<sys:Int32 x:Key="MaxSpeed">17</sys:Int32>
<sys:Int32 x:Key="Thick">18</sys:Int32>
<sys:Int32 x:Key="MaxAbsorption">19</sys:Int32>
<sys:Int32 x:Key="MinFeed">20</sys:Int32>
<sys:Int32 x:Key="Draw">21</sys:Int32>
<sys:Int32 x:Key="Head">22</sys:Int32>
<sys:Int32 x:Key="NamePar">23</sys:Int32>
<sys:Int32 x:Key="UserNotes">24</sys:Int32>
<sys:Int32 x:Key="TcPos">25</sys:Int32>
</EgtWPFLib5:EgtCustomWindow.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.75*"/>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="11*"/>
</Grid.RowDefinitions>
<UniformGrid Grid.Row="0" Columns="3">
<Button Content="New" Command="{Binding NewCommand}"
CommandParameter="{Binding Path=SelectedItem, ElementName=ToolsTreeView}"
IsEnabled="{Binding IsEnabledNewBtn, Mode=OneWay}"/>
<Button Content="Save" Command="{Binding SaveCommand}"
CommandParameter="{Binding Path=SelectedItem, ElementName=ToolsTreeView}"
IsEnabled="{Binding IsEnabledSaveBtn, Mode=OneWay}"/>
<Button Content="Remove" Command="{Binding RemoveCommand}"
CommandParameter="{Binding Path=SelectedItem, ElementName=ToolsTreeView}"
IsEnabled="{Binding IsEnabledRemoveBtn, Mode=OneWay}"/>
</UniformGrid>
<TreeView Name="ToolsTreeView" Grid.Row="1"
ItemsSource="{Binding ToolsList}">
<TreeView.ItemContainerStyle>
<Style TargetType="{x:Type TreeViewItem}">
<Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}" />
<Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay}" />
<Setter Property="IsEnabled" Value="{Binding IsEnabled, Mode=TwoWay}" />
</Style>
</TreeView.ItemContainerStyle>
<TreeView.Resources>
<HierarchicalDataTemplate DataType="{x:Type local:FamilyToolTreeViewItem}" ItemsSource="{Binding Items}">
<Grid >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Image Grid.Column="0" Source="{Binding PictureString}" Height="32" Width="32" Margin="0,8,6,4" />
<TextBlock Grid.Column="1" Text="{Binding Name}" FontSize="15" Margin="10" />
</Grid>
</HierarchicalDataTemplate>
<DataTemplate DataType="{x:Type local:ToolTreeViewItem}">
<Grid >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<!--<Image Grid.Column="0" Source="{Binding PictureString}" Height="32" Margin="0,8,6,4" />-->
<CheckBox Name="ActiveTxBx" Grid.Column="0" Height="20" Width="20" Margin="10,5,0,0"
IsChecked="{Binding Active}"
Visibility="{Binding Path=DataContext.Active_Visibility,
RelativeSource={RelativeSource AncestorType={x:Type EgtWPFLib5:EgtCustomWindow}}}"/>
<TextBlock Grid.Column="1" Text="{Binding NamePar}" Height="18" FontSize="15" Margin="10"/>
</Grid>
</DataTemplate>
</TreeView.Resources>
</TreeView>
</Grid>
<Grid Grid.Column="1" Grid.RowSpan="2" Margin="0,2,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<Grid Grid.Column="0" Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<TextBlock Text="{Binding NameParTxBl}" Style="{StaticResource ToolsTextBlock}"
Visibility="{Binding Path=SelectedItem.Type, ElementName=ToolsTreeView,
Converter={StaticResource ToolParamVisibilityConverter},
ConverterParameter={StaticResource NamePar}}"/>
<EgtWPFLib5:EgtTextBox Name="NameParTxBx" Grid.Column="1" Style="{StaticResource ToolsTextBox}"
Text="{Binding Path=SelectedItem.NamePar,
ElementName=ToolsTreeView, Mode=TwoWay,
UpdateSourceTrigger=PropertyChanged,
ValidatesOnDataErrors=True}"
Visibility="{Binding Path=SelectedItem.Type,
ElementName=ToolsTreeView,
Converter={StaticResource ToolParamVisibilityConverter},
ConverterParameter={StaticResource NamePar}}"/>
<TextBlock Grid.Row="1" Grid.ColumnSpan="2" Style="{StaticResource ValidationErrorTextBlock}"
Text="{Binding Path=SelectedItem.NameErrorMsg, ElementName=ToolsTreeView}"
Visibility="{Binding Path=SelectedItem.NameErrorMsg, ElementName=ToolsTreeView,
Converter={StaticResource ErrorVisibilityConverter}}"/>
</Grid>
<Grid Grid.Column="0" Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<TextBlock Text="{Binding MaxSpeedTxBl}" Style="{StaticResource ToolsTextBlock}"
Visibility="{Binding Path=SelectedItem.Type, ElementName=ToolsTreeView,
Converter={StaticResource ToolParamVisibilityConverter},
ConverterParameter={StaticResource MaxSpeed}}"/>
<EgtWPFLib5:EgtTextBox Name="MaxSpeedTxBx" Grid.Column="1" Style="{StaticResource ToolsTextBox}"
Text="{Binding Path=SelectedItem.MaxSpeed,
ElementName=ToolsTreeView, UpdateSourceTrigger=PropertyChanged}"
Visibility="{Binding Path=SelectedItem.Type,
ElementName=ToolsTreeView, UpdateSourceTrigger=PropertyChanged,
Converter={StaticResource ToolParamVisibilityConverter},
ConverterParameter={StaticResource MaxSpeed}}"/>
</Grid>
<Grid Grid.Column="0" Grid.Row="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<TextBlock Text="{Binding FeedTxBl}" Style="{StaticResource ToolsTextBlock}"
Visibility="{Binding Path=SelectedItem.Type, ElementName=ToolsTreeView,
Converter={StaticResource ToolParamVisibilityConverter},
ConverterParameter={StaticResource Feed}}"/>
<EgtWPFLib5:EgtTextBox Name="FeedTxBx" Grid.Column="1" Style="{StaticResource ToolsTextBox}"
Text="{Binding Path=SelectedItem.Feed,
ElementName=ToolsTreeView, UpdateSourceTrigger=PropertyChanged}"
Visibility="{Binding Path=SelectedItem.Type,
ElementName=ToolsTreeView,
Converter={StaticResource ToolParamVisibilityConverter},
ConverterParameter={StaticResource Feed}}"/>
<!--<ContentPresenter Grid.Row="1" Grid.ColumnSpan="2"
Content="{Binding ElementName=FeedTxBx,
Path=(Validation.Errors).CurrentItem,
UpdateSourceTrigger=PropertyChanged}"/>-->
</Grid>
<Grid Grid.Column="0" Grid.Row="3">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<TextBlock Text="{Binding StartFeedTxBl}" Style="{StaticResource ToolsTextBlock}"
Visibility="{Binding Path=SelectedItem.Type, ElementName=ToolsTreeView,
Converter={StaticResource ToolParamVisibilityConverter},
ConverterParameter={StaticResource StartFeed}}"/>
<EgtWPFLib5:EgtTextBox Name="StartFeedTxBx" Grid.Column="1" Style="{StaticResource ToolsTextBox}"
Text="{Binding Path=SelectedItem.StartFeed,
ElementName=ToolsTreeView, UpdateSourceTrigger=PropertyChanged}"
Visibility="{Binding Path=SelectedItem.Type,
ElementName=ToolsTreeView,
Converter={StaticResource ToolParamVisibilityConverter},
ConverterParameter={StaticResource StartFeed}}"/>
<!--<ContentPresenter Grid.Row="1" Grid.ColumnSpan="2"
Content="{Binding ElementName=StartFeedTxBx,
Path=(Validation.Errors).CurrentItem,
UpdateSourceTrigger=PropertyChanged}"/>-->
</Grid>
<Grid Grid.Column="0" Grid.Row="4">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<TextBlock Text="{Binding TotLenTxBl}" Style="{StaticResource ToolsTextBlock}"
Visibility="{Binding Path=SelectedItem.Type, ElementName=ToolsTreeView,
Converter={StaticResource ToolParamVisibilityConverter},
ConverterParameter={StaticResource TotLen}}"/>
<EgtWPFLib5:EgtTextBox Name="TotLenTxBx" Grid.Column="1" Style="{StaticResource ToolsTextBox}"
Text="{Binding Path=SelectedItem.TotLen,
ElementName=ToolsTreeView, UpdateSourceTrigger=PropertyChanged,
ValidatesOnDataErrors=True}"
Visibility="{Binding Path=SelectedItem.Type,
ElementName=ToolsTreeView,
Converter={StaticResource ToolParamVisibilityConverter},
ConverterParameter={StaticResource TotLen}}"/>
<TextBlock Grid.Row="1" Grid.ColumnSpan="2" Style="{StaticResource ValidationErrorTextBlock}"
Text="{Binding Path=SelectedItem.TotLenErrorMsg, ElementName=ToolsTreeView}"
Visibility="{Binding Path=SelectedItem.TotLenErrorMsg, ElementName=ToolsTreeView,
Converter={StaticResource ErrorVisibilityConverter}}" Margin="0,0,5,0"/>
</Grid>
<Grid Grid.Column="0" Grid.Row="5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<TextBlock Text="{Binding TotDiamTxBl}" Style="{StaticResource ToolsTextBlock}"
Visibility="{Binding Path=SelectedItem.Type, ElementName=ToolsTreeView,
Converter={StaticResource ToolParamVisibilityConverter},
ConverterParameter={StaticResource TotDiam}}"/>
<EgtWPFLib5:EgtTextBox Name="TotDiamTxBx" Grid.Column="1" Style="{StaticResource ToolsTextBox}"
Text="{Binding Path=SelectedItem.TotDiam,
ElementName=ToolsTreeView, UpdateSourceTrigger=PropertyChanged}"
Visibility="{Binding Path=SelectedItem.Type,
ElementName=ToolsTreeView,
Converter={StaticResource ToolParamVisibilityConverter},
ConverterParameter={StaticResource TotDiam}}"/>
<TextBlock Grid.Row="1" Grid.ColumnSpan="2" Style="{StaticResource ValidationErrorTextBlock}"
Text="{Binding Path=SelectedItem.TotDiamErrorMsg, ElementName=ToolsTreeView}"
Visibility="{Binding Path=SelectedItem.TotDiamErrorMsg, ElementName=ToolsTreeView,
Converter={StaticResource ErrorVisibilityConverter}}" Margin="0,0,5,0"/>
</Grid>
<Grid Grid.Column="0" Grid.Row="6">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<TextBlock Text="{Binding ThickTxBl}" Style="{StaticResource ToolsTextBlock}"
Visibility="{Binding Path=SelectedItem.Type, ElementName=ToolsTreeView,
Converter={StaticResource ToolParamVisibilityConverter},
ConverterParameter={StaticResource Thick}}"/>
<EgtWPFLib5:EgtTextBox Name="ThickTxBx" Grid.Column="1" Style="{StaticResource ToolsTextBox}"
Text="{Binding Path=SelectedItem.Thick,
ElementName=ToolsTreeView, UpdateSourceTrigger=PropertyChanged,
ValidatesOnDataErrors=True}"
Visibility="{Binding Path=SelectedItem.Type,
ElementName=ToolsTreeView,
Converter={StaticResource ToolParamVisibilityConverter},
ConverterParameter={StaticResource Thick}}"/>
<TextBlock Grid.Row="1" Grid.ColumnSpan="2" Style="{StaticResource ValidationErrorTextBlock}"
Text="{Binding Path=SelectedItem.ThickErrorMsg, ElementName=ToolsTreeView}"
Visibility="{Binding Path=SelectedItem.ThickErrorMsg, ElementName=ToolsTreeView,
Converter={StaticResource ErrorVisibilityConverter}}" Margin="0,0,5,0"/>
</Grid>
<Grid Grid.Column="0" Grid.Row="7">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<TextBlock Text="{Binding MaxMatTxBl}" Style="{StaticResource ToolsTextBlock}"
Visibility="{Binding Path=SelectedItem.Type, ElementName=ToolsTreeView,
Converter={StaticResource ToolParamVisibilityConverter},
ConverterParameter={StaticResource MaxMat}}"/>
<EgtWPFLib5:EgtTextBox Name="MaxMatTxBx" Grid.Column="1" Style="{StaticResource ToolsTextBox}"
Text="{Binding Path=SelectedItem.MaxMat,
ElementName=ToolsTreeView, UpdateSourceTrigger=PropertyChanged,
ValidatesOnDataErrors=True}"
Visibility="{Binding Path=SelectedItem.Type,
ElementName=ToolsTreeView,
Converter={StaticResource ToolParamVisibilityConverter},
ConverterParameter={StaticResource MaxMat}}"/>
<TextBlock Grid.Row="1" Grid.ColumnSpan="2" Style="{StaticResource ValidationErrorTextBlock}"
Text="{Binding Path=SelectedItem.MaxMatErrorMsg, ElementName=ToolsTreeView}"
Visibility="{Binding Path=SelectedItem.MaxMatErrorMsg, ElementName=ToolsTreeView,
Converter={StaticResource ErrorVisibilityConverter}}" Margin="0,0,5,0"/>
</Grid>
<Grid Grid.Column="0" Grid.Row="8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<TextBlock Text="{Binding LonOffsetTxBl}" Style="{StaticResource ToolsTextBlock}"
Visibility="{Binding Path=SelectedItem.Type, ElementName=ToolsTreeView,
Converter={StaticResource ToolParamVisibilityConverter},
ConverterParameter={StaticResource LonOffset}}"/>
<EgtWPFLib5:EgtTextBox Name="LonOffsetTxBx" Grid.Column="1" Style="{StaticResource ToolsTextBox}"
Text="{Binding Path=SelectedItem.LonOffset,
ElementName=ToolsTreeView, UpdateSourceTrigger=PropertyChanged}"
Visibility="{Binding Path=SelectedItem.Type,
ElementName=ToolsTreeView,
Converter={StaticResource ToolParamVisibilityConverter},
ConverterParameter={StaticResource LonOffset}}"/>
<!--<ContentPresenter Grid.Row="1" Grid.ColumnSpan="2"
Content="{Binding ElementName=LonOffsetTxBx,
Path=(Validation.Errors).CurrentItem,
UpdateSourceTrigger=PropertyChanged}"/>-->
</Grid>
<Grid Grid.Column="0" Grid.Row="9">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<TextBlock Text="{Binding HeadTxBl}" Style="{StaticResource ToolsTextBlock}"
Visibility="{Binding Path=SelectedItem.Type, ElementName=ToolsTreeView,
Converter={StaticResource ToolParamVisibilityConverter},
ConverterParameter={StaticResource Head}}"/>
<ComboBox Name="HeadTxBx" Grid.Column="1" Style="{StaticResource ToolsComboBox}"
ItemsSource="{Binding Path=SelectedItem.HeadList, ElementName=ToolsTreeView,
UpdateSourceTrigger=PropertyChanged}"
SelectedItem="{Binding Path=SelectedItem.SelectedHead, ElementName=ToolsTreeView,
UpdateSourceTrigger=PropertyChanged}"
DisplayMemberPath="HText"
Visibility="{Binding Path=SelectedItem.Type,
ElementName=ToolsTreeView,
Converter={StaticResource ToolParamVisibilityConverter},
ConverterParameter={StaticResource Head}}"/>
<TextBlock Grid.Row="1" Grid.ColumnSpan="2" Style="{StaticResource ValidationErrorTextBlock}"
Text="{Binding Path=SelectedItem.SelectedHeadErrorMsg, ElementName=ToolsTreeView}"
Visibility="{Binding Path=SelectedItem.SelectedHeadErrorMsg, ElementName=ToolsTreeView,
Converter={StaticResource ErrorVisibilityConverter}}" Margin="0,0,5,0"/>
</Grid>
<Grid Grid.Column="0" Grid.Row="10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<TextBlock Text="{Binding CorrTxBl}" Style="{StaticResource ToolsTextBlock}"
Visibility="{Binding Path=SelectedItem.Type, ElementName=ToolsTreeView,
Converter={StaticResource ToolParamVisibilityConverter},
ConverterParameter={StaticResource Corr}}"/>
<EgtWPFLib5:EgtTextBox Name="CorrTxBx" Grid.Column="1" Style="{StaticResource ToolsTextBox}"
Text="{Binding Path=SelectedItem.Corr,
ElementName=ToolsTreeView, UpdateSourceTrigger=PropertyChanged}"
Visibility="{Binding Path=SelectedItem.Type,
ElementName=ToolsTreeView,
Converter={StaticResource ToolParamVisibilityConverter},
ConverterParameter={StaticResource Corr}}"/>
<!--<ContentPresenter Grid.Row="1" Grid.ColumnSpan="2"
Content="{Binding ElementName=CorrTxBx,
Path=(Validation.Errors).CurrentItem,
UpdateSourceTrigger=PropertyChanged}"/>-->
</Grid>
<Grid Grid.Column="0" Grid.Row="11">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<TextBlock Text="{Binding UserNotesTxBl}" Style="{StaticResource ToolsTextBlock}"
Visibility="{Binding Path=SelectedItem.Type, ElementName=ToolsTreeView,
Converter={StaticResource ToolParamVisibilityConverter},
ConverterParameter={StaticResource UserNotes}}"/>
<EgtWPFLib5:EgtTextBox Name="UserNotesTxBx" Grid.Column="1" Style="{StaticResource ToolsTextBox}"
Text="{Binding Path=SelectedItem.UserNotes,
ElementName=ToolsTreeView, UpdateSourceTrigger=PropertyChanged}"
Visibility="{Binding Path=SelectedItem.Type,
ElementName=ToolsTreeView,
Converter={StaticResource ToolParamVisibilityConverter},
ConverterParameter={StaticResource UserNotes}}"/>
<!--<ContentPresenter Grid.Row="1" Grid.ColumnSpan="2"
Content="{Binding ElementName=UserNotesTxBx,
Path=(Validation.Errors).CurrentItem,
UpdateSourceTrigger=PropertyChanged}"/>-->
</Grid>
<Grid Grid.Column="1" Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<TextBlock Text="{Binding DrawTxBl}" Style="{StaticResource ToolsTextBlock}"
Visibility="{Binding Path=SelectedItem.Type, ElementName=ToolsTreeView,
Converter={StaticResource ToolParamVisibilityConverter},
ConverterParameter={StaticResource Draw}}"/>
<Grid Grid.Column="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Border BorderThickness="0.5,1,0.5,0.5" BorderBrush="{StaticResource TextBox.Static.Border}"
Visibility="{Binding Path=SelectedItem.Type,
ElementName=ToolsTreeView,
Converter={StaticResource ToolParamVisibilityConverter},
ConverterParameter={StaticResource Draw}}">
<TextBlock Name="DrawTxBx" Grid.Column="0" Margin="3,0,0,0"
VerticalAlignment="Center" Foreground="Gray"
ToolTip="{Binding Path=SelectedItem.Draw,
ElementName=ToolsTreeView, UpdateSourceTrigger=PropertyChanged,
Converter={StaticResource ToolDrawUUIDConverter}}"
Text="{Binding Path=SelectedItem.Draw,
ElementName=ToolsTreeView, UpdateSourceTrigger=PropertyChanged,
ValidatesOnDataErrors=True,
Converter={StaticResource ToolDrawUUIDConverter}}"/>
</Border>
<Button Grid.Column="1" Margin="5,0,0,0" Content="A"
Command="{Binding Path=SelectedItem.AutoDrawCommand,ElementName=ToolsTreeView}"
Width="{Binding ActualHeight, RelativeSource={RelativeSource Self}}"
Visibility="{Binding Path=SelectedItem.Type,
ElementName=ToolsTreeView,
Converter={StaticResource ToolParamVisibilityConverter},
ConverterParameter={StaticResource Draw}}"/>
<Button Grid.Column="2" Margin="5,0,5,0" Content=". . ."
Command="{Binding Path=SelectedItem.OpenDrawFileCommand,ElementName=ToolsTreeView}"
Width="{Binding ActualHeight, RelativeSource={RelativeSource Self}}"
Visibility="{Binding Path=SelectedItem.Type,
ElementName=ToolsTreeView,
Converter={StaticResource ToolParamVisibilityConverter},
ConverterParameter={StaticResource Draw}}"/>
</Grid>
<TextBlock Grid.Row="1" Grid.ColumnSpan="2" Style="{StaticResource ValidationErrorTextBlock}"
Text="{Binding Path=SelectedItem.DrawErrorMsg, ElementName=ToolsTreeView}"
Visibility="{Binding Path=SelectedItem.DrawErrorMsg, ElementName=ToolsTreeView,
Converter={StaticResource ErrorVisibilityConverter}}" Margin="0,0,5,0"/>
</Grid>
<Grid Grid.Column="1" Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<TextBlock Text="{Binding SpeedTxBl}" Style="{StaticResource ToolsTextBlock}"
Visibility="{Binding Path=SelectedItem.Type, ElementName=ToolsTreeView,
Converter={StaticResource ToolParamVisibilityConverter},
ConverterParameter={StaticResource Speed}}"/>
<EgtWPFLib5:EgtTextBox Name="SpeedTxBx" Grid.Column="1" Style="{StaticResource ToolsTextBox}"
Text="{Binding Path=SelectedItem.Speed,
ElementName=ToolsTreeView, UpdateSourceTrigger=PropertyChanged}"
Visibility="{Binding Path=SelectedItem.Type,
ElementName=ToolsTreeView,
Converter={StaticResource ToolParamVisibilityConverter},
ConverterParameter={StaticResource Speed}}"/>
<TextBlock Grid.Row="1" Grid.ColumnSpan="2" Style="{StaticResource ValidationErrorTextBlock}"
Text="{Binding Path=SelectedItem.SpeedErrorMsg, ElementName=ToolsTreeView}"
Visibility="{Binding Path=SelectedItem.SpeedErrorMsg, ElementName=ToolsTreeView,
Converter={StaticResource ErrorVisibilityConverter}}" Margin="0,0,5,0"/>
</Grid>
<Grid Grid.Column="1" Grid.Row="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<TextBlock Text="{Binding TipFeedTxBl}" Style="{StaticResource ToolsTextBlock}"
Visibility="{Binding Path=SelectedItem.Type, ElementName=ToolsTreeView,
Converter={StaticResource ToolParamVisibilityConverter},
ConverterParameter={StaticResource TipFeed}}"/>
<EgtWPFLib5:EgtTextBox Name="TipFeedTxBx" Grid.Column="1" Style="{StaticResource ToolsTextBox}"
Text="{Binding Path=SelectedItem.TipFeed,
ElementName=ToolsTreeView, UpdateSourceTrigger=PropertyChanged}"
Visibility="{Binding Path=SelectedItem.Type,
ElementName=ToolsTreeView,
Converter={StaticResource ToolParamVisibilityConverter},
ConverterParameter={StaticResource TipFeed}}"/>
<!--<ContentPresenter Grid.Row="1" Grid.ColumnSpan="2"
Content="{Binding ElementName=TipFeedTxBx,
Path=(Validation.Errors).CurrentItem,
UpdateSourceTrigger=PropertyChanged}"/>-->
</Grid>
<Grid Grid.Column="1" Grid.Row="3">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<TextBlock Text="{Binding EndFeedTxBl}" Style="{StaticResource ToolsTextBlock}"
Visibility="{Binding Path=SelectedItem.Type, ElementName=ToolsTreeView,
Converter={StaticResource ToolParamVisibilityConverter},
ConverterParameter={StaticResource EndFeed}}"/>
<EgtWPFLib5:EgtTextBox Name="EndFeedTxBx" Grid.Column="1" Style="{StaticResource ToolsTextBox}"
Text="{Binding Path=SelectedItem.EndFeed,
ElementName=ToolsTreeView, UpdateSourceTrigger=PropertyChanged}"
Visibility="{Binding Path=SelectedItem.Type,
ElementName=ToolsTreeView,
Converter={StaticResource ToolParamVisibilityConverter},
ConverterParameter={StaticResource EndFeed}}"/>
<!--<ContentPresenter Grid.Row="1" Grid.ColumnSpan="2"
Content="{Binding ElementName=EndFeedTxBx,
Path=(Validation.Errors).CurrentItem,
UpdateSourceTrigger=PropertyChanged}"/>-->
</Grid>
<Grid Grid.Column="1" Grid.Row="4">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<TextBlock Text="{Binding LenTxBl}" Style="{StaticResource ToolsTextBlock}"
Visibility="{Binding Path=SelectedItem.Type, ElementName=ToolsTreeView,
Converter={StaticResource ToolParamVisibilityConverter},
ConverterParameter={StaticResource Len}}"/>
<EgtWPFLib5:EgtTextBox Name="LenTxBx" Grid.Column="1" Style="{StaticResource ToolsTextBox}"
Text="{Binding Path=SelectedItem.Len,
ElementName=ToolsTreeView, UpdateSourceTrigger=PropertyChanged,
ValidatesOnDataErrors=True}"
Visibility="{Binding Path=SelectedItem.Type,
ElementName=ToolsTreeView,
Converter={StaticResource ToolParamVisibilityConverter},
ConverterParameter={StaticResource Len}}"/>
<TextBlock Grid.Row="1" Grid.ColumnSpan="2" Style="{StaticResource ValidationErrorTextBlock}"
Text="{Binding Path=SelectedItem.LenErrorMsg, ElementName=ToolsTreeView}"
Visibility="{Binding Path=SelectedItem.LenErrorMsg, ElementName=ToolsTreeView,
Converter={StaticResource ErrorVisibilityConverter}}" Margin="0,0,5,0"/>
</Grid>
<Grid Grid.Column="1" Grid.Row="5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<TextBlock Text="{Binding DiamTxBl}" Style="{StaticResource ToolsTextBlock}"
Visibility="{Binding Path=SelectedItem.Type, ElementName=ToolsTreeView,
Converter={StaticResource ToolParamVisibilityConverter},
ConverterParameter={StaticResource Diam}}"/>
<EgtWPFLib5:EgtTextBox Name="DiamTxBx" Grid.Column="1" Style="{StaticResource ToolsTextBox}"
Text="{Binding Path=SelectedItem.Diam,
ElementName=ToolsTreeView, UpdateSourceTrigger=PropertyChanged,
ValidatesOnDataErrors=True}"
Visibility="{Binding Path=SelectedItem.Type,
ElementName=ToolsTreeView,
Converter={StaticResource ToolParamVisibilityConverter},
ConverterParameter={StaticResource Diam}}"/>
<TextBlock Grid.Row="1" Grid.ColumnSpan="2" Style="{StaticResource ValidationErrorTextBlock}"
Text="{Binding Path=SelectedItem.DiamErrorMsg, ElementName=ToolsTreeView}"
Visibility="{Binding Path=SelectedItem.DiamErrorMsg, ElementName=ToolsTreeView,
Converter={StaticResource ErrorVisibilityConverter}}" Margin="0,0,5,0"/>
</Grid>
<Grid Grid.Column="1" Grid.Row="6">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<TextBlock Text="{Binding CornRadTxBl}" Style="{StaticResource ToolsTextBlock}"
Visibility="{Binding Path=SelectedItem.Type, ElementName=ToolsTreeView,
Converter={StaticResource ToolParamVisibilityConverter},
ConverterParameter={StaticResource CornRad}}"/>
<EgtWPFLib5:EgtTextBox Name="CornRadTxBx" Grid.Column="1" Style="{StaticResource ToolsTextBox}"
Text="{Binding Path=SelectedItem.CornRad,
ElementName=ToolsTreeView, UpdateSourceTrigger=PropertyChanged,
ValidatesOnDataErrors=True}"
Visibility="{Binding Path=SelectedItem.Type,
ElementName=ToolsTreeView,
Converter={StaticResource ToolParamVisibilityConverter},
ConverterParameter={StaticResource CornRad}}"/>
<TextBlock Grid.Row="1" Grid.ColumnSpan="2" Style="{StaticResource ValidationErrorTextBlock}"
Text="{Binding Path=SelectedItem.CornRadErrorMsg, ElementName=ToolsTreeView}"
Visibility="{Binding Path=SelectedItem.CornRadErrorMsg, ElementName=ToolsTreeView,
Converter={StaticResource ErrorVisibilityConverter}}" Margin="0,0,5,0"/>
</Grid>
<Grid Grid.Column="1" Grid.Row="7">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<TextBlock Text="{Binding SideAngTxBl}" Style="{StaticResource ToolsTextBlock}"
Visibility="{Binding Path=SelectedItem.Type, ElementName=ToolsTreeView,
Converter={StaticResource ToolParamVisibilityConverter},
ConverterParameter={StaticResource SideAng}}"/>
<EgtWPFLib5:EgtTextBox Name="SideAngTxBx" Grid.Column="1" Style="{StaticResource ToolsTextBox}"
Text="{Binding Path=SelectedItem.SideAng,
ElementName=ToolsTreeView, UpdateSourceTrigger=PropertyChanged}"
Visibility="{Binding Path=SelectedItem.Type,
ElementName=ToolsTreeView,
Converter={StaticResource ToolParamVisibilityConverter},
ConverterParameter={StaticResource SideAng}}"/>
<!--<ContentPresenter Grid.Row="1" Grid.ColumnSpan="2"
Content="{Binding ElementName=SideAngTxBx,
Path=(Validation.Errors).CurrentItem,
UpdateSourceTrigger=PropertyChanged}"/>-->
</Grid>
<Grid Grid.Column="1" Grid.Row="8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<TextBlock Text="{Binding RadOffsetTxBl}" Style="{StaticResource ToolsTextBlock}"
Visibility="{Binding Path=SelectedItem.Type, ElementName=ToolsTreeView,
Converter={StaticResource ToolParamVisibilityConverter},
ConverterParameter={StaticResource RadOffset}}"/>
<EgtWPFLib5:EgtTextBox Name="RadOffsetTxBx" Grid.Column="1" Style="{StaticResource ToolsTextBox}"
Text="{Binding Path=SelectedItem.RadOffset,
ElementName=ToolsTreeView, UpdateSourceTrigger=PropertyChanged}"
Visibility="{Binding Path=SelectedItem.Type,
ElementName=ToolsTreeView,
Converter={StaticResource ToolParamVisibilityConverter},
ConverterParameter={StaticResource RadOffset}}"/>
<!--<ContentPresenter Grid.Row="1" Grid.ColumnSpan="2"
Content="{Binding ElementName=RadOffsetTxBx,
Path=(Validation.Errors).CurrentItem,
UpdateSourceTrigger=PropertyChanged}"/>-->
</Grid>
<Grid Grid.Column="1" Grid.Row="9">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<TextBlock Text="{Binding ExitParTxBl}" Style="{StaticResource ToolsTextBlock}"
Visibility="{Binding Path=SelectedItem.Type, ElementName=ToolsTreeView,
Converter={StaticResource ToolParamVisibilityConverter},
ConverterParameter={StaticResource ExitPar}}"/>
<ComboBox Name="ExitParTxBx" Grid.Column="1" Style="{StaticResource ToolsComboBox}"
ItemsSource="{Binding Path=SelectedItem.ExitList,
ElementName=ToolsTreeView, UpdateSourceTrigger=PropertyChanged}"
SelectedItem="{Binding Path=SelectedItem.SelectedExit, ElementName=ToolsTreeView,
UpdateSourceTrigger=PropertyChanged}"
Visibility="{Binding Path=SelectedItem.Type,
ElementName=ToolsTreeView,
Converter={StaticResource ToolParamVisibilityConverter},
ConverterParameter={StaticResource ExitPar}}"/>
<TextBlock Grid.Row="1" Grid.ColumnSpan="2" Style="{StaticResource ValidationErrorTextBlock}"
Text="{Binding Path=SelectedItem.SelectedExitErrorMsg, ElementName=ToolsTreeView}"
Visibility="{Binding Path=SelectedItem.SelectedExitErrorMsg, ElementName=ToolsTreeView,
Converter={StaticResource ErrorVisibilityConverter}}" Margin="0,0,5,0"/>
</Grid>
<Grid Grid.Column="1" Grid.Row="10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<TextBlock Text="{Binding TcPosTxBl}" Style="{StaticResource ToolsTextBlock}"
Visibility="{Binding Path=SelectedItem.Type, ElementName=ToolsTreeView,
Converter={StaticResource ToolParamVisibilityConverter},
ConverterParameter={StaticResource TcPos}}"/>
<ComboBox Name="TcPosTxBx" Grid.Column="1" Style="{StaticResource ToolsComboBox}"
ItemsSource="{Binding Path=SelectedItem.TcPosList, ElementName=ToolsTreeView,
UpdateSourceTrigger=PropertyChanged}"
SelectedItem="{Binding Path=SelectedItem.SelectedTcPos, ElementName=ToolsTreeView,
UpdateSourceTrigger=PropertyChanged}"
Visibility="{Binding Path=SelectedItem.Type,
ElementName=ToolsTreeView,
Converter={StaticResource ToolParamVisibilityConverter},
ConverterParameter={StaticResource TcPos}}"/>
<!--<ContentPresenter Grid.Row="1" Grid.ColumnSpan="2"
Content="{Binding ElementName=TcPosTxBx,
Path=(Validation.Errors).CurrentItem,
UpdateSourceTrigger=PropertyChanged}"/>-->
</Grid>
<Grid Grid.Column="1" Grid.Row="12">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<TextBlock Text="{Binding MaxAbsorptionTxBl}" Style="{StaticResource ToolsTextBlock}"
Visibility="{Binding Path=SelectedItem.Type, ElementName=ToolsTreeView,
Converter={StaticResource ToolParamVisibilityConverter},
ConverterParameter={StaticResource MaxAbsorption}}"/>
<EgtWPFLib5:EgtTextBox Name="MaxAbsorptionTxBx" Grid.Column="1" Style="{StaticResource ToolsTextBox}"
Text="{Binding Path=SelectedItem.MaxAbsorption,
ElementName=ToolsTreeView, UpdateSourceTrigger=PropertyChanged}"
Visibility="{Binding Path=SelectedItem.Type,
ElementName=ToolsTreeView,
Converter={StaticResource ToolParamVisibilityConverter},
ConverterParameter={StaticResource MaxAbsorption}}"/>
<!--<ContentPresenter Grid.Row="1" Grid.ColumnSpan="2"
Content="{Binding ElementName=MaxAbsorptionTxBx,
Path=(Validation.Errors).CurrentItem,
UpdateSourceTrigger=PropertyChanged}"/>-->
</Grid>
<Grid Grid.Column="0" Grid.Row="12">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<TextBlock Text="{Binding MinFeedTxBl}" Style="{StaticResource ToolsTextBlock}"
Visibility="{Binding Path=SelectedItem.Type, ElementName=ToolsTreeView,
Converter={StaticResource ToolParamVisibilityConverter},
ConverterParameter={StaticResource MinFeed}}"/>
<EgtWPFLib5:EgtTextBox Name="MinFeedTxBx" Grid.Column="1" Style="{StaticResource ToolsTextBox}"
Text="{Binding Path=SelectedItem.MinFeed,
ElementName=ToolsTreeView, UpdateSourceTrigger=PropertyChanged}"
Visibility="{Binding Path=SelectedItem.Type,
ElementName=ToolsTreeView,
Converter={StaticResource ToolParamVisibilityConverter},
ConverterParameter={StaticResource MinFeed}}"/>
<!--<ContentPresenter Grid.Row="1" Grid.ColumnSpan="2"
Content="{Binding ElementName=MinFeedTxBx,
Path=(Validation.Errors).CurrentItem,
UpdateSourceTrigger=PropertyChanged}"/>-->
</Grid>
<Grid Grid.Column="0" Grid.Row="13">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<TextBlock Text="{Binding CoolantTxBl}" Style="{StaticResource ToolsTextBlock}"
Visibility="{Binding Path=SelectedItem.Type, ElementName=ToolsTreeView,
Converter={StaticResource ToolParamVisibilityConverter},
ConverterParameter={StaticResource Coolant}}"/>
<EgtWPFLib5:EgtTextBox Name="CoolantTxBx" Grid.Column="1" Style="{StaticResource ToolsTextBox}"
Text="{Binding Path=SelectedItem.Coolant,
ElementName=ToolsTreeView, UpdateSourceTrigger=PropertyChanged}"
Visibility="{Binding Path=SelectedItem.Type,
ElementName=ToolsTreeView,
Converter={StaticResource ToolParamVisibilityConverter},
ConverterParameter={StaticResource Coolant}}"/>
<!--<ContentPresenter Grid.Row="1" Grid.ColumnSpan="2"
Content="{Binding ElementName=CoolantTxBx,
Path=(Validation.Errors).CurrentItem,
UpdateSourceTrigger=PropertyChanged}"/>-->
</Grid>
</Grid>
<!--ContentControl che ospita la scena restituita sotto forma di WindowsFormsHost-->
<ContentControl Content="{Binding ToolSceneHost}" Grid.Column="2"/>
</Grid>
</EgtWPFLib5:EgtCustomWindow>
-12
View File
@@ -1,12 +0,0 @@
Imports EgtUILib
Public Class ToolsDbV
Private Sub ToolsDbView_Closed(sender As Object, e As System.EventArgs) Handles Me.Closed
' Imposto contesto generale
EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
' Cancello contesto di visualizzazione utensile
EgtDeleteContext(IniFile.m_ToolsDbSceneContext)
IniFile.m_ToolsDbSceneContext = 0
End Sub
End Class
-746
View File
@@ -1,746 +0,0 @@
Imports System.Windows.Forms.Integration
Imports System.Collections.ObjectModel
Imports System.Reflection
Imports System.IO
Imports EgtUILib
Imports EgtWPFLib5
Public Class ToolsDbVM
Inherits TabViewModel
Private Const SETUP_FILEEXTENSION As String = ".stu"
Friend Shared m_bActive As Boolean = False
Private m_Title As String
Public ReadOnly Property Title As String
Get
Return EgtMsg(MSG_MAINWINDOW + 3)
End Get
End Property
' Lista degli utensili
Private m_ToolsList As New ObservableCollection(Of FamilyToolTreeViewItem)
Public Property ToolsList As ObservableCollection(Of FamilyToolTreeViewItem)
Get
Return m_ToolsList
End Get
Set(value As ObservableCollection(Of FamilyToolTreeViewItem))
m_ToolsList = value
End Set
End Property
Private m_IsEnabledNewBtn As Boolean
Public ReadOnly Property IsEnabledNewBtn As Boolean
Get
Return m_IsEnabledNewBtn
End Get
End Property
Private m_IsEnabledSaveBtn As Boolean
Public ReadOnly Property IsEnabledSaveBtn As Boolean
Get
Return m_IsEnabledSaveBtn
End Get
End Property
Private m_IsEnabledRemoveBtn As Boolean
Public ReadOnly Property IsEnabledRemoveBtn As Boolean
Get
Return m_IsEnabledRemoveBtn
End Get
End Property
'PROJECT PAGE'S SCENE FIELDS AND PROPERTIES
' Reference to the ProjectScene
Private WithEvents m_ToolScene As New Scene
' Reference to the ProjectSceneHost
Private SceneHost As WindowsFormsHost
' Property used to bind the scene to the WindowsFormsHost in XAML
Private m_bfirst As Boolean = True
Public ReadOnly Property ToolSceneHost As WindowsFormsHost
Get
If m_bfirst Then
SceneHost = New WindowsFormsHost() With {.Child = m_ToolScene}
m_ToolScene.SetViewBackground(New Color3d(154, 168, 184), New Color3d(116, 126, 138))
If Not m_ToolScene.Init() Then
EgtOutLog("Error in Tool scene creation")
End If
IniFile.m_ToolsDbSceneContext = m_ToolScene.GetCtx()
' inibisco selezione diretta da Scene
m_ToolScene.SetStatusNull()
m_bfirst = False
End If
Return SceneHost
End Get
End Property
' visibilità parametro Active
Private m_Active_Visibility As Boolean
Public ReadOnly Property Active_Visibility As Visibility
Get
Return If(m_Active_Visibility, Visibility.Visible, Visibility.Collapsed)
End Get
End Property
Private Sub OnCursorPos(ByVal sender As Object, ByVal sCursorPos As String) Handles m_ToolScene.OnCursorPos
Application.Msn.NotifyColleagues(Application.NOTIFYCURRPOS, sCursorPos)
End Sub
' Definizione comandi
Private m_cmdNew As ICommand
Private m_cmdSave As ICommand
Private m_cmdRemove As ICommand
Private m_cmdReloadTool As ICommand
Private m_cmdCloseToolsDb As ICommand
#Region "MESSAGES"
'Definizione dei messaggi della pagina
Public ReadOnly Property CorrTxBl As String
Get
Return EgtMsg(MSG_TOOLSDBPAGE + 51)
End Get
End Property
Public ReadOnly Property ExitParTxBl As String
Get
Return EgtMsg(MSG_TOOLSDBPAGE + 52)
End Get
End Property
Public ReadOnly Property TypeTxBl As String
Get
Return EgtMsg(MSG_TOOLSDBPAGE + 53)
End Get
End Property
Public ReadOnly Property CoolantTxBl As String
Get
Return EgtMsg(MSG_TOOLSDBPAGE + 54)
End Get
End Property
Public ReadOnly Property CornRadTxBl As String
Get
Return EgtMsg(MSG_TOOLSDBPAGE + 55)
End Get
End Property
Public ReadOnly Property DiamTxBl As String
Get
Return EgtMsg(MSG_TOOLSDBPAGE + 56)
End Get
End Property
Public ReadOnly Property TotDiamTxBl As String
Get
Return EgtMsg(MSG_TOOLSDBPAGE + 57)
End Get
End Property
Public ReadOnly Property FeedTxBl As String
Get
Return EgtMsg(MSG_TOOLSDBPAGE + 58)
End Get
End Property
Public ReadOnly Property EndFeedTxBl As String
Get
Return EgtMsg(MSG_TOOLSDBPAGE + 59)
End Get
End Property
Public ReadOnly Property StartFeedTxBl As String
Get
Return EgtMsg(MSG_TOOLSDBPAGE + 60)
End Get
End Property
Public ReadOnly Property TipFeedTxBl As String
Get
Return EgtMsg(MSG_TOOLSDBPAGE + 61)
End Get
End Property
Public ReadOnly Property LenTxBl As String
Get
Return EgtMsg(MSG_TOOLSDBPAGE + 62)
End Get
End Property
Public ReadOnly Property TotLenTxBl As String
Get
Return EgtMsg(MSG_TOOLSDBPAGE + 63)
End Get
End Property
Public ReadOnly Property MaxMatTxBl As String
Get
Return EgtMsg(MSG_TOOLSDBPAGE + 64)
End Get
End Property
Public ReadOnly Property LonOffsetTxBl As String
Get
Return EgtMsg(MSG_TOOLSDBPAGE + 65)
End Get
End Property
Public ReadOnly Property RadOffsetTxBl As String
Get
Return EgtMsg(MSG_TOOLSDBPAGE + 66)
End Get
End Property
Public ReadOnly Property SpeedTxBl As String
Get
Return EgtMsg(MSG_TOOLSDBPAGE + 67)
End Get
End Property
Public ReadOnly Property SideAngTxBl As String
Get
Return EgtMsg(MSG_TOOLSDBPAGE + 68)
End Get
End Property
Public ReadOnly Property MaxSpeedTxBl As String
Get
Return EgtMsg(MSG_TOOLSDBPAGE + 69)
End Get
End Property
Public ReadOnly Property ThickTxBl As String
Get
Return EgtMsg(MSG_TOOLSDBPAGE + 70)
End Get
End Property
Public ReadOnly Property MaxAbsorptionTxBl As String
Get
Return EgtMsg(MSG_TOOLSDBPAGE + 71)
End Get
End Property
Public ReadOnly Property MinFeedTxBl As String
Get
Return EgtMsg(MSG_TOOLSDBPAGE + 72)
End Get
End Property
Public ReadOnly Property DrawTxBl As String
Get
Return EgtMsg(MSG_TOOLSDBPAGE + 73)
End Get
End Property
Public ReadOnly Property HeadTxBl As String
Get
Return EgtMsg(MSG_TOOLSDBPAGE + 74)
End Get
End Property
Public ReadOnly Property NameParTxBl As String
Get
Return EgtMsg(MSG_TOOLSDBPAGE + 75)
End Get
End Property
Public ReadOnly Property UserNotesTxBl As String
Get
Return EgtMsg(MSG_TOOLSDBPAGE + 76)
End Get
End Property
Public ReadOnly Property TcPosTxBl As String
Get
Return EgtMsg(MSG_TOOLSDBPAGE + 77)
End Get
End Property
#End Region
#Region "CONSTRUCTOR"
Sub New()
m_bActive = True
' Passo all'item della lista il delegato alla funzuione che permette di cancellare una lavorazione
ToolTreeViewItem.m_delRemoveTool = AddressOf RemoveTool
' Passo all'item della lista il delegato alla funzuione che permette di disattivare la lista delle lavorazioni
ToolTreeViewItem.m_delErrorOnTool = AddressOf ErrorOnTool
' Passo all'item della lista il delegato alla funzuione che permette di disattivare la lista delle lavorazioni
ToolTreeViewItem.m_delIsEnabledBtns = AddressOf IsEnabledBtns
FamilyToolTreeViewItem.m_delIsEnabledBtns = AddressOf IsEnabledBtns
' Passo all'item della lista il delegato alla funzuione che restituisce l'utensile selezionato
ToolTreeViewItem.m_delGetSelectedTool = AddressOf GetSelectedTool
LoadSelectedMachineTools()
' carico lista teste
ToolTreeViewItem.m_HeadList.Clear()
Dim sHeads As String = String.Empty
EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
If EgtGetAllHeadsNames(sHeads) Then
Dim sHeadList() As String = sHeads.Split(","c)
For HeadIndex = 0 To sHeadList.Count - 1
Dim sHText As String = String.Empty
EgtUILib.GetPrivateProfileString(S_HEADS, sHeadList(HeadIndex), "", sHText, IniFile.m_sCurrMachIniFilePath)
Dim sHTextMsg As String = String.Empty
If IsNumeric(sHText) Then
sHTextMsg = EgtMsg(CInt(sHText))
If sHTextMsg = ("Msg" & CInt(sHText)) Then
sHTextMsg = sHText
End If
Else
sHTextMsg = sHText
End If
sHTextMsg &= " (" & sHeadList(HeadIndex) & ")"
ToolTreeViewItem.m_HeadList.Add(New HeadItem(sHeadList(HeadIndex), sHTextMsg))
Next
Else
MessageBox.Show("Impossible loading Head list from machine!", "Error", MessageBoxButton.OK, MessageBoxImage.Error)
EgtOutLog("Error: Impossible loading Head list from machine!")
End If
' se carico Lua che contiene le funzioni di attrezzaggio
ToolTreeViewItem.m_OrigTcPosList.Clear()
If EgtLuaExecFile(IniFile.m_sCurrMachScriptsDirPath & "\" & SETUP_LUA) Then
' creo lista di tutti i TcPos
Dim nPosIndex As Integer = 1
Dim sTcPos As String = String.Empty
Dim nErr As Integer = 0
While nErr = 0
EgtLuaSetGlobIntVar("STU.INDEX", nPosIndex)
If Not EgtLuaCallFunction("STU.GetTcPosFromPos") Then Exit While
' Leggo variabili
EgtLuaGetGlobStringVar("STU.TCPOS", sTcPos)
If Not EgtLuaGetGlobIntVar("STU.ERR", nErr) Then nErr = 999
If nErr = 0 Then
ToolTreeViewItem.m_OrigTcPosList.Add(sTcPos)
End If
nPosIndex += 1
End While
' altrimenti
Else
MessageBox.Show(EgtMsg(MSG_TOOLSERRORS + 25), EgtMsg(MSG_TOOLSERRORS + 26), MessageBoxButton.OK, MessageBoxImage.Error)
EgtOutLog("Error: SetUp configuration file not found!")
End If
' leggo da ini se parametro Active è attivo
m_Active_Visibility = (EgtUILib.GetPrivateProfileInt(S_TOOLS, K_ACTIVE, 0, IniFile.m_sCurrMachIniFilePath) <> 0)
End Sub
#End Region ' Constructor
#Region "METHODS"
Private Sub IsEnabledBtns(bIsEnabledNewBtn As Boolean, bIsEnabledSaveBtn As Boolean, bIsEnabledDeleteBtn As Boolean)
m_IsEnabledNewBtn = bIsEnabledNewBtn
m_IsEnabledSaveBtn = bIsEnabledSaveBtn
m_IsEnabledRemoveBtn = bIsEnabledDeleteBtn
OnPropertyChanged("IsEnabledNewBtn")
OnPropertyChanged("IsEnabledSaveBtn")
OnPropertyChanged("IsEnabledRemoveBtn")
End Sub
' Quando chiamato, disattiva tutti gli item dell'albero o li riattiva a seconda che ci sia o meno un errore
Private Sub ErrorOnTool(bIsEnabled As Boolean)
For Each FamilyToolItem In ToolsList
FamilyToolItem.IsEnabled = Not bIsEnabled
Next
End Sub
''' <summary>
''' Method that search tools for the currently selected Machine and add it to the ToolsList.
''' </summary>
Private Sub LoadSelectedMachineTools()
Dim ActiveToolsFamilies() As ToolsFamily = MachineModel.ReadActiveToolsFamilies()
For Each ToolsFamily In ActiveToolsFamilies
Dim FamilyTreeView As New FamilyToolTreeViewItem(ToolsFamily.FamilyName, ToolsFamily.FamilyId)
ToolsList.Add(FamilyTreeView)
Dim nType As Integer = 0
Dim ToolName As String = String.Empty
EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
If EgtTdbGetFirstTool(ToolsFamily.FamilyId, ToolName, nType) Then
FamilyTreeView.Items.Add(New ToolTreeViewItem(ToolName))
While EgtTdbGetNextTool(ToolsFamily.FamilyId, ToolName, nType)
FamilyTreeView.Items.Add(New ToolTreeViewItem(ToolName))
End While
End If
Next
' Se esiste almeno una famiglia di utensili, la seleziono
If ToolsList.Count > 0 Then
ToolsList(0).IsSelected = True
ToolsList(0).NotifyPropertyChanged("IsSelected")
End If
End Sub
Private Function GetSelectedTool() As ToolTreeViewItem
For Each ToolFamily In m_ToolsList
For Each Tool In ToolFamily.Items
If Tool.m_IsSelected Then
Return DirectCast(Tool, ToolTreeViewItem)
End If
Next
Next
Return Nothing
End Function
' Funzione che aggiorna setup default con tool che hanno parametro Active
Private Function UpdateDefSetup() As Boolean
InitSetupFile()
' Creo Setup
Dim DefSetup As New SetUpVM
' inizializzo ambiente setup
DefSetup.InitSetUp()
' resetto lista utensili e posizioni
DefSetup.ToolsList.Clear()
DefSetup.ClearAllPos()
DefSetup.LoadMachineTools()
' ciclo sugli utensili del db
For Each ToolFamily In m_ToolsList
For Each Tool In ToolFamily.Items
Dim ToolItem As ToolTreeViewItem = DirectCast(Tool, ToolTreeViewItem)
' verifico se Active
If ToolItem.Active Then
For Each TF In DefSetup.ToolsList
For TIndex = TF.Items.Count - 1 To 0 Step -1
Dim T As ToolItem = DirectCast(TF.Items(TIndex), ToolItem)
If ToolItem.Name = T.Name Then
DefSetup.ToolDoubleClick(T)
End If
Next
Next
End If
Next
Next
Dim DefSetupPath As String = IniFile.m_sMachinesRoot & "\" & IniFile.m_sMachineName & "\SetUp"
Dim DefSetupName As String = String.Empty
EgtUILib.GetPrivateProfileString(S_SETUP, K_DEFAULT, "", DefSetupName, IniFile.m_sCurrMachIniFilePath)
DefSetupPath += "\" & DefSetupName & SETUP_FILEEXTENSION
If Not DefSetup.Save(DefSetupPath) Then EgtOutLog("Impossible to save default setup.")
Return True
End Function
' Inizializzo file Setup
Private Sub InitSetupFile()
' verifico che il file di configurazione attrezzaggio (lua) della macchina esista
If Not File.Exists(IniFile.m_sCurrMachScriptsDirPath & "\" & SETUP_LUA) Then
EgtOutLog("SetUp error: SetUp configuration file doesn't exist ")
MessageBox.Show(EgtMsg(MSG_SETUPERRORS + 7), EgtMsg(MSG_SETUPERRORS + 1), MessageBoxButton.OK, MessageBoxImage.Error)
Return
End If
' carico Lua che contiene le funzioni per ottenere le posizioni valide dell'utensile selezionato,
' e testa e uscita dell'utensile attrezzato
EgtLuaExecFile(IniFile.m_sCurrMachScriptsDirPath & "\" & SETUP_LUA)
' verifico che le teste riportate in configurazione esistano
Dim Index As Integer = 1
Dim nErr As Integer = 0
While nErr = 0
Dim sHead As String = String.Empty
nErr = 999
EgtLuaSetGlobIntVar("STU.INDEX", Index)
EgtLuaCallFunction("STU.GetTcPosHeadGroupFromPos")
' Leggo variabili
EgtLuaGetGlobStringVar("STU.HEAD", sHead)
EgtLuaGetGlobIntVar("STU.ERR", nErr)
If nErr = 0 Then
If EgtGetHeadExitCount(sHead) = 0 Then
MessageBox.Show(EgtMsg(MSG_SETUPERRORS + 8), EgtMsg(MSG_SETUPERRORS + 1), MessageBoxButton.OK, MessageBoxImage.Error)
Return
End If
End If
Index += 1
End While
' Verifico esistenza direttorio per attrezzaggi
Dim sDir As String = IniFile.m_sMachinesRoot & "\" & IniFile.m_sMachineName & "\SetUp"
If Not Directory.Exists(sDir) Then
Try
Directory.CreateDirectory(sDir)
Catch ex As Exception
EgtOutLog("Error in SetupDir creation " & ex.ToString())
Return
End Try
End If
End Sub
#End Region ' Methods
#Region "COMMANDS"
#Region "NewCommand"
''' <summary>
''' Returns a command that create a new tool.
''' </summary>
Public ReadOnly Property NewCommand As ICommand
Get
If m_cmdNew Is Nothing Then
m_cmdNew = New RelayCommand(AddressOf NewPar)
End If
Return m_cmdNew
End Get
End Property
''' <summary>
''' Creata the new tool. This method is invoked by the NewCommand.
''' </summary>
Public Sub NewPar(ByVal param As Object)
EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
' Verifico se sia selezionata una famiglia
Dim NewToolItem As ToolTreeViewItem
If TypeOf param Is FamilyToolTreeViewItem Then
Dim ToolFamily As FamilyToolTreeViewItem = DirectCast(param, FamilyToolTreeViewItem)
Dim NewName As String = ToolFamily.Name
EgtTdbGetToolNewName(NewName)
If EgtTdbAddTool(NewName, ToolFamily.ToolType) Then
NewToolItem = New ToolTreeViewItem(NewName)
ToolFamily.Items.Add(NewToolItem)
EgtTdbSaveCurrTool()
NewToolItem.NewTool = True
If Not ToolFamily.IsExpanded Then ToolFamily.IsExpanded = True
NewToolItem.IsSelected = True
NewToolItem.NotifyPropertyChanged("IsSelected")
End If
' Verifico se sia selezionato un utensile
ElseIf TypeOf param Is ToolTreeViewItem Then
Dim ToolCopied As ToolTreeViewItem = DirectCast(param, ToolTreeViewItem)
Dim NewName As String = ToolCopied.Name
EgtTdbGetToolNewName(NewName)
If EgtTdbCopyTool(ToolCopied.Name, NewName) Then
' Elimino disegno che non deve essere copiato
EgtTdbSetCurrToolParam(MCH_TP.DRAW, String.Empty)
Dim CurrType As Integer
EgtTdbGetCurrToolParam(MCH_TP.TYPE, CurrType)
For Each ToolFamily In ToolsList
If (ToolFamily.ToolType And CurrType) <> 0 Then
NewToolItem = New ToolTreeViewItem(NewName)
ToolFamily.Items.Add(NewToolItem)
EgtTdbSaveCurrTool()
NewToolItem.NewTool = True
' Reimposto l'utensile vecchio nel Db per deselezionarlo e fare le verifiche correttamente
EgtTdbSetCurrTool(ToolCopied.Name)
ToolCopied.IsSelected = False
ToolCopied.NotifyPropertyChanged("IsSelected")
NewToolItem.IsSelected = True
Exit For
End If
Next
End If
End If
End Sub
#End Region ' NewCommand
#Region "SaveCommand"
''' <summary>
''' Returns a command that save the current selected tool.
''' </summary>
Public ReadOnly Property SaveCommand() As ICommand
Get
If m_cmdSave Is Nothing Then
m_cmdSave = New RelayCommand(AddressOf Save)
End If
Return m_cmdSave
End Get
End Property
''' <summary>
''' Saves the current tool. This method is invoked by the SaveCommand.
''' </summary>
Public Sub Save(ByVal param As Object)
Dim CurrTool As ToolTreeViewItem = DirectCast(param, ToolTreeViewItem)
CurrTool.WriteToolParam()
CurrTool.m_Name = CurrTool.m_Name.Trim()
CurrTool.WriteToolName()
EgtTdbSaveCurrTool()
CurrTool.NewTool = False
CurrTool.IsModifiedReset()
IsEnabledBtns(CurrTool.IsValid And Not CurrTool.IsModified, CurrTool.IsValid, True)
End Sub
#End Region ' SaveCommand
#Region "RemoveCommand"
''' <summary>
''' Returns a command that remove the current selected tool.
''' </summary>
Public ReadOnly Property RemoveCommand() As ICommand
Get
If m_cmdRemove Is Nothing Then
m_cmdRemove = New RelayCommand(AddressOf Remove)
End If
Return m_cmdRemove
End Get
End Property
''' <summary>
''' Remove the current selected tools from Db and TreeView. This method is invoked by the RemoveCommand.
''' </summary>
Public Sub Remove(ByVal param As Object)
Dim ToolToRemove As ToolTreeViewItem = DirectCast(param, ToolTreeViewItem)
' Chiedo conferma cancellazione lavorazione
If MessageBox.Show(EgtMsg(MSG_TOOLSERRORS + 22) & " " & ToolToRemove.Name & EgtMsg(MSG_TOOLSERRORS + 23), EgtMsg(MSG_TOOLSERRORS + 24), MessageBoxButton.YesNo, MessageBoxImage.Question) <> MessageBoxResult.Yes Then
Return
End If
RemoveTool(ToolToRemove)
End Sub
Private Sub RemoveTool(ToolToRemove As ToolTreeViewItem)
EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
' Cancello disegno dell'utensile
EraseToolDraw()
' Salvo il tipo di utensile per poterlo cancellare
Dim ToolType As Integer = ToolToRemove.Type
' Cancello l'utensile
Dim CurrToolOriginalName As String = String.Empty
EgtTdbGetToolFromUUID(ToolToRemove.Uuid, CurrToolOriginalName)
EgtTdbRemoveTool(CurrToolOriginalName)
' Rimuovo il nome dell'albero
For Each ToolFamily In ToolsList
If (ToolFamily.ToolType And ToolType) <> 0 Then
ToolFamily.Items.Remove(ToolToRemove)
End If
Next
ErrorOnTool(False)
End Sub
Private Function EraseToolDraw() As Boolean
' nome e direttorio del file da cancellare
EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
Dim sDrawName As String = String.Empty
EgtTdbGetCurrToolParam(MCH_TP.DRAW, sDrawName)
Dim sPath As String = String.Empty
EgtTdbGetToolDir(sPath)
sPath = sPath & "\" & sDrawName
' se automatico ed esiste lo cancello
Try
If IsUUID(Path.GetFileNameWithoutExtension(sPath)) And
My.Computer.FileSystem.FileExists(sPath) Then
My.Computer.FileSystem.DeleteFile(sPath)
End If
Return True
Catch ex As Exception
Return False
End Try
End Function
#End Region ' RemoveCommand
#Region "ReloadToolCommand"
''' <summary>
''' Returns a command that reload the current selected tool.
''' </summary>
Public ReadOnly Property ReloadToolCommand() As ICommand
Get
If m_cmdReloadTool Is Nothing Then
m_cmdReloadTool = New RelayCommand(AddressOf ReloadTool)
End If
Return m_cmdReloadTool
End Get
End Property
''' <summary>
''' Reload the current selected tools. This method is invoked by the RemoveCommand.
''' </summary>
Public Sub ReloadTool(ByVal param As Object)
If TypeOf param Is FamilyToolTreeViewItem Then
Return
' Verifico se sia selezionato un utensile
ElseIf TypeOf param Is ToolTreeViewItem Then
Dim ToolToReload As ToolTreeViewItem = DirectCast(param, ToolTreeViewItem)
EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
ToolToReload.ReadToolParam()
ToolToReload.ReadToolName()
ToolToReload.IsModifiedReset()
End If
End Sub
#End Region ' ReloadToolCommand
#Region "CloseToolDbCommand"
''' <summary>
''' Returns a command that remove the current selected machining.
''' </summary>
Public ReadOnly Property CloseToolsDbCommand() As ICommand
Get
If m_cmdCloseToolsDb Is Nothing Then
m_cmdCloseToolsDb = New RelayCommand(AddressOf CloseToolsDb)
End If
Return m_cmdCloseToolsDb
End Get
End Property
''' <summary>
''' Manage the MachiningDb closing. This method is invoked by the CloseMachiningDbCommand.
''' </summary>
Public Sub CloseToolsDb(param As Object)
m_bActive = False
' Imposto contesto di progetto
EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
' Se selezionata una lavorazione, verifico salvataggio
If TypeOf param Is ToolTreeViewItem Then
Dim CurrTool As ToolTreeViewItem = DirectCast(param, ToolTreeViewItem)
If CurrTool.IsValid Then
CurrTool.WriteToolParam()
If EgtTdbIsCurrToolModified() Or CurrTool.m_IsModifiedName Or CurrTool.NewTool Then
Select Case MsgBox(EgtMsg(MSG_TOOLSERRORS), MsgBoxStyle.YesNo, EgtMsg(MSG_TOOLSERRORS + 1))
Case MsgBoxResult.Yes
CurrTool.NewTool = False
CurrTool.m_Name = CurrTool.m_Name.Trim()
CurrTool.WriteToolName()
EgtTdbSaveCurrTool()
Case MsgBoxResult.No
If CurrTool.NewTool Then
RemoveTool(CurrTool)
ElseIf CurrTool.m_IsModifiedName Then
Dim DbName As String = String.Empty
EgtTdbGetCurrToolParam(MCH_TP.NAME, DbName)
CurrTool.NamePar = DbName
End If
End Select
End If
Else
MessageBox.Show(EgtMsg(MSG_TOOLSERRORS + 29), EgtMsg(MSG_TOOLSERRORS + 26))
Return
End If
End If
' Salvataggio DB utensili
EgtTdbSave()
' Reset lua
EgtLuaResetGlobVar("STU")
' Se c'è il parametro Active sugli utensili
If m_Active_Visibility Then
' aggiorno setup di default
UpdateDefSetup()
End If
' Chiusura finestra
ToolTreeViewItem.m_delRemoveTool = Nothing
ToolTreeViewItem.m_delErrorOnTool = Nothing
ToolTreeViewItem.m_delIsEnabledBtns = Nothing
FamilyToolTreeViewItem.m_delIsEnabledBtns = Nothing
For Each Window In Application.Current.Windows
If TypeOf Window Is ToolsDbV Then
Dim ToolsDbWindow As ToolsDbV = DirectCast(Window, ToolsDbV)
ToolsDbWindow.DataContext = Nothing
ToolsDbWindow.Close()
End If
Next
End Sub
#End Region ' CloseToolsDbCommand
#End Region ' Commands
End Class