105 lines
2.8 KiB
VB.net
105 lines
2.8 KiB
VB.net
Imports System.Collections.ObjectModel
|
|
Imports EgtUILib
|
|
|
|
Public Class ExecutePanelVM
|
|
Inherits ViewModelBase
|
|
|
|
#Region "FIELDS & PROPERTIES"
|
|
|
|
Public ReadOnly Property MruScriptNames As ObservableCollection(Of String)
|
|
Get
|
|
Return IniFile.m_MruScripts.m_FileNames
|
|
End Get
|
|
End Property
|
|
|
|
Private m_ExecutePanel_Visibility As Visibility
|
|
Public ReadOnly Property ExecutePanel_Visibility As Visibility
|
|
Get
|
|
Return m_ExecutePanel_Visibility
|
|
End Get
|
|
End Property
|
|
|
|
Friend Sub SetExecutePanelVisibility(bValue As Boolean)
|
|
m_ExecutePanel_Visibility = If(bValue, Visibility.Visible, Visibility.Collapsed)
|
|
OnPropertyChanged(NameOf(ExecutePanel_Visibility))
|
|
End Sub
|
|
|
|
' Definizione comandi
|
|
Private m_cmdExec As ICommand
|
|
Private Shared m_cmdOpenMruScript As ICommand
|
|
|
|
#Region "ToolTip"
|
|
|
|
Public ReadOnly Property ExecToolTip As String
|
|
Get
|
|
Return EgtMsg(MSG_TOPCOMMANDBAR + 8)
|
|
End Get
|
|
End Property
|
|
|
|
#End Region ' ToolTip
|
|
|
|
#End Region ' FIELDS & PROPERTIES
|
|
|
|
Sub New()
|
|
' Creo riferimento a questa classe in Map
|
|
Map.SetRefExecutePanelVM(Me)
|
|
End Sub
|
|
|
|
#Region "COMMANDS"
|
|
|
|
#Region "ExecCommand"
|
|
|
|
''' <summary>
|
|
''' Returns a command that do Exec.
|
|
''' </summary>
|
|
Public ReadOnly Property ExecCommand As ICommand
|
|
Get
|
|
If m_cmdExec Is Nothing Then
|
|
m_cmdExec = New RelayCommand(AddressOf Exec)
|
|
End If
|
|
Return m_cmdExec
|
|
End Get
|
|
End Property
|
|
|
|
''' <summary>
|
|
''' Execute the Exec. This method is invoked by the ExecCommand.
|
|
''' </summary>
|
|
Public Sub Exec(ByVal param As Object)
|
|
If (Keyboard.Modifiers And ModifierKeys.Shift) = ModifierKeys.Shift Then
|
|
Dim ExecuteWindow As New ExecuteWindowV(Application.Current.MainWindow, New ExecuteWindowVM)
|
|
ExecuteWindow.ShowDialog()
|
|
Else
|
|
Map.refProjectVM.PreExecScript(True)
|
|
Map.refProjectVM.ExecScript(String.Empty)
|
|
End If
|
|
End Sub
|
|
|
|
#End Region ' ExecCommand
|
|
|
|
#Region "OpenMruScriptCommand"
|
|
|
|
''' <summary>
|
|
''' Returns a command that do Open.
|
|
''' </summary>
|
|
Public Shared ReadOnly Property OpenMruScriptCommand As ICommand
|
|
Get
|
|
If m_cmdOpenMruScript Is Nothing Then
|
|
m_cmdOpenMruScript = New RelayCommand(AddressOf OpenMruScript)
|
|
End If
|
|
Return m_cmdOpenMruScript
|
|
End Get
|
|
End Property
|
|
|
|
''' <summary>
|
|
''' Execute the Open. This method is invoked by the OpenCommand.
|
|
''' </summary>
|
|
Public Shared Sub OpenMruScript(ByVal param As Object)
|
|
Map.refProjectVM.PreExecScript(True)
|
|
Map.refProjectVM.ExecScript(DirectCast(param, String).Replace("__", "_"))
|
|
End Sub
|
|
|
|
#End Region ' OpenMruFileCommand
|
|
|
|
#End Region ' COMMANDS
|
|
|
|
End Class |