diff --git a/App.config b/App.config new file mode 100644 index 0000000..3fa3cae --- /dev/null +++ b/App.config @@ -0,0 +1,6 @@ + + + + + + diff --git a/Application.xaml b/Application.xaml new file mode 100644 index 0000000..59d2741 --- /dev/null +++ b/Application.xaml @@ -0,0 +1,10 @@ + + + + + + + diff --git a/Application.xaml.vb b/Application.xaml.vb new file mode 100644 index 0000000..2561359 --- /dev/null +++ b/Application.xaml.vb @@ -0,0 +1,19 @@ +Class Application + + ' Application-level events, such as Startup, Exit, and DispatcherUnhandledException + ' can be handled in this file. + Protected Overrides Sub OnStartUp(e As System.Windows.StartupEventArgs) + MyBase.OnStartup(e) + ShutdownMode = System.Windows.ShutdownMode.OnMainWindowClose + ' Creo la View principale + Dim MainWndView As New MainWindow + MainWindow = MainWndView + ' Creo il ViewModel principale + Dim MainWndViewModel As New MainWindowViewModel + ' Assegno il ViewModel alla View + MainWndView.DataContext = MainWndViewModel + ' Mostro la View principale + MainWndView.Show() + End Sub + +End Class diff --git a/Command/Command.vb b/Command/Command.vb new file mode 100644 index 0000000..9fe3775 --- /dev/null +++ b/Command/Command.vb @@ -0,0 +1,68 @@ + +''' +''' A command whose sole purpose is to +''' relay its functionality to other +''' objects by invoking delegates. The +''' default return value for the CanExecute +''' method is 'true'. +''' +Public Class Command + Implements ICommand + +#Region "Fields" + + Private ReadOnly _execute As Action(Of Object) + Private ReadOnly _canExecute As Predicate(Of Object) + +#End Region ' Fields + +#Region "Constructors" + + ''' + ''' Creates a new command that can always execute. + ''' + ''' The execution logic. + Public Sub New(ByVal execute As Action(Of Object)) + Me.New(execute, Nothing) + End Sub + + ''' + ''' Creates a new command. + ''' + ''' The execution logic. + ''' The execution status logic. + Public Sub New(ByVal execute As Action(Of Object), ByVal canExecute As Predicate(Of Object)) + If execute Is Nothing Then + Throw New ArgumentNullException("execute") + End If + + _execute = execute + _canExecute = canExecute + End Sub + +#End Region ' Constructors + +#Region "ICommand Members" + + _ + Public Function CanExecute(ByVal parameter As Object) As Boolean Implements ICommand.CanExecute + Return If(_canExecute Is Nothing, True, _canExecute(parameter)) + End Function + + Public Custom Event CanExecuteChanged As EventHandler Implements ICommand.CanExecuteChanged + AddHandler(ByVal value As EventHandler) + AddHandler CommandManager.RequerySuggested, value + End AddHandler + RemoveHandler(ByVal value As EventHandler) + RemoveHandler CommandManager.RequerySuggested, value + End RemoveHandler + RaiseEvent(ByVal sender As System.Object, ByVal e As System.EventArgs) + End RaiseEvent + End Event + + Public Sub Execute(ByVal parameter As Object) Implements ICommand.Execute + _execute(parameter) + End Sub + +#End Region ' ICommand Members +End Class \ No newline at end of file diff --git a/Command/RelayCommand.vb b/Command/RelayCommand.vb new file mode 100644 index 0000000..f000571 --- /dev/null +++ b/Command/RelayCommand.vb @@ -0,0 +1,71 @@ +Namespace EgtCAM5 + + ''' + ''' A command whose sole purpose is to + ''' relay its functionality to other + ''' objects by invoking delegates. The + ''' default return value for the CanExecute + ''' method is 'true'. + ''' + Public Class RelayCommand + Implements ICommand + +#Region "Fields" + + Private ReadOnly _execute As Action(Of Object) + Private ReadOnly _canExecute As Predicate(Of Object) + +#End Region ' Fields + +#Region "Constructors" + + ''' + ''' Creates a new command that can always execute. + ''' + ''' The execution logic. + Public Sub New(ByVal execute As Action(Of Object)) + Me.New(execute, Nothing) + End Sub + + ''' + ''' Creates a new command. + ''' + ''' The execution logic. + ''' The execution status logic. + Public Sub New(ByVal execute As Action(Of Object), ByVal canExecute As Predicate(Of Object)) + If execute Is Nothing Then + Throw New ArgumentNullException("execute") + End If + + _execute = execute + _canExecute = canExecute + End Sub + +#End Region ' Constructors + +#Region "ICommand Members" + + _ + Public Function CanExecute(ByVal parameter As Object) As Boolean Implements ICommand.CanExecute + Return If(_canExecute Is Nothing, True, _canExecute(parameter)) + End Function + + Public Custom Event CanExecuteChanged As EventHandler Implements ICommand.CanExecuteChanged + AddHandler(ByVal value As EventHandler) + AddHandler CommandManager.RequerySuggested, value + End AddHandler + RemoveHandler(ByVal value As EventHandler) + RemoveHandler CommandManager.RequerySuggested, value + End RemoveHandler + RaiseEvent(ByVal sender As System.Object, ByVal e As System.EventArgs) + End RaiseEvent + End Event + + Public Sub Execute(ByVal parameter As Object) Implements ICommand.Execute + _execute(parameter) + End Sub + +#End Region ' ICommand Members + End Class + +End Namespace \ No newline at end of file diff --git a/CompoPanel/CompoBtn.vb b/CompoPanel/CompoBtn.vb new file mode 100644 index 0000000..3a20551 --- /dev/null +++ b/CompoPanel/CompoBtn.vb @@ -0,0 +1,65 @@ +Public Class CompoBtn + + Private m_AddNewDoor As Action(Of String) + + Private m_Name As String + Public ReadOnly Property Name As String + Get + Return m_Name + End Get + End Property + + Private m_IniCompoName As String + Public ReadOnly Property IniCompoName As String + Get + Return m_IniCompoName + End Get + End Property + + Private m_DDFCompoName As String + Public ReadOnly Property DDFCompoName As String + Get + Return m_DDFCompoName + End Get + End Property + + + Sub New(sName As String, sIniCompoName As String, sDDFCompoName As String, ByRef AddNewDoor As Action(Of String)) + m_AddNewDoor = AddNewDoor + m_Name = sName + m_IniCompoName = sIniCompoName + m_DDFCompoName = sDDFCompoName + End Sub + + ' Definizione comando + Private m_CmdCompoBtn As ICommand + +#Region "COMMANDS" + +#Region "CompoBtnCommand" + + ''' + ''' Returns a command that do Exec. + ''' + Public ReadOnly Property CompoBtnCommand As ICommand + Get + If m_CmdCompoBtn Is Nothing Then + m_CmdCompoBtn = New Command(AddressOf CompoBtn) + End If + Return m_CmdCompoBtn + End Get + End Property + + ''' + ''' Execute the Exec. This method is invoked by the ExecCommand. + ''' + Public Sub CompoBtn() + m_AddNewDoor(m_IniCompoName) + End Sub + + +#End Region ' CompoBtnCommand + +#End Region 'Commands + +End Class diff --git a/CompoPanel/CompoPanelView.xaml b/CompoPanel/CompoPanelView.xaml new file mode 100644 index 0000000..bd309df --- /dev/null +++ b/CompoPanel/CompoPanelView.xaml @@ -0,0 +1,13 @@ + + + + + +