aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs')
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs68
1 files changed, 63 insertions, 5 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs
index dbba1962e..241297d85 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs
@@ -32,7 +32,7 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
public Machine Machine
{
get { return _machine; }
- set { _machine = value; RaisePropertyChangedAuto(); }
+ set { _machine = value; RaisePropertyChangedAuto(); OnMachineChanged(); }
}
private Configuration _configuration;
@@ -45,8 +45,22 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
set { _configuration = value; RaisePropertyChangedAuto(); }
}
+ private IdsPack _selectedIds;
+ /// <summary>
+ /// Gets or sets the selected ids pack.
+ /// </summary>
+ public IdsPack SelectedIds
+ {
+ get { return _selectedIds; }
+ set { _selectedIds = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); }
+ }
+
public RelayCommand SaveCommand { get; set; }
+ public RelayCommand AddIdsCommand { get; set; }
+
+ public RelayCommand RemoveIdsCommand { get; set; }
+
/// <summary>
/// Initializes a new instance of the <see cref="MainViewVM"/> class.
/// </summary>
@@ -56,15 +70,59 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
Adapter = ObservablesEntitiesAdapter.Instance;
Configuration = new Configuration();
- Configuration.Name = "Config 2";
+ Configuration.Name = "Untitled";
+ SaveCommand = new RelayCommand(Save, (x) => !_isSaving);
+ AddIdsCommand = new RelayCommand(AddIds, (x) => !_isSaving && Configuration.IdsPacks.Count < 8);
+ RemoveIdsCommand = new RelayCommand(RemoveIds, (x) => !_isSaving && SelectedIds != null);
+ }
- for (int i = 0; i < 8; i++)
+ private void OnMachineChanged()
+ {
+ if (Machine != null)
+ {
+ Configuration = Machine.Configuration;
+ }
+ else
{
- Configuration.IdsPacks.Add(new IdsPack() { Name = "IDS PACK " + i });
+ Configuration = new Configuration() { Name = "Untitled" };
}
+ }
- SaveCommand = new RelayCommand(Save, (x) => !_isSaving);
+ public void DropTouchPanel(ApplicationDisplayPanelVersion applicationDisplayPanelVersion)
+ {
+ Configuration.ApplicationDisplayPanelVersions = applicationDisplayPanelVersion;
+ Configuration.ApplicationDisplayPanelVersionGuid = applicationDisplayPanelVersion.Guid;
+ }
+
+ public void DropApplicationVersion(ApplicationVersion applicationVersion)
+ {
+ Configuration.ApplicationVersions = applicationVersion;
+ Configuration.ApplicationVersionGuid = applicationVersion.Guid;
+ }
+
+ public void DropEmbeddedFirmware(EmbeddedFirmwareVersion embeddedFirmwareVersion)
+ {
+ Configuration.EmbeddedFirmwareVersions = embeddedFirmwareVersion;
+ Configuration.EmbeddedFirmwareVersionGuid = embeddedFirmwareVersion.Guid;
+ }
+
+ public void DropEmbeddedSoftware(EmbeddedSoftwareVersion embeddedSoftwareVersion)
+ {
+ Configuration.EmbeddedSoftwareVersions = embeddedSoftwareVersion;
+ Configuration.EmbeddedSoftwareVersionGuid = embeddedSoftwareVersion.Guid;
+ }
+
+ private void RemoveIds()
+ {
+ Configuration.IdsPacks.Remove(SelectedIds);
+ SelectedIds = null;
+ }
+
+ private void AddIds()
+ {
+ Configuration.IdsPacks.Add(new IdsPack());
+ InvalidateRelayCommands();
}
public void DropCartridgeType(CartridgeType cartridgeType, IdsPack idsPack)