EgtCAM5 :

- Cambiati nomi classi e file.
This commit is contained in:
Emmanuele Sassi
2018-04-10 17:08:35 +00:00
parent 4e2801a1c4
commit a4b5cd4834
144 changed files with 517 additions and 521 deletions
@@ -0,0 +1,40 @@
<UserControl x:Class="InputExpanderView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Expander Header="{Binding Title}" IsExpanded="{Binding IsExpanded}" IsEnabled="{Binding IsEnabled}"
Style="{StaticResource ExpanderStyle}">
<StackPanel>
<StackPanel.Style>
<Style TargetType="{x:Type StackPanel}">
<Style.Triggers>
<DataTrigger Binding="{Binding FocusTextBox}" Value="True">
<Setter Property="FocusManager.FocusedElement" Value="{Binding ElementName=PropertySearch}"/>
</DataTrigger>
</Style.Triggers>
</Style>
</StackPanel.Style>
<TextBlock Text="{Binding TextBlock}" Margin="5,5,0,5"/>
<TextBox Text="{Binding TextBox,UpdateSourceTrigger=PropertyChanged}" Margin="5,0,5,5">
<TextBox.InputBindings>
<KeyBinding Key="Enter" Command="{Binding DoneCommand}"/>
<KeyBinding Key="S" Modifiers="Control" Command="{Binding ShowCommand}"/>
</TextBox.InputBindings>
</TextBox>
<CheckBox Content="{Binding CheckBoxText}" IsChecked="{Binding IsChecked}"
Visibility="{Binding CheckVisibility}" Margin="5,0,5,5"/>
<ComboBox ItemsSource="{Binding ComboItemsList}" SelectedIndex="{Binding ComboSelectedIndex}"
Visibility="{Binding ComboVisibility}" Margin="5,0,5,5"/>
<Grid Margin="5,0,5,5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Button Command="{Binding ShowCommand}" Visibility="{Binding ShowBtnVisibility}"
Content="{Binding ShowMsg}" Style="{StaticResource EgtCAM5_InputButton}"/>
<Button Command="{Binding DoneCommand}" Grid.Column="1"
Content="{Binding OkMsg}" Style="{StaticResource EgtCAM5_InputButton}"/>
</Grid>
</StackPanel>
</Expander>
</UserControl>
@@ -0,0 +1,3 @@
Public Class InputExpanderView
End Class
@@ -0,0 +1,343 @@
Imports System.Collections.ObjectModel
Imports EgtUILib
Namespace EgtCAM5
Public Class InputExpanderViewModel
Inherits ViewModelBase
#Region "FIELDS & PROPERTIES"
' Expander fields
Private m_IsExpanded As Boolean
Public Property IsExpanded As Boolean
Get
Return m_IsExpanded
End Get
Set(value As Boolean)
m_IsExpanded = value
OnPropertyChanged("IsExpanded")
End Set
End Property
Private m_IsEnabled As Boolean
Public Property IsEnabled As Boolean
Get
Return m_IsEnabled
End Get
Set(value As Boolean)
m_IsEnabled = value
OnPropertyChanged("IsEnabled")
End Set
End Property
Private m_Title As String
Public Property Title As String
Get
Return m_Title
End Get
Set(value As String)
m_Title = value
OnPropertyChanged("Title")
End Set
End Property
' TextBlock fields
Private m_TextBlock As String
Public Property TextBlock As String
Get
Return m_TextBlock
End Get
Set(value As String)
m_TextBlock = value
OnPropertyChanged("TextBlock")
End Set
End Property
' TextBox fields
Private m_TextBox As String
Public Property TextBox As String
Get
Return m_TextBox
End Get
Set(value As String)
m_TextBox = value
Application.Msn.NotifyColleagues(Application.NOTIFYINPUTTEXT, value)
OnPropertyChanged("TextBox")
End Set
End Property
Private m_FocusTextBox As Boolean
Public Property FocusTextBox As Boolean
Get
Return m_FocusTextBox
End Get
Set(value As Boolean)
m_FocusTextBox = value
OnPropertyChanged("FocusTextBox")
End Set
End Property
'CheckBox fields
Private m_CheckBoxText As String
Public Property CheckBoxText As String
Get
Return m_CheckBoxText
End Get
Set(value As String)
m_CheckBoxText = value
OnPropertyChanged("CheckBoxText")
End Set
End Property
Private m_IsChecked As Boolean
Public Property IsChecked As Boolean
Get
Return m_IsChecked
End Get
Set(value As Boolean)
If value <> m_IsChecked Then
Application.Msn.NotifyColleagues(Application.SETLASTBOOLEAN, value)
m_IsChecked = value
OnPropertyChanged("IsChecked")
End If
End Set
End Property
Private m_CheckVisibility As Visibility
Public Property CheckVisibility As Visibility
Get
Return m_CheckVisibility
End Get
Set(value As Visibility)
If value <> m_CheckVisibility Then
m_CheckVisibility = value
OnPropertyChanged("CheckVisibility")
End If
End Set
End Property
' ComboBox fields
Private m_ComboItemsList As New ObservableCollection(Of String)
Public Property ComboItemsList As ObservableCollection(Of String)
Get
Return m_ComboItemsList
End Get
Set(value As ObservableCollection(Of String))
m_ComboItemsList = value
OnPropertyChanged("ComboItemsList")
End Set
End Property
Private m_ComboSelectedIndex As Integer
Public Property ComboSelectedIndex As Integer
Get
Return m_ComboSelectedIndex
End Get
Set(value As Integer)
Application.Msn.NotifyColleagues(Application.SETLASTINTEGER, value)
m_ComboSelectedIndex = value
OnPropertyChanged("ComboSelectedIndex")
End Set
End Property
Private m_ComboVisibility As Visibility
Public Property ComboVisibility As Visibility
Get
Return m_ComboVisibility
End Get
Set(value As Visibility)
If value <> m_ComboVisibility Then
m_ComboVisibility = value
OnPropertyChanged("ComboVisibility")
End If
End Set
End Property
' Buttons fields
Private m_ShowBtnVisibility As Visibility
Public Property ShowBtnVisibility As Visibility
Get
Return m_ShowBtnVisibility
End Get
Set(value As Visibility)
m_ShowBtnVisibility = value
OnPropertyChanged("ShowBtnVisibility")
End Set
End Property
' Commands definition
Private m_cmdShow As ICommand
Private m_cmdDone As ICommand
#Region "Messages"
Public ReadOnly Property ShowMsg As String
Get
Return EgtMsg(MSG_DRAWOPTION + 14)
End Get
End Property
Public ReadOnly Property OkMsg As String
Get
Return EgtMsg(MSG_DRAWOPTION + 15)
End Get
End Property
#End Region
#End Region ' Fields & Properties
#Region "CONSTRUCTOR"
Sub New()
RegisterMethodsCall()
End Sub
#End Region ' Constructor
#Region "COMMANDS"
#Region "ShowCommand"
''' <summary>
''' Returns a command that do Point.
''' </summary>
Public ReadOnly Property ShowCommand As ICommand
Get
If m_cmdShow Is Nothing Then
m_cmdShow = New RelayCommand(AddressOf Show, AddressOf CanShow)
End If
Return m_cmdShow
End Get
End Property
''' <summary>
''' Execute the Point. This method is invoked by the PointCommand.
''' </summary>
Public Sub Show(ByVal param As Object)
Application.Msn.NotifyColleagues(Application.SHOW, TextBox)
End Sub
''' <summary>
''' Returns always true.
''' </summary>
Private Function CanShow(ByVal param As Object) As Boolean
Return If(m_ShowBtnVisibility = Visibility.Visible, True, False)
End Function
#End Region ' ShowCommand
#Region "DoneCommand"
''' <summary>
''' Returns a command that do Point.
''' </summary>
Public ReadOnly Property DoneCommand As ICommand
Get
If m_cmdDone Is Nothing Then
m_cmdDone = New RelayCommand(AddressOf Done, AddressOf CanDone)
End If
Return m_cmdDone
End Get
End Property
''' <summary>
''' Execute the Point. This method is invoked by the PointCommand.
''' </summary>
Public Sub Done(ByVal param As Object)
Application.Msn.NotifyColleagues(Application.DONE, m_TextBox)
End Sub
''' <summary>
''' Returns always true.
''' </summary>
Private Function CanDone(ByVal param As Object) As Boolean
Return True
End Function
#End Region ' DoneCommand
#End Region
#Region "METHODS"
Sub RegisterMethodsCall()
Application.Msn.Register(Application.PREPAREINPUTBOX, Sub(PrepareInputBoxParam As PrepareInputBoxParam)
PrepareInputBox(PrepareInputBoxParam)
End Sub)
Application.Msn.Register(Application.SETINPUTBOXTEXT, Sub(sString As String)
SetInputBoxText(sString)
End Sub)
Application.Msn.Register(Application.SETINPUTBOXCHECK, Sub(bBoolean As Boolean)
SetInputBoxCheck(bBoolean)
End Sub)
Application.Msn.Register(Application.CHANGEINPUTBOXCHECK, Sub()
ChangeInputBoxCheck()
End Sub)
Application.Msn.Register(Application.ADDINPUTBOXCOMBO, Sub(AddInputBoxComboParam As AddInputBoxComboParam)
AddInputBoxCombo(AddInputBoxComboParam.sText, AddInputBoxComboParam.bSelected)
End Sub)
Application.Msn.Register(Application.RESETINPUTBOX, Sub()
ResetInputBox()
End Sub)
End Sub
Private Sub PrepareInputBox(PrepareInputBoxParam As PrepareInputBoxParam)
Title = PrepareInputBoxParam.sTitle
TextBlock = PrepareInputBoxParam.sLabel
TextBox = ""
If PrepareInputBoxParam.sCheckLabel <> "" Then
CheckBoxText = PrepareInputBoxParam.sCheckLabel
CheckVisibility = Visibility.Visible
End If
If PrepareInputBoxParam.bShowCombo Then
ComboItemsList.Clear()
ComboVisibility = Visibility.Visible
End If
If PrepareInputBoxParam.bShowBtn Then
ShowBtnVisibility = Visibility.Visible
End If
IsEnabled = True
IsExpanded = True
FocusTextBox = True
End Sub
Private Sub ResetInputBox()
Title = EgtMsg(MSG_DRAWOPTION + 5)
CheckVisibility = Visibility.Collapsed
ComboVisibility = Visibility.Collapsed
ShowBtnVisibility = Visibility.Collapsed
IsExpanded = False
IsEnabled = False
End Sub
Private Function SetInputBoxText(ByVal sVal As String) As Boolean
TextBox = sVal
FocusTextBox = True
Return True
End Function
Private Function ChangeInputBoxCheck() As Boolean
IsChecked = Not m_IsChecked
Return True
End Function
Private Function SetInputBoxCheck(ByVal bCheck As Boolean) As Boolean
IsChecked = bCheck
Application.Msn.NotifyColleagues(Application.SETLASTBOOLEAN, IsChecked)
Return True
End Function
Private Function AddInputBoxCombo(ByVal sText As String, ByVal bSelected As Boolean) As Boolean
ComboItemsList.Add(sText)
If bSelected Then
ComboSelectedIndex = ComboItemsList.Count - 1
End If
Return True
End Function
#End Region ' Methods
End Class
End Namespace