EgtCAM5 :
- Cambiati nomi classi e file.
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user