Spostato DB Waterjet in EgtWPFLib5
This commit is contained in:
@@ -335,7 +335,7 @@ Public Class MyMachinePanelVM
|
||||
''' Execute the Exec. This method is invoked by the ExecCommand.
|
||||
''' </summary>
|
||||
Public Sub WaterjetDb(ByVal param As Object)
|
||||
Dim WaterjetDbWindow As New WaterjetDbWindowV(Application.Current.MainWindow, New WaterjetDbWindowVM)
|
||||
Dim WaterjetDbWindow As New WaterjetDbWindowV(Application.Current.MainWindow, New WaterjetDbWindowVM(CurrentMachine.sMachDir))
|
||||
WaterjetDbWindow.Height = 546
|
||||
WaterjetDbWindow.Width = 846
|
||||
WaterjetDbWindow.ShowDialog()
|
||||
|
||||
@@ -231,10 +231,6 @@
|
||||
<Compile Include="MachOptionWindow\MachOptionWindowVM.vb" />
|
||||
<Compile Include="MySceneHost\MySceneHostVM.vb" />
|
||||
<Compile Include="MySetUpWindow\MySetUpWindowVM.vb" />
|
||||
<Compile Include="WaterjetDbWindow\WaterjetDbWindowV.xaml.vb">
|
||||
<DependentUpon>WaterjetDbWindowV.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="WaterjetDbWindow\WaterjetDbWindowVM.vb" />
|
||||
<Compile Include="MyToolDbWindow\MyToolDbWindowV.xaml.vb">
|
||||
<DependentUpon>MyToolDbWindowV.xaml</DependentUpon>
|
||||
</Compile>
|
||||
@@ -417,10 +413,6 @@
|
||||
<DependentUpon>MainWindowV.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Page Include="WaterjetDbWindow\WaterjetDbWindowV.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="MyToolDbWindow\MyToolDbWindowV.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
|
||||
@@ -1,183 +0,0 @@
|
||||
<EgtWPFLib5:EgtCustomWindow x:Class="WaterjetDbWindowV"
|
||||
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:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5"
|
||||
Title="{Binding Title_Msg}"
|
||||
Style="{DynamicResource {x:Type EgtWPFLib5:EgtCustomWindow}}"
|
||||
WindowStyle="None" ResizeMode="NoResize" TitleBarHeight="30" IsResizable="False"
|
||||
IsMinimizable="False" WindowStartupLocation="CenterOwner" ShowInTaskbar="False"
|
||||
CloseCommand="{Binding CloseWaterjetDbCommand,Mode=OneWay,UpdateSourceTrigger=PropertyChanged}">
|
||||
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="10*"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid Grid.Row="0" Grid.RowSpan="2">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="3*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<ListBox x:Name="MaterialListBox"
|
||||
ItemsSource="{Binding MaterialList}"
|
||||
DisplayMemberPath="Name"
|
||||
SelectedItem="{Binding SelMaterial}"
|
||||
Grid.Column="0"/>
|
||||
|
||||
<ListBox x:Name="SubMaterialListBox"
|
||||
ItemsSource="{Binding Path=SelectedItem.SubMaterialList, ElementName=MaterialListBox}"
|
||||
DisplayMemberPath="Name"
|
||||
SelectedItem="{Binding Path=SelectedItem.SelSubMaterial, ElementName=MaterialListBox}"
|
||||
Grid.Column="1"/>
|
||||
|
||||
<DataGrid ItemsSource="{Binding Path=SelectedItem.ParamList, ElementName=SubMaterialListBox}"
|
||||
SelectedItem="{Binding Path=SelectedItem.SelWjParam, ElementName=SubMaterialListBox}"
|
||||
Grid.Column="2"
|
||||
AutoGenerateColumns="False">
|
||||
<DataGrid.Columns>
|
||||
<!--Thickness-->
|
||||
<DataGridTextColumn Binding="{Binding Thickness}"
|
||||
Width="*">
|
||||
<DataGridTextColumn.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding DataContext.Thickness_Msg,RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
|
||||
</DataTemplate>
|
||||
</DataGridTextColumn.HeaderTemplate>
|
||||
</DataGridTextColumn>
|
||||
<!--Q1-->
|
||||
<DataGridTextColumn Binding="{Binding Q1}"
|
||||
Width="*">
|
||||
<DataGridTextColumn.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding DataContext.Q1_Msg,RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
|
||||
</DataTemplate>
|
||||
</DataGridTextColumn.HeaderTemplate>
|
||||
</DataGridTextColumn>
|
||||
<!--Q2-->
|
||||
<DataGridTextColumn Binding="{Binding Q2}"
|
||||
Width="*">
|
||||
<DataGridTextColumn.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding DataContext.Q2_Msg,RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
|
||||
</DataTemplate>
|
||||
</DataGridTextColumn.HeaderTemplate>
|
||||
</DataGridTextColumn>
|
||||
<!--Q3-->
|
||||
<DataGridTextColumn Binding="{Binding Q3}"
|
||||
Width="*">
|
||||
<DataGridTextColumn.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding DataContext.Q3_Msg,RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
|
||||
</DataTemplate>
|
||||
</DataGridTextColumn.HeaderTemplate>
|
||||
</DataGridTextColumn>
|
||||
<!--Q4-->
|
||||
<DataGridTextColumn Binding="{Binding Q4}"
|
||||
Width="*">
|
||||
<DataGridTextColumn.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding DataContext.Q4_Msg,RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
|
||||
</DataTemplate>
|
||||
</DataGridTextColumn.HeaderTemplate>
|
||||
</DataGridTextColumn>
|
||||
<!--Q5-->
|
||||
<DataGridTextColumn Binding="{Binding Q5}"
|
||||
Width="*">
|
||||
<DataGridTextColumn.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding DataContext.Q5_Msg,RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
|
||||
</DataTemplate>
|
||||
</DataGridTextColumn.HeaderTemplate>
|
||||
</DataGridTextColumn>
|
||||
<!--QExtra-->
|
||||
<DataGridTextColumn Binding="{Binding QExtra}"
|
||||
Width="*">
|
||||
<DataGridTextColumn.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding DataContext.QExtra_Msg,RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
|
||||
</DataTemplate>
|
||||
</DataGridTextColumn.HeaderTemplate>
|
||||
</DataGridTextColumn>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
|
||||
</Grid>
|
||||
|
||||
<Grid Grid.Row="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="3*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBox Grid.Column="0" Text="{Binding sNewMaterial, UpdateSourceTrigger=PropertyChanged}" Visibility="{Binding NewMaterial_Visibility}" Height="20" Margin="10,0">
|
||||
<TextBox.InputBindings>
|
||||
<KeyBinding Key="Enter" Command="{Binding DoneCommand}"/>
|
||||
<KeyBinding Key="Esc" Command="{Binding CancelCommand}"/>
|
||||
</TextBox.InputBindings>
|
||||
</TextBox>
|
||||
<TextBox Grid.Column="1" Text="{Binding sNewSubMaterial, UpdateSourceTrigger=PropertyChanged}" Visibility="{Binding NewSubMaterial_Visibility}" Height="20" Margin="10,0">
|
||||
<TextBox.InputBindings>
|
||||
<KeyBinding Key="Enter" Command="{Binding DoneCommand}"/>
|
||||
<KeyBinding Key="Esc" Command="{Binding CancelCommand}"/>
|
||||
</TextBox.InputBindings>
|
||||
</TextBox>
|
||||
|
||||
<!--<Grid DockPanel.Dock="Bottom" Visibility="{Binding NewMaterial_Visibility}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="4*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<EgtWPFLib5:EgtTextBox Text="{Binding sNewMaterial}"
|
||||
DockPanel.Dock="Bottom"
|
||||
Margin="0,0,0,5"/>
|
||||
<Button Content="{Binding OkMsg}" Grid.Column="1"
|
||||
Command="{Binding DoneCommand}"
|
||||
IsEnabled="{Binding EnableOkNewMat}"
|
||||
Style="{StaticResource OptionPanel_TextButton}"
|
||||
Margin="2.5,0,0,2.5"/>
|
||||
<Button Content="{Binding CancelMsg}" Grid.Column="2"
|
||||
Command="{Binding CamcelCommand}"
|
||||
Style="{StaticResource OptionPanel_TextButton}"
|
||||
Margin="2.5,0,0,2.5"/>
|
||||
</Grid>-->
|
||||
|
||||
</Grid>
|
||||
|
||||
<Grid Grid.Row="2">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="5*"/>
|
||||
<ColumnDefinition Width="2*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Button Grid.Column="0" Command="{Binding NewMaterialCommand}" Content="{Binding New_Msg}"/>
|
||||
<Button Grid.Column="1" Command="{Binding ModifyMaterialCommand}" Content="{Binding Modify_Msg}"/>
|
||||
<Button Grid.Column="2" Command="{Binding DeleteMaterialCommand}" Content="{Binding Delete_Msg}"/>
|
||||
<Button Grid.Column="3" Command="{Binding NewSubMaterialCommand}" Content="{Binding New_Msg}"/>
|
||||
<Button Grid.Column="4" Command="{Binding ModifySubMaterialCommand}" Content="{Binding Modify_Msg}"/>
|
||||
<Button Grid.Column="5" Command="{Binding DeleteSubMaterialCommand}" Content="{Binding Delete_Msg}"/>
|
||||
<Button Grid.Column="6" Command="{Binding NewWjParamCommand}" Content="{Binding New_Msg}"/>
|
||||
<Button Grid.Column="7" Command="{Binding DeleteWjParamCommand}" Content="{Binding Delete_Msg}"/>
|
||||
|
||||
<Button Grid.Column="9" Command="{Binding SaveCommand}" Content="{Binding Save_Msg}"/>
|
||||
|
||||
</Grid>
|
||||
|
||||
</Grid>
|
||||
|
||||
</EgtWPFLib5:EgtCustomWindow>
|
||||
@@ -1,18 +0,0 @@
|
||||
Public Class WaterjetDbWindowV
|
||||
|
||||
Private WithEvents m_WaterjetDbWindowVM As WaterjetDbWindowVM
|
||||
|
||||
Sub New(Owner As Window, WaterjetDbWindowVM As WaterjetDbWindowVM)
|
||||
MyBase.New(Owner)
|
||||
' This call is required by the designer.
|
||||
InitializeComponent()
|
||||
Me.DataContext = WaterjetDbWindowVM
|
||||
' Assegno al riferimento locale al VM il VM preso dal DataContext
|
||||
m_WaterjetDbWindowVM = WaterjetDbWindowVM
|
||||
End Sub
|
||||
|
||||
Private Sub CloseWindow(bDialogResult As Boolean) Handles m_WaterjetDbWindowVM.m_CloseWindow
|
||||
Me.DialogResult = bDialogResult
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
@@ -1,831 +0,0 @@
|
||||
Imports System.Collections.ObjectModel
|
||||
Imports System.IO
|
||||
Imports EgtUILib
|
||||
Imports EgtWPFLib5
|
||||
|
||||
Public Class WaterjetDbWindowVM
|
||||
Inherits VMBase
|
||||
|
||||
#Region "FIELDS & PROPERTIES"
|
||||
|
||||
Private Property m_MaterialList As ObservableCollection(Of WjMaterial)
|
||||
Public Property MaterialList As ObservableCollection(Of WjMaterial)
|
||||
Get
|
||||
Return m_MaterialList
|
||||
End Get
|
||||
Set(value As ObservableCollection(Of WjMaterial))
|
||||
m_MaterialList = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private Property m_SelMaterial As WjMaterial
|
||||
Public Property SelMaterial As WjMaterial
|
||||
Get
|
||||
Return m_SelMaterial
|
||||
End Get
|
||||
Set(value As WjMaterial)
|
||||
m_SelMaterial = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private Property m_SubMaterialList As New ObservableCollection(Of WjSubMaterial)
|
||||
Public Property SubMaterialList As ObservableCollection(Of WjSubMaterial)
|
||||
Get
|
||||
Return m_SubMaterialList
|
||||
End Get
|
||||
Set(value As ObservableCollection(Of WjSubMaterial))
|
||||
m_SubMaterialList = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private Property m_SelSubMaterial As WjSubMaterial
|
||||
Public Property SelSubMaterial As WjSubMaterial
|
||||
Get
|
||||
Return m_SelSubMaterial
|
||||
End Get
|
||||
Set(value As WjSubMaterial)
|
||||
m_SelSubMaterial = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private Property m_ParamList As ObservableCollection(Of WjParam)
|
||||
Public Property ParamList As ObservableCollection(Of WjParam)
|
||||
Get
|
||||
Return m_ParamList
|
||||
End Get
|
||||
Set(value As ObservableCollection(Of WjParam))
|
||||
m_ParamList = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private Property m_sNewMaterial As String
|
||||
Public Property sNewMaterial As String
|
||||
Get
|
||||
Return m_sNewMaterial
|
||||
End Get
|
||||
Set(value As String)
|
||||
m_sNewMaterial = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private Property m_sNewSubMaterial As String
|
||||
Public Property sNewSubMaterial As String
|
||||
Get
|
||||
Return m_sNewSubMaterial
|
||||
End Get
|
||||
Set(value As String)
|
||||
m_sNewSubMaterial = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private Property m_NewMaterial_Visibility As Visibility = Visibility.Collapsed
|
||||
Public Property NewMaterial_Visibility As Visibility
|
||||
Get
|
||||
Return m_NewMaterial_Visibility
|
||||
End Get
|
||||
Set(value As Visibility)
|
||||
m_NewMaterial_Visibility = value
|
||||
NotifyPropertyChanged(NameOf(NewMaterial_Visibility))
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private Property m_NewSubMaterial_Visibility As Visibility = Visibility.Collapsed
|
||||
Public Property NewSubMaterial_Visibility As Visibility
|
||||
Get
|
||||
Return m_NewSubMaterial_Visibility
|
||||
End Get
|
||||
Set(value As Visibility)
|
||||
m_NewSubMaterial_Visibility = value
|
||||
NotifyPropertyChanged(NameOf(NewSubMaterial_Visibility))
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Const K_WATERJETDB = "WaterjetDb"
|
||||
Public Const S_MATERIALS = "Materials"
|
||||
|
||||
Public Event m_CloseWindow(bDialogResult As Boolean)
|
||||
|
||||
' flag per differenziare Nuova e Modifica nella TextBox
|
||||
Public bModify As Boolean = False
|
||||
' flag per aggiunte, modifiche, eliminazioni
|
||||
Public bIsModified As Boolean = False
|
||||
|
||||
' Definizione comandi
|
||||
Private m_cmdNewMaterial As ICommand
|
||||
Private m_cmdModifyMaterial As ICommand
|
||||
Private m_cmdDeleteMaterial As ICommand
|
||||
Private m_cmdNewSubMaterial As ICommand
|
||||
Private m_cmdModifySubMaterial As ICommand
|
||||
Private m_cmdDeleteSubMaterial As ICommand
|
||||
Private m_cmdNewWjParam As ICommand
|
||||
Private m_cmdDeleteWjParam As ICommand
|
||||
Private m_cmdSave As ICommand
|
||||
Private m_cmdDone As ICommand
|
||||
Private m_cmdCancel As ICommand
|
||||
Private m_cmdCloseWaterjetDb As ICommand
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "MESSAGES"
|
||||
|
||||
Public ReadOnly Property Title_Msg As String
|
||||
Get
|
||||
Return EgtMsg(31751)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property Thickness_Msg As String
|
||||
Get
|
||||
Return EgtMsg(31752)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property Q1_Msg As String
|
||||
Get
|
||||
Return EgtMsg(31753)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property Q2_Msg As String
|
||||
Get
|
||||
Return EgtMsg(31754)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property Q3_Msg As String
|
||||
Get
|
||||
Return EgtMsg(31755)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property Q4_Msg As String
|
||||
Get
|
||||
Return EgtMsg(31756)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property Q5_Msg As String
|
||||
Get
|
||||
Return EgtMsg(31757)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property QExtra_Msg As String
|
||||
Get
|
||||
Return EgtMsg(31758)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property New_Msg As String
|
||||
Get
|
||||
Return EgtMsg(31701)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property Modify_Msg As String
|
||||
Get
|
||||
Return EgtMsg(31704)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property Delete_Msg As String
|
||||
Get
|
||||
Return EgtMsg(31703)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property Save_Msg As String
|
||||
Get
|
||||
Return EgtMsg(31702)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "CONSTRUCTOR"
|
||||
|
||||
Sub New()
|
||||
' Leggo valori da file INI e li carico nelle proprietà
|
||||
Dim sFilePath As String = CurrentMachine.sMachDir & "\" & K_WATERJETDB & ".ini"
|
||||
MaterialList = New ObservableCollection(Of WjMaterial)
|
||||
If File.Exists(sFilePath) Then
|
||||
Dim sMaterial As String = String.Empty
|
||||
'recupero i Materiali
|
||||
If EgtUILib.GetPrivateProfileString(S_MATERIALS, "1", "", sMaterial, sFilePath) > 0 Then
|
||||
Dim sMaterials() As String = sMaterial.Split(","c)
|
||||
For ind = 0 To sMaterials.Length() - 1
|
||||
'recupero i Sottomateriali
|
||||
Dim Index As Integer = 1
|
||||
Dim sSubMat As String = String.Empty
|
||||
Dim SubMatList As New ObservableCollection(Of WjSubMaterial)
|
||||
While EgtUILib.GetPrivateProfileString(sMaterials(ind), Index.ToString(), "", sSubMat, sFilePath) > 0
|
||||
' recupero la lista dei Q
|
||||
Dim QInd As Integer = 1
|
||||
Dim sParam As String = String.Empty
|
||||
Dim QParamList As New ObservableCollection(Of WjParam)
|
||||
While EgtUILib.GetPrivateProfileString(sMaterials(ind) & "." & sSubMat, QInd.ToString(), "", sParam, sFilePath) > 0
|
||||
Dim sParams() As String = sParam.Split(","c)
|
||||
If sParams.Length() >= 7 Then
|
||||
Dim dThickness As Double
|
||||
Dim dQ1 As Double
|
||||
Dim dQ2 As Double
|
||||
Dim dQ3 As Double
|
||||
Dim dQ4 As Double
|
||||
Dim dQ5 As Double
|
||||
Dim dQExtra As Double
|
||||
StringToDouble(sParams(0), dThickness)
|
||||
StringToDouble(sParams(1), dQ1)
|
||||
StringToDouble(sParams(2), dQ2)
|
||||
StringToDouble(sParams(3), dQ3)
|
||||
StringToDouble(sParams(4), dQ4)
|
||||
StringToDouble(sParams(5), dQ5)
|
||||
StringToDouble(sParams(6), dQExtra)
|
||||
QParamList.Add(New WjParam(QInd, dThickness, dQ1, dQ2, dQ3, dQ4, dQ5, dQExtra))
|
||||
End If
|
||||
QInd += 1
|
||||
End While
|
||||
SubMatList.Add(New WjSubMaterial(sSubMat, QParamList))
|
||||
Index += 1
|
||||
End While
|
||||
MaterialList.Add(New WjMaterial(sMaterials(ind), SubMatList))
|
||||
Next
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
|
||||
#End Region ' Constructor
|
||||
|
||||
#Region "COMMANDS"
|
||||
|
||||
#Region "NewMaterialCommand"
|
||||
|
||||
Public ReadOnly Property NewMaterialCommand As ICommand
|
||||
Get
|
||||
If m_cmdNewMaterial Is Nothing Then
|
||||
m_cmdNewMaterial = New Command(AddressOf NewMaterial)
|
||||
End If
|
||||
Return m_cmdNewMaterial
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Sub NewMaterial(ByVal param As Object)
|
||||
NewSubMaterial_Visibility = Visibility.Collapsed
|
||||
NewMaterial_Visibility = Visibility.Visible
|
||||
End Sub
|
||||
|
||||
#End Region ' NewMaterial
|
||||
|
||||
#Region "ModifyMaterialCommand"
|
||||
|
||||
Public ReadOnly Property ModifyMaterialCommand As ICommand
|
||||
Get
|
||||
If m_cmdModifyMaterial Is Nothing Then
|
||||
m_cmdModifyMaterial = New Command(AddressOf ModifyMaterial)
|
||||
End If
|
||||
Return m_cmdModifyMaterial
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Sub ModifyMaterial(ByVal param As Object)
|
||||
NewSubMaterial_Visibility = Visibility.Collapsed
|
||||
NewMaterial_Visibility = Visibility.Visible
|
||||
bModify = True
|
||||
End Sub
|
||||
|
||||
#End Region ' ModifyMaterial
|
||||
|
||||
#Region "DeleteMaterialCommand"
|
||||
|
||||
Public ReadOnly Property DeleteMaterialCommand As ICommand
|
||||
Get
|
||||
If m_cmdDeleteMaterial Is Nothing Then
|
||||
m_cmdDeleteMaterial = New Command(AddressOf DeleteMaterial)
|
||||
End If
|
||||
Return m_cmdDeleteMaterial
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Sub DeleteMaterial(ByVal param As Object)
|
||||
If Not IsNothing(SelMaterial) Then
|
||||
MaterialList.Remove(SelMaterial)
|
||||
bIsModified = True
|
||||
End If
|
||||
End Sub
|
||||
|
||||
#End Region ' DeleteMaterial
|
||||
|
||||
#Region "NewSubMaterialCommand"
|
||||
|
||||
Public ReadOnly Property NewSubMaterialCommand As ICommand
|
||||
Get
|
||||
If m_cmdNewSubMaterial Is Nothing Then
|
||||
m_cmdNewSubMaterial = New Command(AddressOf NewSubMaterial)
|
||||
End If
|
||||
Return m_cmdNewSubMaterial
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Sub NewSubMaterial(ByVal param As Object)
|
||||
If Not IsNothing(SelMaterial) Then
|
||||
NewMaterial_Visibility = Visibility.Collapsed
|
||||
NewSubMaterial_Visibility = Visibility.Visible
|
||||
End If
|
||||
End Sub
|
||||
|
||||
#End Region ' NewSubMaterial
|
||||
|
||||
#Region "ModifyMaterialCommand"
|
||||
|
||||
Public ReadOnly Property ModifySubMaterialCommand As ICommand
|
||||
Get
|
||||
If m_cmdModifySubMaterial Is Nothing Then
|
||||
m_cmdModifySubMaterial = New Command(AddressOf ModifySubMaterial)
|
||||
End If
|
||||
Return m_cmdModifySubMaterial
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Sub ModifySubMaterial(ByVal param As Object)
|
||||
NewMaterial_Visibility = Visibility.Collapsed
|
||||
NewSubMaterial_Visibility = Visibility.Visible
|
||||
bModify = True
|
||||
End Sub
|
||||
|
||||
#End Region ' ModifyMaterial
|
||||
|
||||
#Region "DeleteSubMaterialCommand"
|
||||
|
||||
Public ReadOnly Property DeleteSubMaterialCommand As ICommand
|
||||
Get
|
||||
If m_cmdDeleteSubMaterial Is Nothing Then
|
||||
m_cmdDeleteSubMaterial = New Command(AddressOf DeleteSubMaterial)
|
||||
End If
|
||||
Return m_cmdDeleteSubMaterial
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Sub DeleteSubMaterial(ByVal param As Object)
|
||||
If Not IsNothing(SelMaterial.SelSubMaterial) Then
|
||||
SelMaterial.SubMaterialList.Remove(SelMaterial.SelSubMaterial)
|
||||
bIsModified = True
|
||||
End If
|
||||
End Sub
|
||||
|
||||
#End Region ' DeleteSubMaterial
|
||||
|
||||
#Region "NewWjParamCommand"
|
||||
|
||||
Public ReadOnly Property NewWjParamCommand As ICommand
|
||||
Get
|
||||
If m_cmdNewWjParam Is Nothing Then
|
||||
m_cmdNewWjParam = New Command(AddressOf NewWjParam)
|
||||
End If
|
||||
Return m_cmdNewWjParam
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Sub NewWjParam(ByVal param As Object)
|
||||
If Not IsNothing(SelMaterial.SelSubMaterial) Then
|
||||
Dim nId As Integer = 0
|
||||
If IsNothing(SelMaterial.SelSubMaterial.ParamList) Then
|
||||
nId = 1
|
||||
SelMaterial.SelSubMaterial.ParamList = New ObservableCollection(Of WjParam)
|
||||
Else
|
||||
nId = SelMaterial.SelSubMaterial.ParamList.Count + 1
|
||||
End If
|
||||
SelMaterial.SelSubMaterial.ParamList.Add(New WjParam(nId, 0, 0, 0, 0, 0, 0, 0))
|
||||
SelMaterial.SelSubMaterial.NotifyPropertyChanged(NameOf(ParamList))
|
||||
bIsModified = True
|
||||
End If
|
||||
End Sub
|
||||
|
||||
#End Region ' NewWjParam
|
||||
|
||||
#Region "DeleteWjParamCommand"
|
||||
|
||||
Public ReadOnly Property DeleteWjParamCommand As ICommand
|
||||
Get
|
||||
If m_cmdDeleteWjParam Is Nothing Then
|
||||
m_cmdDeleteWjParam = New Command(AddressOf DeleteWjParam)
|
||||
End If
|
||||
Return m_cmdDeleteWjParam
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Sub DeleteWjParam(ByVal param As Object)
|
||||
If Not IsNothing(SelMaterial.SelSubMaterial.SelWjParam) Then
|
||||
SelMaterial.SelSubMaterial.ParamList.Remove(SelMaterial.SelSubMaterial.SelWjParam)
|
||||
SelMaterial.SelSubMaterial.NotifyPropertyChanged(NameOf(ParamList))
|
||||
bIsModified = True
|
||||
End If
|
||||
End Sub
|
||||
|
||||
#End Region ' DeleteWjParam
|
||||
|
||||
#Region "DoneCommand"
|
||||
|
||||
Public ReadOnly Property DoneCommand As ICommand
|
||||
Get
|
||||
If m_cmdDone Is Nothing Then
|
||||
m_cmdDone = New Command(AddressOf Done)
|
||||
End If
|
||||
Return m_cmdDone
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Sub Done(ByVal param As Object)
|
||||
If NewMaterial_Visibility = Visibility.Visible Then
|
||||
If bModify Then
|
||||
Dim tempMat As WjMaterial = SelMaterial
|
||||
tempMat.Name = sNewMaterial
|
||||
Dim tempIndex As Integer = MaterialList.IndexOf(SelMaterial)
|
||||
MaterialList.RemoveAt(tempIndex)
|
||||
MaterialList.Insert(tempIndex, tempMat)
|
||||
NotifyPropertyChanged(NameOf(MaterialList))
|
||||
sNewMaterial = String.Empty
|
||||
NewMaterial_Visibility = Visibility.Collapsed
|
||||
bModify = False
|
||||
Else
|
||||
MaterialList.Add(New WjMaterial(sNewMaterial))
|
||||
MaterialList.Last.SubMaterialList = New ObservableCollection(Of WjSubMaterial)
|
||||
NotifyPropertyChanged(NameOf(MaterialList))
|
||||
sNewMaterial = String.Empty
|
||||
NewMaterial_Visibility = Visibility.Collapsed
|
||||
End If
|
||||
ElseIf NewSubMaterial_Visibility = Visibility.Visible Then
|
||||
If bModify Then
|
||||
Dim tempSubMat As WjSubMaterial = SelMaterial.SelSubMaterial
|
||||
tempSubMat.Name = sNewSubMaterial
|
||||
Dim tempIndex As Integer = SelMaterial.SubMaterialList.IndexOf(SelMaterial.SelSubMaterial)
|
||||
SelMaterial.SubMaterialList.RemoveAt(tempIndex)
|
||||
SelMaterial.SubMaterialList.Insert(tempIndex, tempSubMat)
|
||||
NotifyPropertyChanged(NameOf(SubMaterialList))
|
||||
sNewSubMaterial = String.Empty
|
||||
NewSubMaterial_Visibility = Visibility.Collapsed
|
||||
bModify = False
|
||||
Else
|
||||
SelMaterial.SubMaterialList.Add(New WjSubMaterial(sNewSubMaterial))
|
||||
NotifyPropertyChanged(NameOf(SubMaterialList))
|
||||
sNewSubMaterial = String.Empty
|
||||
NewSubMaterial_Visibility = Visibility.Collapsed
|
||||
End If
|
||||
End If
|
||||
bIsModified = True
|
||||
End Sub
|
||||
|
||||
#End Region ' Done
|
||||
|
||||
#Region "SaveCommand"
|
||||
|
||||
Public ReadOnly Property SaveCommand As ICommand
|
||||
Get
|
||||
If m_cmdSave Is Nothing Then
|
||||
m_cmdSave = New Command(AddressOf Save)
|
||||
End If
|
||||
Return m_cmdSave
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Sub Save(ByVal param As Object)
|
||||
WriteWaterjetDb()
|
||||
bIsModified = False
|
||||
End Sub
|
||||
|
||||
#End Region ' Save
|
||||
|
||||
#Region "CancelCommand"
|
||||
|
||||
Public ReadOnly Property CancelCommand As ICommand
|
||||
Get
|
||||
If m_cmdCancel Is Nothing Then
|
||||
m_cmdCancel = New Command(AddressOf Cancel)
|
||||
End If
|
||||
Return m_cmdCancel
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Sub Cancel(ByVal param As Object)
|
||||
NewMaterial_Visibility = Visibility.Collapsed
|
||||
NewSubMaterial_Visibility = Visibility.Collapsed
|
||||
End Sub
|
||||
|
||||
#End Region ' Cancel
|
||||
|
||||
#Region "CloseWaterjetDbCommand"
|
||||
|
||||
Public ReadOnly Property CloseWaterjetDbCommand As ICommand
|
||||
Get
|
||||
If m_cmdCloseWaterjetDb Is Nothing Then
|
||||
m_cmdCloseWaterjetDb = New Command(AddressOf CloseWaterjetDb)
|
||||
End If
|
||||
Return m_cmdCloseWaterjetDb
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Sub CloseWaterjetDb(ByVal param As Object)
|
||||
If bIsModified Then
|
||||
Select Case MsgBox(EgtMsg(31759), MsgBoxStyle.YesNoCancel, EgtMsg(31402))
|
||||
Case MsgBoxResult.Cancel
|
||||
Return
|
||||
Case MsgBoxResult.Yes
|
||||
WriteWaterjetDb()
|
||||
Case MsgBoxResult.No
|
||||
RaiseEvent m_CloseWindow(True)
|
||||
End Select
|
||||
Else
|
||||
Dim bExitFor As Boolean = False
|
||||
For Each Material In MaterialList
|
||||
For Each SubMaterial In Material.SubMaterialList
|
||||
For Each QParam In SubMaterial.ParamList
|
||||
bExitFor = QParam.IsModified()
|
||||
If bExitFor Then Exit For
|
||||
Next
|
||||
If bExitFor Then Exit For
|
||||
Next
|
||||
If bExitFor Then Exit For
|
||||
Next
|
||||
If bExitFor Then
|
||||
Select Case MsgBox(EgtMsg(31759), MsgBoxStyle.YesNoCancel, EgtMsg(31402))
|
||||
Case MsgBoxResult.Cancel
|
||||
Return
|
||||
Case MsgBoxResult.Yes
|
||||
WriteWaterjetDb()
|
||||
Case MsgBoxResult.No
|
||||
RaiseEvent m_CloseWindow(True)
|
||||
End Select
|
||||
End If
|
||||
End If
|
||||
RaiseEvent m_CloseWindow(True)
|
||||
End Sub
|
||||
|
||||
#End Region ' CloseWaterjetDb
|
||||
|
||||
#End Region ' Commands
|
||||
|
||||
#Region "METHODS"
|
||||
|
||||
Public Sub WriteWaterjetDb()
|
||||
' cambio il nome del file INI attuale e ne riscrivo uno completamente nuovo
|
||||
Dim sFilePath As String = CurrentMachine.sMachDir & "\" & K_WATERJETDB & ".ini"
|
||||
Dim sOldFilePath As String = CurrentMachine.sMachDir & "\" & K_WATERJETDB & ".OLD.ini"
|
||||
If File.Exists(sOldFilePath) Then
|
||||
File.Delete(sOldFilePath)
|
||||
End If
|
||||
FileSystem.Rename(sFilePath, sOldFilePath)
|
||||
' scrivo la sezione dei Materiali
|
||||
Dim sMaterial As String = String.Empty
|
||||
For Each Material In MaterialList
|
||||
sMaterial &= Material.Name & ","
|
||||
Next
|
||||
EgtUILib.WritePrivateProfileString(S_MATERIALS, "1", sMaterial.TrimEnd(","c) & Environment.NewLine, sFilePath)
|
||||
For Each Material In MaterialList
|
||||
If Not IsNothing(Material.SubMaterialList) AndAlso Material.SubMaterialList.Count > 0 Then
|
||||
' scrivo la sezione dei Sottomateriali
|
||||
Dim SubMatIndex As Integer = 1
|
||||
For Each SubMaterial In Material.SubMaterialList
|
||||
WritePrivateProfileString(Material.Name, SubMatIndex.ToString(), SubMaterial.Name &
|
||||
If(SubMatIndex < Material.SubMaterialList.Count, "", Environment.NewLine), sFilePath)
|
||||
SubMatIndex += 1
|
||||
If Not IsNothing(SubMaterial.ParamList) AndAlso SubMaterial.ParamList.Count > 0 Then
|
||||
' Scrivo la sezione dei Parametri dei Sottomateriali
|
||||
Dim ParamIndex As Integer = 1
|
||||
For Each ParamItem In SubMaterial.ParamList
|
||||
WritePrivateProfileString(Material.Name & "." & SubMaterial.Name, ParamIndex.ToString(),
|
||||
DoubleToString(ParamItem.Thickness, 3) & "," &
|
||||
DoubleToString(ParamItem.Q1, 3) & "," &
|
||||
DoubleToString(ParamItem.Q2, 3) & "," &
|
||||
DoubleToString(ParamItem.Q3, 3) & "," &
|
||||
DoubleToString(ParamItem.Q4, 3) & "," &
|
||||
DoubleToString(ParamItem.Q5, 3) & "," &
|
||||
DoubleToString(ParamItem.QExtra, 3) & If(ParamIndex < SubMaterial.ParamList.Count, "", Environment.NewLine), sFilePath)
|
||||
ParamItem.IsModifiedReset()
|
||||
ParamIndex += 1
|
||||
Next
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
Next
|
||||
End Sub
|
||||
|
||||
#End Region ' Methods
|
||||
|
||||
End Class
|
||||
|
||||
Public Class WjMaterial
|
||||
Inherits VMBase
|
||||
|
||||
Private m_Name As String
|
||||
Public Property Name As String
|
||||
Get
|
||||
Return m_Name
|
||||
End Get
|
||||
Set(value As String)
|
||||
m_Name = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_SubMaterialList As ObservableCollection(Of WjSubMaterial)
|
||||
Public Property SubMaterialList As ObservableCollection(Of WjSubMaterial)
|
||||
Get
|
||||
Return m_SubMaterialList
|
||||
End Get
|
||||
Set(value As ObservableCollection(Of WjSubMaterial))
|
||||
m_SubMaterialList = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private Property m_SelSubMaterial As WjSubMaterial
|
||||
Public Property SelSubMaterial As WjSubMaterial
|
||||
Get
|
||||
Return m_SelSubMaterial
|
||||
End Get
|
||||
Set(value As WjSubMaterial)
|
||||
m_SelSubMaterial = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Sub New(sName As String, SubMatList As ObservableCollection(Of WjSubMaterial))
|
||||
m_Name = sName
|
||||
m_SubMaterialList = SubMatList
|
||||
End Sub
|
||||
|
||||
Sub New(sName As String)
|
||||
m_Name = sName
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
Public Class WjSubMaterial
|
||||
Inherits VMBase
|
||||
|
||||
Private m_Name As String
|
||||
Public Property Name As String
|
||||
Get
|
||||
Return m_Name
|
||||
End Get
|
||||
Set(value As String)
|
||||
m_Name = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_ParamList As ObservableCollection(Of WjParam)
|
||||
Public Property ParamList As ObservableCollection(Of WjParam)
|
||||
Get
|
||||
Return m_ParamList
|
||||
End Get
|
||||
Set(value As ObservableCollection(Of WjParam))
|
||||
m_ParamList = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private Property m_SelWjParam As WjParam
|
||||
Public Property SelWjParam As WjParam
|
||||
Get
|
||||
Return m_SelWjParam
|
||||
End Get
|
||||
Set(value As WjParam)
|
||||
m_SelWjParam = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Sub New(sName As String, ParamList As ObservableCollection(Of WjParam))
|
||||
m_Name = sName
|
||||
m_ParamList = ParamList
|
||||
End Sub
|
||||
|
||||
Sub New(sName As String)
|
||||
m_Name = sName
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
Public Class WjParam
|
||||
|
||||
Private m_Id As Integer
|
||||
Public Property Id As Integer
|
||||
Get
|
||||
Return m_Id
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
m_Id = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_IsModifiedThickness As Boolean = False
|
||||
Private m_Thickness As Double
|
||||
Public Property Thickness As Double
|
||||
Get
|
||||
Return m_Thickness
|
||||
End Get
|
||||
Set(value As Double)
|
||||
m_IsModifiedThickness = Math.Abs(value - m_Thickness) > 10 * EPS_ANG_SMALL
|
||||
m_Thickness = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_IsModifiedQ1 As Boolean = False
|
||||
Private m_Q1 As Double
|
||||
Public Property Q1 As Double
|
||||
Get
|
||||
Return m_Q1
|
||||
End Get
|
||||
Set(value As Double)
|
||||
m_IsModifiedQ1 = Math.Abs(value - m_Q1) > 10 * EPS_ANG_SMALL
|
||||
m_Q1 = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_IsModifiedQ2 As Boolean = False
|
||||
Private m_Q2 As Double
|
||||
Public Property Q2 As Double
|
||||
Get
|
||||
Return m_Q2
|
||||
End Get
|
||||
Set(value As Double)
|
||||
m_IsModifiedQ2 = Math.Abs(value - m_Q2) > 10 * EPS_ANG_SMALL
|
||||
m_Q2 = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_IsModifiedQ3 As Boolean = False
|
||||
Private m_Q3 As Double
|
||||
Public Property Q3 As Double
|
||||
Get
|
||||
Return m_Q3
|
||||
End Get
|
||||
Set(value As Double)
|
||||
m_IsModifiedQ3 = Math.Abs(value - m_Q3) > 10 * EPS_ANG_SMALL
|
||||
m_Q3 = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_IsModifiedQ4 As Boolean = False
|
||||
Private m_Q4 As Double
|
||||
Public Property Q4 As Double
|
||||
Get
|
||||
Return m_Q4
|
||||
End Get
|
||||
Set(value As Double)
|
||||
m_IsModifiedQ4 = Math.Abs(value - m_Q4) > 10 * EPS_ANG_SMALL
|
||||
m_Q4 = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_IsModifiedQ5 As Boolean = False
|
||||
Private m_Q5 As Double
|
||||
Public Property Q5 As Double
|
||||
Get
|
||||
Return m_Q5
|
||||
End Get
|
||||
Set(value As Double)
|
||||
m_IsModifiedQ5 = Math.Abs(value - m_Q5) > 10 * EPS_ANG_SMALL
|
||||
m_Q5 = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_IsModifiedQExtra As Boolean = False
|
||||
Private m_QExtra As Double
|
||||
Public Property QExtra As Double
|
||||
Get
|
||||
Return m_QExtra
|
||||
End Get
|
||||
Set(value As Double)
|
||||
m_IsModifiedQExtra = Math.Abs(value - m_QExtra) > 10 * EPS_ANG_SMALL
|
||||
m_QExtra = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Sub New(nId As Integer, dThickness As Double, dQ1 As Double, dQ2 As Double, dQ3 As Double, dQ4 As Double, dQ5 As Double, dQExtra As Double)
|
||||
m_Id = nId
|
||||
m_Thickness = dThickness
|
||||
m_Q1 = dQ1
|
||||
m_Q2 = dQ2
|
||||
m_Q3 = dQ3
|
||||
m_Q4 = dQ4
|
||||
m_Q5 = dQ5
|
||||
m_QExtra = dQExtra
|
||||
End Sub
|
||||
|
||||
Public ReadOnly Property IsModified() As Boolean
|
||||
Get
|
||||
Return m_IsModifiedThickness OrElse
|
||||
m_IsModifiedQ1 OrElse
|
||||
m_IsModifiedQ2 OrElse
|
||||
m_IsModifiedQ3 OrElse
|
||||
m_IsModifiedQ4 OrElse
|
||||
m_IsModifiedQ5 OrElse
|
||||
m_IsModifiedQExtra
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Sub IsModifiedReset()
|
||||
m_IsModifiedThickness = False
|
||||
m_IsModifiedQ1 = False
|
||||
m_IsModifiedQ2 = False
|
||||
m_IsModifiedQ3 = False
|
||||
m_IsModifiedQ4 = False
|
||||
m_IsModifiedQ5 = False
|
||||
m_IsModifiedQExtra = False
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
Reference in New Issue
Block a user