diff --git a/EgtCustomWindow.vb b/EgtCustomWindow.vb
index 177b545..ede38fb 100644
--- a/EgtCustomWindow.vb
+++ b/EgtCustomWindow.vb
@@ -166,6 +166,14 @@ Public Class EgtCustomWindow
DefaultStyleKeyProperty.OverrideMetadata(GetType(EgtCustomWindow), New FrameworkPropertyMetadata(GetType(EgtCustomWindow)))
End Sub
+ Sub New()
+
+ End Sub
+
+ Sub New(Owner As Window)
+ Me.Owner = Owner
+ End Sub
+
Public Overrides Sub OnApplyTemplate()
MyBase.OnApplyTemplate()
m_IsResizable = IsResizable
diff --git a/EgtFloating/EgtFloatingManager.vb b/EgtFloating/EgtFloatingManager.vb
index e8ea0c4..8daff84 100644
--- a/EgtFloating/EgtFloatingManager.vb
+++ b/EgtFloating/EgtFloatingManager.vb
@@ -85,10 +85,19 @@ Namespace EgtFloating
End Sub
Private Sub Me_Loaded(sender As Object, e As System.Windows.RoutedEventArgs) Handles Me.Loaded
- m_ParentWindow = Utility.FindAncestor(Of Window)(Me)
- If TypeOf Me.Items(Me.Items.Count - 1) Is EgtFloatingTray Then
+ 'm_ParentWindow = Utility.FindAncestor(Of Window)(Me)
+ m_ParentWindow = Window.GetWindow(Me)
+ If Me.Items.Count > 0 AndAlso TypeOf Me.Items(Me.Items.Count - 1) Is EgtFloatingTray Then
LastChildFill = False
End If
+ ' PERMETTE DI SPOSTARE LE WINDOW TRAY NEL CASO VENGA SPOSTATA LA MAINWINDOW!!!!!!!
+ 'For TrayIndex = 0 To Me.Items.Count - 1
+ ' If TypeOf Me.Items(TrayIndex) Is EgtFloatingTray Then
+ ' Dim TrayItem As EgtFloatingTray = DirectCast(Me.Items(TrayIndex), EgtFloatingTray)
+ ' AddHandler ParentWindow.LocationChanged, AddressOf TrayItem.Me_LocationChanged
+ ' AddHandler ParentWindow.SizeChanged, AddressOf TrayItem.Me_DimensionChanged
+ ' End If
+ 'Next
End Sub
Private Sub Me_Unloaded(sender As Object, e As System.Windows.RoutedEventArgs) Handles Me.Unloaded
diff --git a/EgtFloating/EgtFloatingTray.vb b/EgtFloating/EgtFloatingTray.vb
index 324205e..76a0803 100644
--- a/EgtFloating/EgtFloatingTray.vb
+++ b/EgtFloating/EgtFloatingTray.vb
@@ -89,13 +89,13 @@ Namespace EgtFloating
m_TrayWindow.Visibility = Windows.Visibility.Hidden
End Sub
- Private Sub Me_LocationChanged()
+ Friend Sub Me_LocationChanged()
Dim pos As Point = Me.PointToScreen(New Point(0, 0))
m_TrayWindow.Top = pos.Y
m_TrayWindow.Left = pos.X
End Sub
- Private Sub Me_DimensionChanged()
+ Friend Sub Me_DimensionChanged()
' Aggiorna le massime dimensioni del contenuto al cambiare della dimensione della Tray.
' NON TIENE CONTO DELLE TRAY CON PIU' DI UN ELEMENTO!!
For Index As Integer = 0 To Me.Items.Count - 1
diff --git a/EgtWPFLib5.vbproj b/EgtWPFLib5.vbproj
index 12a07bc..e488792 100644
--- a/EgtWPFLib5.vbproj
+++ b/EgtWPFLib5.vbproj
@@ -94,6 +94,15 @@
+
+ EgtMachGroupPanelV.xaml
+
+
+
+ NewMachGroupWndV.xaml
+
+
+
@@ -113,6 +122,8 @@
Settings.settingsTrue
+
+ VbMyResourcesResXFileCodeGeneratorResources.Designer.vb
@@ -137,6 +148,14 @@
DesignerMSBuild:Compile
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:CompileDesigner
diff --git a/MachGroupPanel/EgtMachGroupPanelV.xaml b/MachGroupPanel/EgtMachGroupPanelV.xaml
new file mode 100644
index 0000000..7649e2f
--- /dev/null
+++ b/MachGroupPanel/EgtMachGroupPanelV.xaml
@@ -0,0 +1,100 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/MachGroupPanel/EgtMachGroupPanelV.xaml.vb b/MachGroupPanel/EgtMachGroupPanelV.xaml.vb
new file mode 100644
index 0000000..1f405e6
--- /dev/null
+++ b/MachGroupPanel/EgtMachGroupPanelV.xaml.vb
@@ -0,0 +1,25 @@
+Public Class EgtMachGroupPanelV
+
+ ' Proprietà che permette di impostare lo stile dei RepeatButton(bottoni per scorrere la lista)
+ Public Shared ReadOnly RepaetButtonStyleProperty As DependencyProperty = DependencyProperty.Register("RepaetButtonStyle", GetType(Style), GetType(EgtMachGroupPanelV), New PropertyMetadata(Nothing))
+ Public Property RepaetButtonStyle() As Style
+ Get
+ Return DirectCast(GetValue(RepaetButtonStyleProperty), Style)
+ End Get
+ Set(ByVal value As Style)
+ SetValue(RepaetButtonStyleProperty, value)
+ End Set
+ End Property
+
+ ' Proprietà che permette di impostare lo stile dei RadioButton che rappresentano i gruppi
+ Public Shared ReadOnly MachGroupButtonStyleProperty As DependencyProperty = DependencyProperty.Register("MachGroupButtonStyle", GetType(Style), GetType(EgtMachGroupPanelV))
+ Public Property MachGroupButtonStyle() As Style
+ Get
+ Return DirectCast(GetValue(MachGroupButtonStyleProperty), Style)
+ End Get
+ Set(ByVal value As Style)
+ SetValue(MachGroupButtonStyleProperty, value)
+ End Set
+ End Property
+
+End Class
diff --git a/MachGroupPanel/EgtMachGroupPanelVM.vb b/MachGroupPanel/EgtMachGroupPanelVM.vb
new file mode 100644
index 0000000..94ae008
--- /dev/null
+++ b/MachGroupPanel/EgtMachGroupPanelVM.vb
@@ -0,0 +1,369 @@
+Imports System.Collections.ObjectModel
+Imports System.IO
+Imports EgtUILib
+Imports EgtWPFLib5
+
+Public Class EgtMachGroupPanelVM
+ Inherits VMBase
+
+#Region "FIELDS & PROPERTIES"
+
+ ' Lista delle macchine disponibili
+ Private m_MachineList As List(Of Machine)
+ ' Variabile che definisce se il nome è automatico
+ Private m_IsGroupNameAutomatic As Boolean = True
+ ' Variabile che definisce se ci sono più gruppi di lavorazione
+ Private m_IsMultiMachGroup As Boolean
+
+ Private m_MachGroupList As New ObservableCollection(Of MachGroup)
+ Public Property MachGroupList As ObservableCollection(Of MachGroup)
+ Get
+ Return m_MachGroupList
+ End Get
+ Set(value As ObservableCollection(Of MachGroup))
+ If value IsNot m_MachGroupList Then
+ m_MachGroupList = value
+ End If
+ End Set
+ End Property
+
+ Private m_SelectedMachGroup As MachGroup
+ Public Property SelectedMachGroup As MachGroup
+ Get
+ Return m_SelectedMachGroup
+ End Get
+ Set(value As MachGroup)
+ m_SelectedMachGroup = value
+ If Not IsNothing(value) Then
+ EgtSetCurrMachGroup(value.Id)
+ EgtDraw()
+ End If
+ NotifyPropertyChanged("SelectedMachGroup")
+ End Set
+ End Property
+
+ Private m_PanelVisibility As Visibility
+ Public ReadOnly Property PanelVisibility As Visibility
+ Get
+ Return m_PanelVisibility
+ End Get
+ End Property
+
+ ' Definizione comandi
+ Private m_cmdSetCurrMachGroup As ICommand
+ Private m_cmdAddMachGroup As ICommand
+ Private m_cmdRemoveMachGroup As ICommand
+
+#End Region ' FIELDS & PROPERTIES
+
+#Region "CONSTRUCTOR"
+
+ Sub New()
+ ' Creo riferimento a questa classe in OmagOFFICEMap
+ ''OmagOFFICEMap.SetRefMachGroupPanelVM(Me)
+ ''InitMachGroups(True, OmagOFFICEMap.refMachinePanelVM.MachineList.ToList())
+ End Sub
+
+#End Region ' CONSTRUCTOR
+
+#Region "METHODS"
+
+ Public Function InitMachGroups(IsMultiMachGroup As Boolean, MachineList As List(Of Machine)) As Boolean
+ m_IsMultiMachGroup = IsMultiMachGroup
+ ' se è a gruppo singolo, nascondo il panel
+ If Not m_IsMultiMachGroup Then m_PanelVisibility = Visibility.Collapsed
+ NotifyPropertyChanged("PanelVisibility")
+ ' Recupero lista macchine
+ m_MachineList = MachineList
+ Return MachineList.Count > 0
+ End Function
+
+ Public Function LoadMachGroups() As Boolean
+ ' Svuoto precedente lista di MachGroup
+ m_MachGroupList.Clear()
+ ' verifico se esistono già gruppi di lavorazione o se devo creare il primo
+ Dim bOk As Boolean
+ Dim nId = EgtGetFirstMachGroup()
+ If nId <> GDB_ID.NULL Then
+ bOk = EgtSetCurrMachGroup(nId)
+ Else
+ bOk = AddNewMachGroup()
+ End If
+ nId = EgtGetFirstMachGroup()
+ If bOk Then
+ ' Carico i gruppi di lavorazione nella lista
+ While nId <> GDB_ID.NULL
+ Dim sName As String = String.Empty
+ Dim sMachine As String = String.Empty
+ EgtGetMachGroupName(nId, sName)
+ EgtGetMachGroupMachineName(nId, sMachine)
+ MachGroupList.Add(New MachGroup(nId, sName, sMachine))
+ nId = EgtGetNextMachGroup(nId)
+ End While
+ SelectedMachGroup = MachGroupList(0)
+ End If
+ If bOk Then EgtZoom(ZM.ALL)
+ Return bOk
+ End Function
+
+ Private Function AddNewMachGroup() As Boolean
+ ' se non ci sono macchine disponibili ritorno falso
+ If m_MachineList.Count <= 0 Then Return False
+ ' Creo il VM per chiedere nome e macchina a seconda del caso in cui mi trovo
+ Dim NewMachGroupWndVM As NewMachGroupWndVM = Nothing
+ Dim sNewMachName As String = "MachGroup_1"
+ If m_IsMultiMachGroup Then
+ EgtGetMachGroupNewName(sNewMachName)
+ If m_MachineList.Count = 1 Then
+ If Not m_IsGroupNameAutomatic Then
+ NewMachGroupWndVM = New NewMachGroupWndVM(sNewMachName)
+ End If
+ Else
+ If m_IsGroupNameAutomatic Then
+ NewMachGroupWndVM = New NewMachGroupWndVM(Nothing, m_MachineList)
+ Else
+ NewMachGroupWndVM = New NewMachGroupWndVM(sNewMachName, Nothing, m_MachineList)
+ End If
+ End If
+ ElseIf EgtGetMachGroupCount() = 0 Then
+ If m_MachineList.Count > 1 Then
+ NewMachGroupWndVM = New NewMachGroupWndVM(Nothing, m_MachineList)
+ End If
+ End If
+ ' lancio finestra di acquisizione dati
+ Dim bWindowNeeded As Boolean = False
+ If m_IsMultiMachGroup Then
+ If m_MachineList.Count = 1 Then
+ If Not m_IsGroupNameAutomatic Then
+ bWindowNeeded = True
+ End If
+ Else
+ If m_IsGroupNameAutomatic Then
+ bWindowNeeded = True
+ Else
+ bWindowNeeded = True
+ End If
+ End If
+ ElseIf EgtGetMachGroupCount() = 0 Then
+ If m_MachineList.Count > 1 Then
+ bWindowNeeded = True
+ End If
+ End If
+ If bWindowNeeded Then
+ Dim NewMachGroupWndV As New NewMachGroupWndV(NewMachGroupWndVM, Application.Current.MainWindow)
+ If NewMachGroupWndV.ShowDialog() = False Then Return False
+ End If
+ ' Creo il nuovo gruppo di lavorazione con i dati ottenuti a seconda del caso in cui mi trovo
+ Dim bOk As Boolean
+ If m_IsMultiMachGroup Then
+ If m_MachineList.Count = 1 Then
+ If m_IsGroupNameAutomatic Then
+ bOk = (EgtAddMachGroup(sNewMachName, m_MachineList(0).Name) <> GDB_ID.NULL)
+ Else
+ bOk = (EgtAddMachGroup(NewMachGroupWndVM.Name, m_MachineList(0).Name) <> GDB_ID.NULL)
+ End If
+ Else
+ If m_IsGroupNameAutomatic Then
+ bOk = (EgtAddMachGroup(sNewMachName, NewMachGroupWndVM.SelectedMachine.Name) <> GDB_ID.NULL)
+ Else
+ bOk = (EgtAddMachGroup(NewMachGroupWndVM.Name, NewMachGroupWndVM.SelectedMachine.Name) <> GDB_ID.NULL)
+ End If
+ End If
+ ElseIf EgtGetMachGroupCount() = 0 Then
+ If m_MachineList.Count = 1 Then
+ bOk = (EgtAddMachGroup(sNewMachName, m_MachineList(0).Name) <> GDB_ID.NULL)
+ ElseIf m_MachineList.Count > 1 Then
+ bOk = (EgtAddMachGroup(sNewMachName, NewMachGroupWndVM.SelectedMachine.Name) <> GDB_ID.NULL)
+ Else
+ Return False
+ End If
+ End If
+ ' '' leggo nome script di disposizione automatica
+ ''Dim sInitScriptPath As String = String.Empty
+ ''EgtUILib.GetPrivateProfileString(S_DISPOSITION, K_INITSCRIPT, "", sInitScriptPath, IniFile.m_sCurrMachIniFilePath)
+ ' '' se è attivo, uso lo script di disposizione
+ ''If bOk AndAlso OptionModule.m_bUseDispositionScript And Not String.IsNullOrEmpty(sInitScriptPath) Then
+ '' sInitScriptPath = IniFile.m_sCurrMachScriptsDirPath & "\" & sInitScriptPath
+ '' If Not File.Exists(sInitScriptPath) OrElse Not EgtLuaExecFile(sInitScriptPath) Then
+ '' EgtOutLog("Error executing disposition init script " & sInitScriptPath)
+ '' MessageBox.Show(EgtMsg(MSG_DISPOSITIONERRORS + 2) & " " & sInitScriptPath, EgtMsg(MSG_DISPOSITIONERRORS + 1), MessageBoxButton.OK, MessageBoxImage.Exclamation)
+ '' End If
+ ''End If
+ ' '' leggo nome attrezzaggio di default
+ ''Dim sDefaultSetUpName As String = String.Empty
+ ''EgtUILib.GetPrivateProfileString(S_SETUP, K_DEFAULT, "", sDefaultSetUpName, IniFile.m_sCurrMachIniFilePath)
+ ' '' se è attiva l'opzione, rendo corrente l'attrezzaggio di default
+ ''If bOk And Not String.IsNullOrEmpty(sDefaultSetUpName) Then
+ '' If Not EgtImportSetup(String.Empty) Then
+ '' EgtOutLog("Error loading default setup " & sDefaultSetUpName)
+ '' MessageBox.Show(EgtMsg(MSG_SETUPERRORS + 9) & " " & sDefaultSetUpName, EgtMsg(MSG_MESSAGEBOX + 1), MessageBoxButton.OK, MessageBoxImage.Exclamation)
+ '' End If
+ ''End If
+ Return bOk
+ End Function
+
+#End Region ' METHODS
+
+#Region "COMMANDS"
+
+ ''#Region "SetCurrMachGroupCommand"
+
+ '' '''
+ '' ''' Returns a command that set the selected MachGroup as the Current one.
+ '' '''
+ '' Public ReadOnly Property SetCurrMachGroupCommand As ICommand
+ '' Get
+ '' If m_cmdSetCurrMachGroup Is Nothing Then
+ '' m_cmdSetCurrMachGroup = New Command(AddressOf SetCurrMachGroup)
+ '' End If
+ '' Return m_cmdSetCurrMachGroup
+ '' End Get
+ '' End Property
+
+ '' Public Sub SetCurrMachGroup(ByVal param As Object)
+ '' Dim SelectedId As Integer = DirectCast(param, MachGroup).Id
+ '' EgtSetCurrMachGroup(SelectedId)
+ '' EgtDraw()
+ '' ''Application.Msn.NotifyColleagues(Application.LOADOPERATIONLIST, -1)
+ '' ''Application.Msn.NotifyColleagues(Application.UPDATECURRENTMACHINE)
+ '' End Sub
+
+ ''#End Region ' SetCurrMachGroupCommand
+
+#Region "AddMachGroupCommand"
+
+ '''
+ ''' Returns a command that set the selected MachGroup as the Current one.
+ '''
+ Public ReadOnly Property AddMachGroupCommand As ICommand
+ Get
+ If m_cmdAddMachGroup Is Nothing Then
+ m_cmdAddMachGroup = New Command(AddressOf AddMachGroup)
+ End If
+ Return m_cmdAddMachGroup
+ End Get
+ End Property
+
+ Public Sub AddMachGroup()
+ Dim NewMachGroup As MachGroup
+ If AddNewMachGroup() Then
+ ' creo oggetto gruppo creato
+ Dim nNewMachGroupID As Integer = EgtGetCurrMachGroup()
+ Dim sNewMachGroupName As String = String.Empty
+ Dim sNewMachGroupMachineName As String = String.Empty
+ EgtGetMachGroupName(EgtGetCurrMachGroup(), sNewMachGroupName)
+ EgtGetMachGroupMachineName(nNewMachGroupID, sNewMachGroupMachineName)
+ NewMachGroup = New MachGroup(EgtGetCurrMachGroup, sNewMachGroupName, sNewMachGroupMachineName)
+ ' lo aggiungo alla lista
+ MachGroupList.Add(NewMachGroup)
+ ' e lo seleziono
+ SelectedMachGroup = NewMachGroup
+ EgtDraw()
+ ''Application.Msn.NotifyColleagues(Application.LOADOPERATIONLIST, -1)
+ ''Application.Msn.NotifyColleagues(Application.UPDATECURRENTMACHINE)
+ End If
+ End Sub
+
+#End Region ' AddMachGroupCommand
+
+#Region "RemoveMachGroupCommand"
+
+ '''
+ ''' Returns a command that set the selected MachGroup as the Current one.
+ '''
+ Public ReadOnly Property RemoveMachGroupCommand As ICommand
+ Get
+ If m_cmdRemoveMachGroup Is Nothing Then
+ m_cmdRemoveMachGroup = New Command(AddressOf RemoveMachGroup)
+ End If
+ Return m_cmdRemoveMachGroup
+ End Get
+ End Property
+
+ Public Sub RemoveMachGroup()
+ ' Calcolo indice del gruppo da cancellare
+ Dim nSelectedMachGroupIndex As Integer = MachGroupList.IndexOf(SelectedMachGroup)
+ If MachGroupList.Count = 1 Then
+ 'chiedo conferma prima di resettare il gruppo di lavorazione
+ Select Case MessageBox.Show("Eliminare?", "", MessageBoxButton.YesNo, MessageBoxImage.Question)
+ Case MessageBoxResult.Yes
+ ' cancello il gruppo corrente e ne creo uno nuovo con lo stesso nome
+ EgtRemoveMachGroup(MachGroupList(0).Id)
+ MachGroupList.Clear()
+ AddMachGroup()
+ EgtDraw()
+ Case MessageBoxResult.No
+ Return
+ End Select
+ Else
+ 'chiedo conferma prima di cancellare il gruppo di lavorazione
+ Select Case MessageBox.Show("Eliminare?", "", MessageBoxButton.YesNo, MessageBoxImage.Question)
+ Case MessageBoxResult.Yes
+ If nSelectedMachGroupIndex = 0 And MachGroupList.Count > 1 Then
+ ' rendo corrente il gruppo di lavorazione successivo a quello da cancellare
+ EgtSetCurrMachGroup(MachGroupList(nSelectedMachGroupIndex + 1).Id)
+ SelectedMachGroup = MachGroupList(nSelectedMachGroupIndex + 1)
+ ElseIf nSelectedMachGroupIndex > 0 Then
+ ' rendo corrente il gruppo di lavorazione precedente a quello da cancellare
+ EgtSetCurrMachGroup(MachGroupList(nSelectedMachGroupIndex - 1).Id)
+ SelectedMachGroup = MachGroupList(nSelectedMachGroupIndex - 1)
+ End If
+ EgtDraw()
+ ' cancello quello selezionato
+ EgtRemoveMachGroup(MachGroupList(nSelectedMachGroupIndex).Id)
+ ' aggiorno la lista dei gruppi
+ MachGroupList.RemoveAt(nSelectedMachGroupIndex)
+ Case MessageBoxResult.No
+ Return
+ End Select
+ End If
+
+ End Sub
+
+#End Region ' RemoveMachGroupCommand
+
+#End Region ' COMMANDS
+
+End Class
+
+Public Class MachGroup
+
+ Private m_Id As Integer
+ Public ReadOnly Property Id As Integer
+ Get
+ Return m_Id
+ End Get
+ End Property
+
+ Private m_Name As String
+ Public ReadOnly Property Name As String
+ Get
+ Return m_Name
+ End Get
+ End Property
+
+ Private m_Machine As String
+ Public ReadOnly Property Machine As String
+ Get
+ Return m_Machine
+ End Get
+ End Property
+
+#Region "ToolTip"
+
+ Public ReadOnly Property MachGroupToolTip As String
+ Get
+ Return "Name: " & m_Name & Environment.NewLine &
+ "Machine: " & m_Machine
+ End Get
+ End Property
+
+#End Region ' ToolTip
+
+ Sub New(nId As Integer, sName As String, sMachine As String)
+ m_Id = nId
+ m_Name = sName
+ m_Machine = sMachine
+ End Sub
+
+End Class
\ No newline at end of file
diff --git a/MachGroupPanel/NewMachGroupWnd/NewMachGroupWndV.xaml b/MachGroupPanel/NewMachGroupWnd/NewMachGroupWndV.xaml
new file mode 100644
index 0000000..ba21001
--- /dev/null
+++ b/MachGroupPanel/NewMachGroupWnd/NewMachGroupWndV.xaml
@@ -0,0 +1,55 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/MachGroupPanel/NewMachGroupWnd/NewMachGroupWndV.xaml.vb b/MachGroupPanel/NewMachGroupWnd/NewMachGroupWndV.xaml.vb
new file mode 100644
index 0000000..0f8689f
--- /dev/null
+++ b/MachGroupPanel/NewMachGroupWnd/NewMachGroupWndV.xaml.vb
@@ -0,0 +1,25 @@
+Public Class NewMachGroupWndV
+
+ Private m_NewMachGroupWndVM As NewMachGroupWndVM
+
+#Region "CONSTRUCTOR"
+
+ Sub New(NewMachGroupWndVM As NewMachGroupWndVM, Owner As Window)
+ MyBase.New(Owner)
+ ' Funzione che interpreta l'xaml
+ InitializeComponent()
+ 'Me.Owner = Owner
+ Me.DataContext = NewMachGroupWndVM
+ ' Assegno al riferimento locale al VM il VM preso dal DataContext
+ m_NewMachGroupWndVM = DirectCast(Me.DataContext, NewMachGroupWndVM)
+ End Sub
+
+#End Region ' CONSTRUCTOR
+
+ Private Sub OkBtn_Click(sender As Object, e As RoutedEventArgs) Handles OkBtn.Click
+ If m_NewMachGroupWndVM.IsValid Then
+ DialogResult = True
+ End If
+ End Sub
+
+End Class
diff --git a/MachGroupPanel/NewMachGroupWnd/NewMachGroupWndVM.vb b/MachGroupPanel/NewMachGroupWnd/NewMachGroupWndVM.vb
new file mode 100644
index 0000000..475d9fd
--- /dev/null
+++ b/MachGroupPanel/NewMachGroupWnd/NewMachGroupWndVM.vb
@@ -0,0 +1,131 @@
+Imports EgtWPFLib5
+
+Public Class NewMachGroupWndVM
+ Inherits VMBase
+
+#Region "FIELDS & PROPERTIES"
+
+ Private m_Name As String
+ Public Property Name As String
+ Get
+ Return m_Name
+ End Get
+ Set(value As String)
+ m_Name = value
+ End Set
+ End Property
+
+ Private m_NameVisibility As Visibility
+ Public Property NameVisibility As Visibility
+ Get
+ Return m_NameVisibility
+ End Get
+ Set(value As Visibility)
+ m_NameVisibility = value
+ End Set
+ End Property
+
+ ' Lista delle macchine disponibili
+ Private m_MachineList As List(Of Machine)
+ Public Property MachineList As List(Of Machine)
+ Get
+ Return m_MachineList
+ End Get
+ Set(value As List(Of Machine))
+ m_MachineList = value
+ End Set
+ End Property
+
+ ' Macchina correntemente selezionata e quindi attiva
+ Private m_SelectedMachine As Machine
+ Public Property SelectedMachine As Machine
+ Get
+ Return m_SelectedMachine
+ End Get
+ Set(value As Machine)
+ If value IsNot m_SelectedMachine Then
+ m_SelectedMachine = value
+ NotifyPropertyChanged("SelectedMachine")
+ End If
+ End Set
+ End Property
+
+ Private m_MachineVisibility As Visibility
+ Public Property MachineVisibility As Visibility
+ Get
+ Return m_MachineVisibility
+ End Get
+ Set(value As Visibility)
+ m_MachineVisibility = value
+ End Set
+ End Property
+
+#Region "Messages"
+
+ Public ReadOnly Property TitleMsg As String
+ Get
+ Return "New Mach Group"
+ End Get
+ End Property
+ Public ReadOnly Property NameMsg As String
+ Get
+ 'Return EgtMsg(MSG_MAINWINDOW + 6)
+ End Get
+ End Property
+ Public ReadOnly Property MachineMsg As String
+ Get
+ 'Return EgtMsg(MSG_MAINWINDOW + 7)
+ End Get
+ End Property
+
+#End Region ' Messages
+
+ ' Definizione comandi
+ Private m_cmdOk As ICommand
+ Private m_cmdCancel As ICommand
+
+#End Region 'FIELDS & PROPERTIES
+
+#Region "CONSTRUCTOR"
+
+ Sub New(sName As String)
+ NameVisibility = Visibility.Visible
+ MachineVisibility = Visibility.Collapsed
+ m_Name = sName
+ End Sub
+ Sub New(SelectedMachine As Machine, MachineList As List(Of Machine))
+ NameVisibility = Visibility.Collapsed
+ MachineVisibility = Visibility.Visible
+ m_MachineList = MachineList
+ m_SelectedMachine = SelectedMachine
+ End Sub
+ Sub New(sName As String, SelectedMachine As Machine, MachineList As List(Of Machine))
+ NameVisibility = Visibility.Visible
+ MachineVisibility = Visibility.Visible
+ m_Name = sName
+ m_MachineList = MachineList
+ m_SelectedMachine = SelectedMachine
+ End Sub
+
+#End Region ' CONSTRUCTOR
+
+#Region "METHODS"
+
+ Friend Function IsValid() As Boolean
+ Dim bOk As Boolean
+ If m_NameVisibility = Visibility.Visible Then
+ bOk = If(Not String.IsNullOrWhiteSpace(m_Name), True, False)
+ Else
+ bOk = True
+ End If
+ If m_MachineVisibility = Visibility.Visible Then
+ bOk = If(Not IsNothing(m_SelectedMachine), True, False)
+ Else
+ bOk = True
+ End If
+ Return bOk
+ End Function
+
+#End Region ' METHODS
+
+End Class
diff --git a/Machine.vb b/Machine.vb
new file mode 100644
index 0000000..3bccd99
--- /dev/null
+++ b/Machine.vb
@@ -0,0 +1,81 @@
+Imports System.IO
+
+'''
+''' Class that create the association Name/IniPath for the machine
+'''
+Public Class Machine
+
+ Private m_sName As String
+ Public ReadOnly Property Name As String
+ Get
+ Return m_sName
+ End Get
+ End Property
+
+ Private m_DirPath As String
+ Public ReadOnly Property DirPath As String
+ Get
+ Return m_DirPath
+ End Get
+ End Property
+
+ Private m_IniPath As String
+ Public ReadOnly Property IniPath As String
+ Get
+ Return m_IniPath
+ End Get
+ End Property
+
+ Sub New(sDirPath As String, sIniPath As String)
+ If Not String.IsNullOrWhiteSpace(sDirPath) Then
+ m_sName = Path.GetFileName(sDirPath)
+ m_DirPath = sDirPath
+ m_IniPath = sIniPath
+ Else
+ m_sName = String.Empty
+ m_DirPath = String.Empty
+ m_IniPath = String.Empty
+ End If
+ End Sub
+
+ Public Shared Function MachineListInit(sMachinesRootDir As String, MachineList As List(Of Machine)) As Boolean
+ ' Se direttorio base macchine non definito o non esiste, ritorno
+ If String.IsNullOrWhiteSpace(sMachinesRootDir) OrElse
+ Not Directory.Exists(sMachinesRootDir) Then
+ MachineList = Nothing
+ Return False
+ End If
+ ' Cerco le macchine
+ Dim Machines As String() = Directory.GetDirectories(sMachinesRootDir)
+ For i As Integer = 0 To Machines.Count - 1
+ Dim PathIni As String = Machines(i) & "\" & Path.GetFileName(Machines(i)) & ".ini"
+ If File.Exists(PathIni) Then
+ MachineList.Add(New Machine(Machines(i), PathIni))
+ End If
+ Next
+ Return True
+ End Function
+
+ Public Shared Function SearchMachine(sName As String, FoundedMachine As Machine, MachineList As List(Of Machine)) As Boolean
+ For Each Machine In MachineList
+ If Machine.Name = sName Then
+ FoundedMachine = Machine
+ Return True
+ End If
+ Next
+ FoundedMachine = Nothing
+ Return False
+ End Function
+
+ Public Shared Function SearchMachineIni(sName As String, FoundedIni As String, MachineList As List(Of Machine)) As Boolean
+ For Each Machine In MachineList
+ If Machine.Name = sName Then
+ FoundedIni = Machine.IniPath
+ Return True
+ End If
+ Next
+ FoundedIni = String.Empty
+ Return False
+ End Function
+
+End Class
diff --git a/Themes/Generic.xaml b/Themes/Generic.xaml
index d697798..39ef53e 100644
--- a/Themes/Generic.xaml
+++ b/Themes/Generic.xaml
@@ -493,7 +493,8 @@