EgtDOORCreator :

- aggiunto HardwarePart.
This commit is contained in:
Nicola Pievani
2019-04-03 17:42:46 +00:00
parent 93ceded72c
commit f3a7af5fcb
7 changed files with 542 additions and 0 deletions
+110
View File
@@ -0,0 +1,110 @@
<EgtWPFLib5:EgtCustomWindow x:Class="HardwarePartV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:EgtDOORCreator"
xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5"
Title="{Binding Title}" Icon="/Resources/EgtDOOR.ico"
TitleBarBrush="{StaticResource EgaltechBlue1}"
BorderBrush="{StaticResource EgaltechBlue1}"
WindowStyle="None" ResizeMode="NoResize" TitleBarHeight="30" IsResizable="False"
IsMinimizable="False" WindowStartupLocation="CenterScreen" ShowInTaskbar="False"
CloseCommand="{Binding CloseOptionsCommand,Mode=OneWay,UpdateSourceTrigger=PropertyChanged}"
Height="200" Width="400">
<Grid Margin="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="0.7*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="0.7*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
<!--<RowDefinition Height="1*"/>-->
</Grid.RowDefinitions>
<Grid.InputBindings>
<KeyBinding Key="Enter" Command="{Binding ApplyCommand}"/>
</Grid.InputBindings>
<TextBlock Grid.Column="0" Grid.Row="0" Text="{Binding WidthMsg}" VerticalAlignment="Center"
Margin="15,0,0,0"
Style="{StaticResource DoorParamsTxBl}"/>
<TextBox Grid.Column="1" Grid.Row="0"
Text="{Binding Width,UpdateSourceTrigger=PropertyChanged}"
Style="{StaticResource DoorParamsTxBx}"
Margin="5,0,15,5"/>
<TextBlock Grid.Column="0" Grid.Row="1" Text="{Binding HeightMsg}" VerticalAlignment="Center"
Margin="15,0,0,0"
Style="{StaticResource DoorParamsTxBl}"/>
<TextBox Grid.Column="1" Grid.Row="1" Text="{Binding Height,UpdateSourceTrigger=PropertyChanged}"
Style="{StaticResource DoorParamsTxBx}"
Margin="5,0,15,5"/>
<TextBlock Grid.Column="0" Grid.Row="2" Text="{Binding ThicknessMsg}" VerticalAlignment="Center"
Margin="15,0,0,0"
Style="{StaticResource DoorParamsTxBl}"/>
<TextBox Grid.Column="1" Grid.Row="2" Text="{Binding Thickness,UpdateSourceTrigger=PropertyChanged}"
Style="{StaticResource DoorParamsTxBx}"
Margin="5,0,15,5"/>
<TextBlock Grid.Column="0" Grid.Row="3" Text="{Binding SwingMsg}" VerticalAlignment="Center"
Margin="15,0,0,0"
Style="{StaticResource DoorParamsTxBl}"/>
<ComboBox ItemsSource="{Binding SwingList}" Margin="5,0,15,5"
Grid.Column="1" Grid.Row="3"
SelectedItem="{Binding SelectedItem}"
Style="{StaticResource DoorParamsCmBx}"/>
<TextBlock Grid.Column="2" Grid.Row="0" Text="{Binding LockedgeMsg}" VerticalAlignment="Center"
Margin="15,0,0,0"
Style="{StaticResource DoorParamsTxBl}"/>
<ComboBox ItemsSource="{Binding LockEdgeProfile}" Margin="5,0,15,5"
Grid.Column="3" Grid.Row="0"
SelectedValue="{Binding SelectedLockEdgeProfile}"
DisplayMemberPath="Name"
Style="{StaticResource DoorParamsCmBx}"/>
<TextBlock Grid.Column="2" Grid.Row="1" Text="{Binding HingeedgeMsg}" VerticalAlignment="Center"
Margin="15,0,0,0"
Style="{StaticResource DoorParamsTxBl}"/>
<ComboBox ItemsSource="{Binding HingeEdgeProfile}" Margin="5,0,15,5"
Grid.Column="3" Grid.Row="1"
SelectedValue="{Binding SelectedHingeEdgeProfile}"
DisplayMemberPath="Name"
Style="{StaticResource DoorParamsCmBx}"/>
<TextBlock Grid.Column="2" Grid.Row="2" Text="{Binding TopedgeMsg}" VerticalAlignment="Center"
Margin="15,0,0,0"
Style="{StaticResource DoorParamsTxBl}"/>
<ComboBox ItemsSource="{Binding TopEdgeProfile}" Margin="5,0,15,5"
Grid.Column="3" Grid.Row="2"
SelectedValue="{Binding SelectedTopEdgeProfile}"
DisplayMemberPath="Name"
Style="{StaticResource DoorParamsCmBx}"/>
<TextBlock Grid.Column="2" Grid.Row="3" Text="{Binding BottomedgeMsg}" VerticalAlignment="Center"
Margin="15,0,0,0"
Style="{StaticResource DoorParamsTxBl}"/>
<ComboBox ItemsSource="{Binding BottomEdgeProfile}" Margin="5,0,15,5"
Grid.Column="3" Grid.Row="3"
SelectedValue="{Binding SelectedBottomEdgeProfile}"
DisplayMemberPath="Name"
Style="{StaticResource DoorParamsCmBx}"/>
<Button Grid.Column="3" Grid.Row="4"
Margin="5,2,5,2"
Content="{Binding CloseMsg}"
Command="{Binding CloseCommand}"
IsDefault="True"/>
</Grid>
</EgtWPFLib5:EgtCustomWindow>
+12
View File
@@ -0,0 +1,12 @@
Public Class HardwarePartV
Private m_HardwarePartVM As HardwarePartVM
Sub New(Owner As Window, HardwarePart As HardwarePartVM)
MyBase.New(Owner)
' This call is required by the designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
Me.DataContext = HardwarePart
m_HardwarePartVM = HardwarePart
End Sub
End Class
+302
View File
@@ -0,0 +1,302 @@
Imports System.Collections.ObjectModel
Imports System.IO
Imports EgtUILib
Imports EgtWPFLib5
Public Class HardwarePartVM
Inherits VMBase
Dim m_HardwareTemp As Hardware
#Region "MESSAGES"
Public ReadOnly Property Title As String
Get
Return "Part Dimension"
End Get
End Property
Public ReadOnly Property HeightMsg As String
Get
Return EgtMsg(50002)
End Get
End Property
Public ReadOnly Property WidthMsg As String
Get
Return EgtMsg(50001)
End Get
End Property
Public ReadOnly Property ThicknessMsg As String
Get
Return EgtMsg(50003)
End Get
End Property
Public ReadOnly Property SwingMsg As String
Get
Return EgtMsg(50004)
End Get
End Property
Public ReadOnly Property LockedgeMsg As String
Get
Return EgtMsg(50005)
End Get
End Property
Public ReadOnly Property HingeedgeMsg As String
Get
Return EgtMsg(50006)
End Get
End Property
Public ReadOnly Property TopedgeMsg As String
Get
Return EgtMsg(50007)
End Get
End Property
Public ReadOnly Property BottomedgeMsg As String
Get
Return EgtMsg(50008)
End Get
End Property
Public ReadOnly Property CloseMsg As String
Get
Return "Close"
End Get
End Property
#End Region ' Messages
#Region "Property"
Private m_Height As String
Public Property Height As String
Get
Return m_Height
End Get
Set(value As String)
m_Height = value
End Set
End Property
Private m_Width As String
Public Property Width As String
Get
Return m_Width
End Get
Set(value As String)
m_Width = value
End Set
End Property
Private m_Thickness As String
Public Property Thickness As String
Get
Return m_Thickness
End Get
Set(value As String)
m_Thickness = value
End Set
End Property
Private m_SwingList As List(Of String)
Public Property SwingList As List(Of String)
Get
Return m_SwingList
End Get
Set(value As List(Of String))
m_SwingList = value
End Set
End Property
Private m_SelectedItem As String
Public Property SelectedItem As String
Get
Return m_SelectedItem
End Get
Set(value As String)
m_SelectedItem = value
End Set
End Property
Private m_LockEdgeProfile As ObservableCollection(Of EdgeType)
Public Property LockEdgeProfile As ObservableCollection(Of EdgeType)
Get
Return m_LockEdgeProfile
End Get
Set(value As ObservableCollection(Of EdgeType))
m_LockEdgeProfile = value
End Set
End Property
Private m_SelectedLockEdgeProfile As EdgeType
Public Property SelectedLockEdgeProfile As EdgeType
Get
Return m_SelectedLockEdgeProfile
End Get
Set(value As EdgeType)
m_SelectedLockEdgeProfile = value
End Set
End Property
Private m_HingeEdgeProfile As ObservableCollection(Of EdgeType)
Public Property HingeEdgeProfile As ObservableCollection(Of EdgeType)
Get
Return m_HingeEdgeProfile
End Get
Set(value As ObservableCollection(Of EdgeType))
m_HingeEdgeProfile = value
End Set
End Property
Private m_SelectedHingeEdgeProfile As EdgeType
Public Property SelectedHingeEdgeProfile As EdgeType
Get
Return m_SelectedHingeEdgeProfile
End Get
Set(value As EdgeType)
m_SelectedHingeEdgeProfile = value
End Set
End Property
Private m_TopEdgeProfile As ObservableCollection(Of EdgeType)
Public Property TopEdgeProfile As ObservableCollection(Of EdgeType)
Get
Return m_TopEdgeProfile
End Get
Set(value As ObservableCollection(Of EdgeType))
m_TopEdgeProfile = value
End Set
End Property
Private m_SelectedTopEdgeProfile As EdgeType
Public Property SelectedTopEdgeProfile As EdgeType
Get
Return m_SelectedTopEdgeProfile
End Get
Set(value As EdgeType)
m_SelectedTopEdgeProfile = value
End Set
End Property
Private m_BottomEdgeProfile As ObservableCollection(Of EdgeType)
Public Property BottomEdgeProfile As ObservableCollection(Of EdgeType)
Get
Return m_BottomEdgeProfile
End Get
Set(value As ObservableCollection(Of EdgeType))
m_BottomEdgeProfile = value
End Set
End Property
Private m_SelectedBottomEdgeProfile As EdgeType
Public Property SelectedBottomEdgeProfile As EdgeType
Get
Return m_SelectedBottomEdgeProfile
End Get
Set(value As EdgeType)
m_SelectedBottomEdgeProfile = value
End Set
End Property
#End Region ' Property
Private m_CmdApply As ICommand
Private m_cmdClose As ICommand
#Region "APPLY"
Public ReadOnly Property ApplyCommand As ICommand
Get
If m_CmdApply Is Nothing Then
m_CmdApply = New Command(AddressOf Apply)
End If
Return m_CmdApply
End Get
End Property
Public Sub Apply()
If Not IsNothing(Map.refHardwarePageVM) AndAlso
Not IsNothing(Map.refHardwarePageVM.GenericPart) Then
Map.refHardwarePageVM.GenericPart.Height = m_Height
Map.refHardwarePageVM.GenericPart.Width = m_Width
Map.refHardwarePageVM.GenericPart.Thickness = m_Thickness
Map.refHardwarePageVM.GenericPart.SwingTypeList = m_SwingList
Map.refHardwarePageVM.GenericPart.Swing = m_SelectedItem
Map.refHardwarePageVM.GenericPart.LockEdgeType = m_SelectedLockEdgeProfile
Map.refHardwarePageVM.GenericPart.HingeEdgeType = m_SelectedHingeEdgeProfile
Map.refHardwarePageVM.GenericPart.TopType = m_SelectedTopEdgeProfile
Map.refHardwarePageVM.GenericPart.BottomType = m_SelectedBottomEdgeProfile
Map.refHardwarePageVM.GenericPart.NotifyPropertyChanged("GenericPart")
End If
End Sub
#End Region ' Apply
#Region "CloseWnd"
Public ReadOnly Property CloseCommand() As ICommand
Get
If m_cmdClose Is Nothing Then
m_cmdClose = New Command(AddressOf Close)
End If
Return m_cmdClose
End Get
End Property
Public Sub Close()
Apply()
' Chiusura finestra
For Each Window In Application.Current.Windows
If TypeOf Window Is HardwarePartV Then
Dim HardwarePartWindow As HardwarePartV = DirectCast(Window, HardwarePartV)
HardwarePartWindow.Close()
End If
Next
End Sub
#End Region
Public Sub New()
If Not IsNothing(Map.refHardwarePageVM) AndAlso
Not IsNothing(Map.refHardwarePageVM.GenericPart) Then
m_Height = Map.refHardwarePageVM.GenericPart.Height
m_Width = Map.refHardwarePageVM.GenericPart.Width
m_Thickness = Map.refHardwarePageVM.GenericPart.Thickness
m_SwingList = OptionModule.m_SwingTypeList
For Each Item In m_SwingList
If Trim(Item) = Trim(Map.refHardwarePageVM.GenericPart.Swing) Then
m_SelectedItem = Item
Exit For
End If
Next
m_LockEdgeProfile = Map.refHardwarePageVM.GenericPart.LockEdgeTypeList
m_HingeEdgeProfile = Map.refHardwarePageVM.GenericPart.HingeEdgeTypeList
m_TopEdgeProfile = Map.refHardwarePageVM.GenericPart.TopEdgeTypeList
m_BottomEdgeProfile = Map.refHardwarePageVM.GenericPart.BottomEdgeTypeList
For Index = 0 To m_LockEdgeProfile.Count - 1
If Trim(m_LockEdgeProfile(Index).Name) = Trim(Map.refHardwarePageVM.GenericPart.LockEdgeType.Name) Then
SelectedLockEdgeProfile = (m_LockEdgeProfile(Index))
Exit For
End If
Next
For Index = 0 To m_HingeEdgeProfile.Count - 1
If Trim(m_LockEdgeProfile(Index).Name) = Trim(Map.refHardwarePageVM.GenericPart.HingeEdgeType.Name) Then
SelectedHingeEdgeProfile = (m_HingeEdgeProfile(Index))
Exit For
End If
Next
For Index = 0 To m_TopEdgeProfile.Count - 1
If Trim(m_LockEdgeProfile(Index).Name) = Trim(Map.refHardwarePageVM.GenericPart.TopType.Name) Then
SelectedTopEdgeProfile = (m_TopEdgeProfile(Index))
Exit For
End If
Next
For Index = 0 To m_BottomEdgeProfile.Count - 1
If Trim(m_BottomEdgeProfile(Index).Name) = Trim(Map.refHardwarePageVM.GenericPart.BottomType.Name) Then
SelectedBottomEdgeProfile = (m_BottomEdgeProfile(Index))
Exit For
End If
Next
Else
MessageBox.Show("The current part has not been generated correctly.", EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
Close()
End If
End Sub
End Class
+118
View File
@@ -0,0 +1,118 @@
<UserControl x:Class="OperationExpanderV"
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:Interactivity="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
xmlns:EgtCAM5="clr-namespace:EgtCAM5"
xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5">
<StackPanel Name="OperationExpanderViewStackPanel" IsEnabled="{Binding OperViewIsEnabled}">
<Expander Header="{Binding OperationListHeader}" IsExpanded="{Binding ListIsExpanded}" Name="OperationsListExpander"
Style="{StaticResource ExpanderStyle}">
<Expander.InputBindings>
<KeyBinding Key="Escape" Command="{Binding CancelOperationCommand}" CommandParameter="Escape"/>
</Expander.InputBindings>
<StackPanel>
<UniformGrid Rows="1">
<Button Content="{Binding NewMachiningBtnContent}" Command="{Binding NewMachiningCommand}" Height="30"/>
<Button Content="{Binding NewPositioningBtnContent}" Command="{Binding NewPositioningCommand}" Height="30"/>
<Button Content="{Binding CancelOperationBtnContent}" Command="{Binding CancelOperationCommand}" Height="30"/>
</UniformGrid>
<ListBox IsSynchronizedWithCurrentItem="True" ItemsSource="{Binding OperationList}" SelectedItem="{Binding SelectedOperation}"
Height="200" x:Name="OperationList" IsEnabled="{Binding IsEnabledOperationList}">
<ListBox.Resources>
<DataTemplate DataType="{x:Type EgtCAM5:MachiningOpListBoxItem}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<CheckBox IsChecked="{Binding Status}" Margin="0,0,5,0"/>
<Image Source="{Binding Image}" Height="15" Margin="0,0,5,0"/>
<TextBlock Grid.Column="1" Text="{Binding Name}"
Visibility="{Binding Name_Visibility}" Margin="0,0,5,0"/>
<TextBox Grid.Column="1" Text="{Binding ModifiedName}"
Width="150"
Visibility="{Binding ModifyName_Visibility}" Margin="0,0,5,0"
LostKeyboardFocus="MachiningOpListBoxItem_LostKeyboardFocus">
<TextBox.InputBindings>
<KeyBinding Key="Enter" Command="{Binding ModifyNameEnterCommand}"/>
<KeyBinding Key="Escape" Command="{Binding ModifyNameEscCommand}"/>
</TextBox.InputBindings>
</TextBox>
<TextBlock Grid.Column="2" Text="{Binding Info}"/>
</Grid>
</DataTemplate>
<DataTemplate DataType="{x:Type EgtCAM5:DispositionOpListBoxItem}">
<Border CornerRadius="1" Background="{StaticResource EgaltechBlue3}">
<StackPanel Orientation="Horizontal">
<Image Source="{Binding Image}" Height="15" Margin="0,0,5,0"/>
<TextBlock Text="{Binding Name}" Foreground="White"
FontSize="15" FontWeight="SemiBold"/>
</StackPanel>
</Border>
</DataTemplate>
</ListBox.Resources>
<Interactivity:Interaction.Triggers>
<Interactivity:EventTrigger EventName="MouseDoubleClick">
<Interactivity:InvokeCommandAction Command="{Binding OperationListDoubleClickCommand}"/>
</Interactivity:EventTrigger>
</Interactivity:Interaction.Triggers>
<Interactivity:Interaction.Behaviors>
<EgtCAM5:ScrollIntoViewForListBox/>
</Interactivity:Interaction.Behaviors>
<ListBox.InputBindings>
<KeyBinding Key="Delete" Command="{Binding CancelOperationCommand}"/>
</ListBox.InputBindings>
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
</Style>
</ListBox.ItemContainerStyle>
<ListBox.ContextMenu>
<ContextMenu>
<MenuItem Header="{Binding DuplicateMachMsg}"
Command="{Binding DuplicateMachCommand}"
IsEnabled="{Binding DuplicateCmd_IsEnabled}">
</MenuItem>
<MenuItem Header="{Binding MachToDbMsg}"
Command="{Binding MachToDbCommand}"
IsEnabled="{Binding MachToDb_IsEnabled}">
</MenuItem>
<MenuItem Header="{Binding RenameMsg}"
Command="{Binding RenameCommand}"
IsEnabled="{Binding Rename_IsEnabled}">
</MenuItem>
</ContextMenu>
</ListBox.ContextMenu>
</ListBox>
<UniformGrid Rows="1">
<Button Content="{Binding MoveUpMsg}" Command="{Binding MoveUpCommand}" Height="30"/>
<Button Content="{Binding MoveDownMsg}" Command="{Binding MoveDownCommand}" Height="30"/>
<Button Content="{Binding UpdateMsg}" Command="{Binding UpdateCommand}" Height="30"/>
<Button Content="{Binding SetUpMsg}" Command="{Binding SetUpCommand}" Height="30"/>
</UniformGrid>
</StackPanel>
</Expander>
<Expander IsExpanded="{Binding ParametersIsExpanded}" Name="OperationParametersExpander"
Style="{StaticResource ExpanderStyle}" Padding="3">
<Expander.Header>
<TextBlock Text="{Binding ParametersExpanderName}"/>
</Expander.Header>
<!--ContentPresenter that contains the OperationParameters-->
<ContentPresenter Name="OperationParameters" Content="{Binding OperationParameters,Mode=OneWay}"/>
</Expander>
</StackPanel>
</UserControl>
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB