aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules')
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MachineCreationDialogVM.cs28
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs5
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineCreationDialog.xaml2
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineSettingsView.xaml2
4 files changed, 29 insertions, 8 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MachineCreationDialogVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MachineCreationDialogVM.cs
index c7c7267a4..9d203b76d 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MachineCreationDialogVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MachineCreationDialogVM.cs
@@ -15,9 +15,24 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
public List<HardwareVersion> HardwareVersions { get; set; }
- public HardwareVersion SelectedHardwareVersion { get; set; }
+ public List<HardwareVersion> HardwareVersionsFiltered
+ {
+ get { return HardwareVersions.Where(x => x.MachineType == (int)MachineType).ToList(); }
+ }
- public MachinePrototype SelectedPrototype { get; set; }
+ private HardwareVersion _selectedHardwareVersion;
+ public HardwareVersion SelectedHardwareVersion
+ {
+ get { return _selectedHardwareVersion; }
+ set { _selectedHardwareVersion = value; RaisePropertyChangedAuto(); }
+ }
+
+ private MachinePrototype _selectedProtoType;
+ public MachinePrototype SelectedPrototype
+ {
+ get { return _selectedProtoType; }
+ set { _selectedProtoType = value; MachineType = (MachineTypes)value.MachineType; }
+ }
private bool _isNewMachine;
public bool IsNewMachine
@@ -33,7 +48,12 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
set { _serialNumber = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); }
}
- public MachineTypes MachineType { get; set; }
+ private MachineTypes _machineType;
+ public MachineTypes MachineType
+ {
+ get { return _machineType; }
+ set { _machineType = value; RaisePropertyChanged(nameof(HardwareVersionsFiltered)); SelectedHardwareVersion = HardwareVersionsFiltered.FirstOrDefault(); }
+ }
private String _name;
public String Name
@@ -44,7 +64,7 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
protected override bool CanOK()
{
- return base.CanOK() && !String.IsNullOrWhiteSpace(SerialNumber) && !String.IsNullOrWhiteSpace(Name);
+ return base.CanOK() && !String.IsNullOrWhiteSpace(SerialNumber) && !String.IsNullOrWhiteSpace(Name) && SelectedHardwareVersion != null;
}
}
}
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 855f063fc..cad54c848 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
@@ -541,6 +541,7 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
ActiveMachine.SerialNumber = machineCreationDialogVM.SerialNumber;
ActiveMachine.Name = machineCreationDialogVM.Name;
ActiveMachine.Type = machineCreationDialogVM.MachineType;
+ ActiveMachine.MachineVersion = ActiveMachineAdapter.MachineVersions.First(x => x.MachineType == machineCreationDialogVM.MachineType);
ActiveMachineAdapter.Context.Machines.Add(ActiveMachine);
}
else
@@ -549,7 +550,7 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
{
initHwConfig = false;
ActiveMachine = machineCreationDialogVM.SelectedPrototype.CreateMachine(machineCreationDialogVM.SerialNumber, machineCreationDialogVM.Name);
- ActiveMachine.MachineVersion = ActiveMachineAdapter.MachineVersions.FirstOrDefault(x => x.Guid == ActiveMachine.MachineVersionGuid);
+ ActiveMachine.MachineVersion = ActiveMachineAdapter.MachineVersions.First(x => x.MachineType == machineCreationDialogVM.MachineType);
if (machineCreationDialogVM.SelectedHardwareVersion != null)
{
@@ -862,7 +863,7 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
vm.IsNewMachine = true;
vm.Prototypes = prototypes.ToList();
vm.HardwareVersions = hardwareVersions.OrderByDescending(x => x.Version).ToList();
- vm.SelectedHardwareVersion = vm.HardwareVersions.FirstOrDefault();
+ vm.SelectedHardwareVersion = vm.HardwareVersions.Where(x => x.ForMachineType == MachineTypes.TS1800).FirstOrDefault();
_notification.ShowModalDialog<MachineCreationDialogVM, Views.MachineCreationDialog>(vm, (x) =>
{
using (ObservablesContext db = ObservablesContext.CreateDefault())
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineCreationDialog.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineCreationDialog.xaml
index b1a393875..8a4a9161b 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineCreationDialog.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineCreationDialog.xaml
@@ -73,7 +73,7 @@
<StackPanel Margin="0 20 0 0" Visibility="{Binding IsNewMachine,Converter={StaticResource BooleanToVisibilityConverter}}">
<TextBlock FontSize="10">Hardware Version</TextBlock>
- <ComboBox Margin="0 2 0 0" ItemsSource="{Binding HardwareVersions}" SelectedItem="{Binding SelectedHardwareVersion}" DisplayMemberPath="FullName"></ComboBox>
+ <ComboBox Margin="0 2 0 0" ItemsSource="{Binding HardwareVersionsFiltered}" SelectedItem="{Binding SelectedHardwareVersion}" DisplayMemberPath="FullName"></ComboBox>
</StackPanel>
</StackPanel>
</Grid>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineSettingsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineSettingsView.xaml
index 4ba79d3f5..852e60d0f 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineSettingsView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineSettingsView.xaml
@@ -54,7 +54,7 @@
<ComboBox ItemsSource="{Binding Source={x:Type enumerations:HeadTypes},Converter={StaticResource EnumToItemsSourceConverter}}" SelectedValue="{Binding ActiveMachine.MachineHeadType}" SelectedValuePath="Value" DisplayMemberPath="DisplayName" Style="{StaticResource TransparentComboBoxStyle}"></ComboBox>
<TextBlock FontWeight="SemiBold">Machine Version</TextBlock>
- <ComboBox Background="Transparent" ItemsSource="{Binding ActiveMachineAdapter.MachineVersions}" SelectedItem="{Binding ActiveMachine.MachineVersion}" DisplayMemberPath="Name" Style="{StaticResource TransparentComboBoxStyle}" ></ComboBox>
+ <ComboBox IsEnabled="False" Background="Transparent" ItemsSource="{Binding ActiveMachineAdapter.MachineVersions}" SelectedItem="{Binding ActiveMachine.MachineVersion}" DisplayMemberPath="Name" Style="{StaticResource TransparentComboBoxStyle}" ></ComboBox>
<TextBlock FontWeight="SemiBold">Version Tag</TextBlock>
<ComboBox Background="Transparent" ItemsSource="{Binding Tags}" SelectedItem="{Binding ActiveMachine.VersionTag}" Style="{StaticResource TransparentComboBoxStyle}" ></ComboBox>