aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner
diff options
context:
space:
mode:
authorVictoria Plitt <Victoria.Plitt@twine-s.com>2020-01-26 10:49:48 +0200
committerVictoria Plitt <Victoria.Plitt@twine-s.com>2020-01-26 10:49:48 +0200
commitb036bae722696ce97279fa556394379688508f12 (patch)
treee45372a748a501649b8d45e3143be9001566ed95 /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner
parent08a821df17dcfe04b6749ffdf326a8265285764c (diff)
parent2367c43d732aea2ea169f6fa5844fc877d96632d (diff)
downloadTango-b036bae722696ce97279fa556394379688508f12.tar.gz
Tango-b036bae722696ce97279fa556394379688508f12.zip
Merge branch 'master' of https://twinetfs.visualstudio.com/Tango/_git/Tango
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner')
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/HardwareConfigurationViewVM.cs21
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MachineCreationDialogVM.cs45
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MachineUpdatesViewVM.cs2
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs217
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineCreationDialog.xaml47
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineDetailsView.xaml14
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineSettingsView.xaml45
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MainView.xaml2
8 files changed, 334 insertions, 59 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/HardwareConfigurationViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/HardwareConfigurationViewVM.cs
index 51d88c3f9..e29ba3b6f 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/HardwareConfigurationViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/HardwareConfigurationViewVM.cs
@@ -92,16 +92,19 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
{
HardwareVersion hardwareVersion = configuration.HardwareVersion;
- _hwConfig = configuration.GetHardwareConfiguration();
+ if (hardwareVersion != null)
+ {
+ _hwConfig = configuration.GetHardwareConfiguration();
- Collections.Clear();
- Collections.Add(CreateMotorsCollection(hardwareVersion));
- Collections.Add(CreateDancerCollection(hardwareVersion));
- Collections.Add(CreatePidCollection(hardwareVersion));
- Collections.Add(CreateWindersCollection(hardwareVersion));
- Collections.Add(CreateSpeedSensorsCollection(hardwareVersion));
- Collections.Add(CreateBlowersCollection(hardwareVersion));
- Collections.Add(CreateBreakSensorCollection(hardwareVersion));
+ Collections.Clear();
+ Collections.Add(CreateMotorsCollection(hardwareVersion));
+ Collections.Add(CreateDancerCollection(hardwareVersion));
+ Collections.Add(CreatePidCollection(hardwareVersion));
+ Collections.Add(CreateWindersCollection(hardwareVersion));
+ Collections.Add(CreateSpeedSensorsCollection(hardwareVersion));
+ Collections.Add(CreateBlowersCollection(hardwareVersion));
+ Collections.Add(CreateBreakSensorCollection(hardwareVersion));
+ }
}
private HardwareCollection CreateMotorsCollection(HardwareVersion hardwareVersion)
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 0f6ab3314..4584d3508 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
@@ -13,5 +13,50 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
public List<MachineVersion> MachineVersions { get; set; }
public MachineVersion SelectedMachineVersion { get; set; }
+
+ private bool _isNewMachine;
+ public bool IsNewMachine
+ {
+ get { return _isNewMachine; }
+ set { _isNewMachine = value; RaisePropertyChangedAuto(); }
+ }
+
+ private String _serialNumber;
+ public String SerialNumber
+ {
+ get { return _serialNumber; }
+ set { _serialNumber = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); }
+ }
+
+ private String _name;
+ public String Name
+ {
+ get { return _name; }
+ set { _name = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); }
+ }
+
+ private bool _generateDispensers;
+ public bool GenerateDispensers
+ {
+ get { return _generateDispensers; }
+ set { _generateDispensers = value; RaisePropertyChangedAuto(); }
+ }
+
+ private double _dispenserFactor;
+ public double DispenserFactor
+ {
+ get { return _dispenserFactor; }
+ set { _dispenserFactor = value; RaisePropertyChangedAuto(); }
+ }
+
+ public MachineCreationDialogVM() : base()
+ {
+ DispenserFactor = 2.34;
+ }
+
+ protected override bool CanOK()
+ {
+ return base.CanOK() && !String.IsNullOrWhiteSpace(SerialNumber) && !String.IsNullOrWhiteSpace(Name);
+ }
}
}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MachineUpdatesViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MachineUpdatesViewVM.cs
index 41bcc2a87..616ad0a47 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MachineUpdatesViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MachineUpdatesViewVM.cs
@@ -110,6 +110,8 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
DisplayMachineSetups = true;
DisplayDatabaseUpdates = true;
DisplaySynchronizations = true;
+ DisplayOfflineUpdates = true;
+ DisplayFirmwareUpgrades = true;
RefreshCommand = new RelayCommand(Refresh, () => IsFree);
}
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 7b6ae7ef0..e0d99d0f0 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
@@ -39,10 +39,16 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
private ActionTimer _machines_action_timer;
private ActionTimer _dispensers_action_timer;
private MachineDTO _machineBeforeSave;
- private bool _isNewMachine;
#region Properties
+ private bool _isNewMachine;
+ public bool IsNewMachine
+ {
+ get { return _isNewMachine; }
+ set { _isNewMachine = value; RaisePropertyChangedAuto(); }
+ }
+
private ObservablesStaticCollections _machinesAdapter;
public ObservablesStaticCollections MachinesAdapter
{
@@ -228,6 +234,11 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
/// </summary>
public RelayCommand ResetDeviceRegistrationCommand { get; set; }
+ /// <summary>
+ /// Gets or sets the make prototype command.
+ /// </summary>
+ public RelayCommand MakePrototypeCommand { get; set; }
+
#endregion
#region Constructors
@@ -261,6 +272,7 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
RemoveSpoolCommand = new RelayCommand(RemoveSpool, () => SelectedSpool != null);
CloneMachineCommand = new RelayCommand(CloneMachine, () => SelectedMachine != null);
ResetDeviceRegistrationCommand = new RelayCommand(ResetDeviceRegistration);
+ MakePrototypeCommand = new RelayCommand(MakePrototype);
MachineUpdatesViewVM = new MachineUpdatesViewVM(_notification);
TupViewVM = new TupViewVM(_notification);
@@ -286,7 +298,7 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
{
Task.Factory.StartNew(() =>
{
- ActiveMachineAdapter.Dispensers = ActiveMachineAdapter.Context.Dispensers.Where(x => x.SerialNumber.ToLower().StartsWith(DispensersFilter.ToLower())).ToSynchronizedObservableCollection();
+ ActiveMachineAdapter.Dispensers = ActiveMachineAdapter.Context.Dispensers.Where(x => x.SerialNumber.ToLower().StartsWith(DispensersFilter.ToLower())).OrderBy(x => x.SerialNumber).ToSynchronizedObservableCollection();
});
});
}
@@ -435,9 +447,9 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
InvalidateRelayCommands();
}
- private async void LoadSelectedMachine(bool newMachine = false, bool clone = false, MachineVersion selectedVersion = null)
+ private async void LoadSelectedMachine(bool newMachine = false, bool clone = false, MachineCreationDialogVM machineCreationDialogVM = null)
{
- _isNewMachine = false;
+ IsNewMachine = false;
using (_notification.PushTaskItem("Loading machine details..."))
{
@@ -470,6 +482,10 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
ActiveMachineAdapter.MachineVersions = (await ActiveMachineAdapter.Context.MachineVersions.ToListAsync()).ToObservableCollection();
ActiveMachineAdapter.Organizations = (await ActiveMachineAdapter.Context.Organizations.ToListAsync()).ToObservableCollection();
+ bool initHwConfig = true;
+
+ Configuration machineConfigBeforeClone = null;
+
if (!newMachine)
{
ActiveMachine = (await new MachineBuilder(ActiveMachineAdapter.Context).Set(SelectedMachine.Guid).WithOrganization().WithConfiguration().WithSpools().BuildAsync());
@@ -478,10 +494,12 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
if (clone)
{
- _isNewMachine = true;
+ machineConfigBeforeClone = ActiveMachine.Configuration;
+
+ IsNewMachine = true;
ActiveMachine = ActiveMachine.Clone();
- ActiveMachine.Name = "";
- ActiveMachine.SerialNumber = "";
+ ActiveMachine.Name = machineCreationDialogVM.Name;
+ ActiveMachine.SerialNumber = machineCreationDialogVM.SerialNumber;
ActiveMachine.IsDeviceRegistered = false;
ActiveMachine.DeviceId = null;
ActiveMachine.DeviceName = null;
@@ -490,23 +508,112 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
}
else
{
- _isNewMachine = true;
+ IsNewMachine = true;
- if (selectedVersion == null)
+ if (machineCreationDialogVM.SelectedMachineVersion == null)
{
ActiveMachine = new Machine();
ActiveMachine.Configuration = new Configuration();
+ ActiveMachine.SerialNumber = machineCreationDialogVM.SerialNumber;
+ ActiveMachine.Name = machineCreationDialogVM.Name;
ActiveMachineAdapter.Context.Machines.Add(ActiveMachine);
}
else
{
- ActiveMachine = selectedVersion.CreatePrototypeMachine(ActiveMachineAdapter.Context);
- ActiveMachineAdapter.Context.Machines.Add(ActiveMachine);
+ try
+ {
+ initHwConfig = false;
+ ActiveMachine = machineCreationDialogVM.SelectedMachineVersion.CreatePrototypeMachine(ActiveMachineAdapter.Context);
+ ActiveMachine.SerialNumber = machineCreationDialogVM.SerialNumber;
+ ActiveMachine.Name = machineCreationDialogVM.Name;
+ ActiveMachineAdapter.Context.Machines.Add(ActiveMachine);
+
+ HardwareConfigurationViewVM = new HardwareConfigurationViewVM(_notification);
+ var version = await new HardwareVersionBuilder(ActiveMachineAdapter.Context).Set(ActiveMachine.Configuration.HardwareVersionGuid).WithHardwareComponents().BuildAsync();
+ HardwareConfigurationViewVM.Init(ActiveMachine.Configuration);
+ }
+ catch (Exception ex)
+ {
+ _notification.ShowError($"Invalid machine version prototype.\n{ex.FlattenMessage()}");
+ View.NavigateTo(MachineDesignerNavigationView.MachinesView);
+ return;
+ }
}
}
- Sites = await ActiveMachineAdapter.Context.Sites.ToListAsync();
- Sites.Insert(0, new Site() { Name = "NONE", ID = -1 });
+ if ((newMachine || clone) && machineCreationDialogVM.GenerateDispensers)
+ {
+ for (int i = 0; i < 8; i++)
+ {
+ var serial = machineCreationDialogVM.SerialNumber + "-" + (i + 1);
+
+ var existingDispenser = await ActiveMachineAdapter.Context.Dispensers.Include(x => x.IdsPacks).SingleAsync(x => x.SerialNumber == serial);
+
+ if (existingDispenser != null)
+ {
+ if (existingDispenser.IsInstalled)
+ {
+ _notification.ShowError($"Dispenser '{serial}' already exists. Cannot create machine.");
+ return;
+ }
+ else
+ {
+ if (!_notification.ShowErrorQuestion($"Dispenser '{serial}' already exists and is not installed. Do you wish to assign the existing dispenser to this machine?"))
+ {
+ return;
+ }
+ }
+ }
+
+ Dispenser dispenser = new Dispenser();
+
+ if (existingDispenser == null)
+ {
+ dispenser.SerialNumber = serial;
+
+ if (newMachine)
+ {
+ dispenser.NlPerPulse = machineCreationDialogVM.DispenserFactor;
+ dispenser.DispenserTypeGuid = ActiveMachineAdapter.DispenserTypes.First().Guid;
+ }
+ else
+ {
+ var packBefore = machineConfigBeforeClone.NoneEmptyIdsPacks.SingleOrDefault(x => x.PackIndex == i);
+
+ if (packBefore != null)
+ {
+ dispenser.NlPerPulse = packBefore.Dispenser.NlPerPulse;
+ dispenser.DispenserTypeGuid = packBefore.Dispenser.DispenserType.Guid;
+ }
+ else
+ {
+ continue;
+ }
+ }
+
+ dispenser.ProductionDate = DateTime.UtcNow;
+
+ ActiveMachineAdapter.Context.Dispensers.Add(dispenser);
+ }
+ else
+ {
+ dispenser = existingDispenser;
+ }
+
+ var idsPack = ActiveMachine.Configuration.NoneEmptyIdsPacks.SingleOrDefault(x => x.PackIndex == i);
+
+ if (idsPack != null)
+ {
+ idsPack.Dispenser = dispenser;
+ idsPack.DispenserGuid = dispenser.Guid;
+ }
+ }
+ }
+
+ var sites = await ActiveMachineAdapter.Context.Sites.ToListAsync();
+ sites.Insert(0, new Site() { Name = "NONE", ID = -1 });
+
+ Sites = sites;
SelectedSite = Sites.SingleOrDefault(x => x.Guid == ActiveMachine.SiteGuid);
ColorCalibrationViewVM = new ColorCalibrationViewVM(_notification, ActiveMachine, _activeMachineAdapter.Context)
@@ -516,11 +623,17 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
SelectedRML = ActiveMachineAdapter.Rmls.FirstOrDefault(),
};
- HardwareConfigurationViewVM = new HardwareConfigurationViewVM(_notification);
- HardwareConfigurationViewVM.Init(ActiveMachine.Configuration);
+ if (initHwConfig)
+ {
+ HardwareConfigurationViewVM = new HardwareConfigurationViewVM(_notification);
+ HardwareConfigurationViewVM.Init(ActiveMachine.Configuration);
+ }
- await MachineUpdatesViewVM.Init(ActiveMachine, ActiveMachineAdapter.Context);
- TupViewVM.Init(ActiveMachine);
+ if (!IsNewMachine)
+ {
+ await MachineUpdatesViewVM.Init(ActiveMachine, ActiveMachineAdapter.Context);
+ TupViewVM.Init(ActiveMachine);
+ }
ActiveMachine.Configuration.HardwareVersionChanged += Configuration_HardwareVersionChanged;
@@ -549,6 +662,11 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
{
try
{
+ if (HardwareConfigurationViewVM == null)
+ {
+ HardwareConfigurationViewVM = new HardwareConfigurationViewVM(_notification);
+ }
+
version = await new HardwareVersionBuilder(ActiveMachineAdapter.Context).Set(version.Guid).WithHardwareComponents().BuildAsync();
HardwareConfigurationViewVM.Init(ActiveMachine.Configuration);
}
@@ -692,7 +810,7 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
ActiveMachine.Configuration.SetHardwareConfiguration(hwConfig);
await ActiveMachineAdapter.Context.SaveChangesAsync();
- if (_isNewMachine)
+ if (IsNewMachine)
{
_actionLogManager.InsertLog(BL.Enumerations.ActionLogType.MachineCreated, _authentication.CurrentUser, ActiveMachine.Name, ActiveMachine, "New machine created using Machine Studio.");
}
@@ -726,16 +844,23 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
private void AddNewMachine()
{
MachineCreationDialogVM vm = new MachineCreationDialogVM();
+ vm.IsNewMachine = true;
vm.MachineVersions = MachinesAdapter.MachineVersions.ToList();
_notification.ShowModalDialog<MachineCreationDialogVM, Views.MachineCreationDialog>(vm, (x) =>
{
+ if (MachinesAdapter.Context.Machines.Any(y => y.SerialNumber == vm.SerialNumber || y.Name.ToLower() == vm.Name.ToLower()))
+ {
+ _notification.ShowError("Machine serial number or name already exists.");
+ return;
+ }
+
if (vm.SelectedMachineVersion != null && String.IsNullOrWhiteSpace(vm.SelectedMachineVersion.PrototypeMachineData))
{
_notification.ShowError("The selected version does not contain any prototype machine data.");
return;
}
- LoadSelectedMachine(true, false, vm.SelectedMachineVersion);
+ LoadSelectedMachine(true, false, vm);
}, () => { });
}
@@ -749,8 +874,9 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
{
IsFree = false;
await SelectedMachine.DeleteCascadeAsync(MachinesAdapter.Context);
- MachinesAdapter.Context.Machines.Remove(SelectedMachine);
_actionLogManager.InsertLog(BL.Enumerations.ActionLogType.MachineDeleted, _authentication.CurrentUser, SelectedMachine.Name, SelectedMachine, "Machine deleted using Machine Studio.");
+ MachinesAdapter.Context.Machines.Remove(SelectedMachine);
+ MachinesAdapter.Machines.Remove(SelectedMachine);
}
catch (Exception ex)
{
@@ -775,11 +901,58 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
}
}
+ private async void MakePrototype()
+ {
+ if (ActiveMachine.MachineVersion == null)
+ {
+ _notification.ShowError("Machine version must be selected in order to make a prototype.");
+ return;
+ }
+
+ if (_notification.ShowQuestion($"Are you sure you wish to make this machine configuration as a prototype for version '{ActiveMachine.MachineVersion.Name}' ?"))
+ {
+ using (_notification.PushTaskItem($"Making prototype machine for '{ActiveMachine.MachineVersion.Name}'..."))
+ {
+ try
+ {
+ IsFree = false;
+
+ using (var db = ObservablesContext.CreateDefault())
+ {
+ var machineVersion = await db.MachineVersions.SingleOrDefaultAsync(x => x.Guid == ActiveMachine.MachineVersionGuid);
+ await machineVersion.ApplyPrototypeMachine(ActiveMachine, db);
+ await db.SaveChangesAsync();
+ }
+ }
+ catch (Exception ex)
+ {
+ _notification.ShowError($"Error making machine version prototype\n{ex.FlattenMessage()}");
+ }
+ finally
+ {
+ IsFree = true;
+ }
+ }
+ }
+ }
+
#endregion
private void CloneMachine()
{
- LoadSelectedMachine(false, true);
+ MachineCreationDialogVM vm = new MachineCreationDialogVM();
+ vm.IsNewMachine = false;
+ vm.MachineVersions = MachinesAdapter.MachineVersions.ToList();
+ _notification.ShowModalDialog<MachineCreationDialogVM, Views.MachineCreationDialog>(vm, (x) =>
+ {
+ if (MachinesAdapter.Context.Machines.Any(y => y.SerialNumber == vm.SerialNumber || y.Name.ToLower() == vm.Name.ToLower()))
+ {
+ _notification.ShowError("Machine serial number or name already exists.");
+ return;
+ }
+
+ LoadSelectedMachine(false, true, vm);
+ }, () => { });
}
private void AddNewSpool()
@@ -810,7 +983,7 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
try
{
IsFree = false;
- MachinesAdapter.Machines = MachinesAdapter.Context.Machines.Where(x => x.SerialNumber.StartsWith(Filter)).Include(x => x.Organization).Include(x => x.MachineVersion).ToSynchronizedObservableCollection();
+ MachinesAdapter.Machines = MachinesAdapter.Context.Machines.Where(x => x.SerialNumber.StartsWith(Filter)).Include(x => x.Organization).Include(x => x.MachineVersion).OrderBy(x => x.SerialNumber).ToSynchronizedObservableCollection();
}
catch
{
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 2d380c0d2..417dfbc0b 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
@@ -6,9 +6,15 @@
xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:vm="clr-namespace:Tango.MachineStudio.MachineDesigner.ViewModels"
+ xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI"
xmlns:local="clr-namespace:Tango.MachineStudio.MachineDesigner.Views"
mc:Ignorable="d"
- d:DesignHeight="400" d:DesignWidth="700" Height="400" Width="700" Background="{StaticResource WhiteBackgroundBrush}" d:DataContext="{d:DesignInstance Type=vm:MachineCreationDialogVM, IsDesignTimeCreatable=False}">
+ d:DesignHeight="400" d:DesignWidth="700" Height="460" Width="750" Background="{StaticResource WhiteBackgroundBrush}" d:DataContext="{d:DesignInstance Type=vm:MachineCreationDialogVM, IsDesignTimeCreatable=False}">
+
+ <UserControl.Resources>
+ <converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"></converters:BooleanToVisibilityConverter>
+ </UserControl.Resources>
+
<Grid Margin="10">
<DockPanel>
<Grid DockPanel.Dock="Top">
@@ -17,7 +23,18 @@
<Image Source="../Images/machine-full-fx.png" Width="120" RenderOptions.BitmapScalingMode="Fant"></Image>
<materialDesign:PackIcon HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0 0 -10 -10" Kind="PlusCircle" Foreground="#15C315" Width="42" Height="42" />
</Grid>
- <TextBlock Margin="30 0 0 0" VerticalAlignment="Bottom" FontSize="22">NEW MACHINE</TextBlock>
+ <TextBlock Margin="30 0 0 0" VerticalAlignment="Bottom" FontSize="22">
+ <TextBlock.Style>
+ <Style TargetType="TextBlock">
+ <Setter Property="Text" Value="CLONE MACHINE"></Setter>
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding IsNewMachine}" Value="True">
+ <Setter Property="Text" Value="NEW MACHINE"></Setter>
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </TextBlock.Style>
+ </TextBlock>
</StackPanel>
</Grid>
@@ -33,12 +50,30 @@
</Grid>
<Grid>
- <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Width="400">
- <TextBlock TextWrapping="Wrap" TextAlignment="Center">
- <Run>Please specify the machine version in order to prototype the new machine with default machine settings and configuartion.</Run>
+ <StackPanel HorizontalAlignment="Left" VerticalAlignment="Top" Margin="20 20 0 0" Width="400">
+ <TextBlock TextWrapping="Wrap" Visibility="{Binding IsNewMachine,Converter={StaticResource BooleanToVisibilityConverter}}">
+ <Run>Please specify the machine version in order to prototype the new machine with default machine settings and configuration.</Run>
</TextBlock>
- <ComboBox ItemsSource="{Binding MachineVersions}" SelectedItem="{Binding SelectedMachineVersion}" DisplayMemberPath="Name" Margin="0 10 0 0" FontSize="16" materialDesign:HintAssist.Hint="NONE"></ComboBox>
+ <ComboBox Visibility="{Binding IsNewMachine,Converter={StaticResource BooleanToVisibilityConverter}}" ItemsSource="{Binding MachineVersions}" SelectedItem="{Binding SelectedMachineVersion}" DisplayMemberPath="Name" Margin="0 10 0 0" FontSize="16" materialDesign:HintAssist.Hint="NONE"></ComboBox>
+
+ <TextBlock Margin="0 20 0 0" FontSize="10">Serial Number</TextBlock>
+ <TextBox Margin="0 2 0 0" Text="{Binding SerialNumber,UpdateSourceTrigger=PropertyChanged}"></TextBox>
+
+ <TextBlock Margin="0 20 0 0" FontSize="10">Name</TextBlock>
+ <TextBox Margin="0 2 0 0" Text="{Binding Name,UpdateSourceTrigger=PropertyChanged}"></TextBox>
+
+ <CheckBox Margin="0 30 0 0" IsChecked="{Binding GenerateDispensers}">
+ <TextBlock>
+ <Run>Automatically generate 8 dispensers for this machine</Run>
+ <Run>(</Run><Run Foreground="{StaticResource GrayBrush}" FontSize="10" Text="{Binding SerialNumber}"></Run><Run Foreground="{StaticResource GrayBrush}" FontSize="10">-1-8</Run><Run>)</Run>
+ </TextBlock>
+ </CheckBox>
+
+ <StackPanel Margin="20 10 0 0" Visibility="{Binding IsNewMachine,Converter={StaticResource BooleanToVisibilityConverter}}">
+ <TextBlock FontSize="10">Dispenser max nl/cm</TextBlock>
+ <mahapps:NumericUpDown Minimum="0" StringFormat="0.00" Maximum="10" InterceptMouseWheel="True" Value="{Binding DispenserFactor,Mode=TwoWay}" HorizontalContentAlignment="Left" Width="95" HorizontalAlignment="Left" BorderThickness="0 0 0 1" Margin="0 2 0 0" HideUpDownButtons="True" HasDecimals="True"></mahapps:NumericUpDown>
+ </StackPanel>
</StackPanel>
</Grid>
</DockPanel>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineDetailsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineDetailsView.xaml
index bcca83ca5..b2b770698 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineDetailsView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineDetailsView.xaml
@@ -5,11 +5,17 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Tango.MachineStudio.MachineDesigner.Views"
xmlns:global="clr-namespace:Tango.MachineStudio.MachineDesigner"
- xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
+ xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
+ xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI"
xmlns:vm="clr-namespace:Tango.MachineStudio.MachineDesigner.ViewModels"
xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI"
mc:Ignorable="d"
d:DesignHeight="1080" d:DesignWidth="1920" Background="Transparent" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}">
+
+ <UserControl.Resources>
+ <converters:BooleanToVisibilityInverseConverter x:Key="BooleanToVisibilityInverseConverter" />
+ </UserControl.Resources>
+
<Grid Margin="20">
<DockPanel>
<Grid DockPanel.Dock="Top">
@@ -23,7 +29,7 @@
</StackPanel>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0 0 20 0">
- <Button Width="170" Height="45" VerticalAlignment="Center" Command="{Binding SaveCommand}">
+ <Button Width="170" Height="45" VerticalAlignment="Center" Command="{Binding SaveCommand}">
<StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Kind="ContentSaveAll" Width="24" Height="24" />
<TextBlock VerticalAlignment="Center" Margin="10 0 0 0">SAVE</TextBlock>
@@ -61,10 +67,10 @@
<TabItem Header="HW CONFIGURATION">
<local:HardwareConfigurationView/>
</TabItem>
- <TabItem Header="UPDATES">
+ <TabItem Header="UPDATES" Visibility="{Binding IsNewMachine,Converter={StaticResource BooleanToVisibilityInverseConverter}}">
<local:MachineUpdatesView/>
</TabItem>
- <TabItem Header="TUP">
+ <TabItem Header="TUP" Visibility="{Binding IsNewMachine,Converter={StaticResource BooleanToVisibilityInverseConverter}}">
<local:TupView/>
</TabItem>
</TabControl>
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 4631ac068..499d6dc89 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
@@ -35,28 +35,39 @@
<ColumnDefinition Width="Auto" />
<ColumnDefinition/>
</Grid.ColumnDefinitions>
- <controls:TableGrid RowHeight="50" Margin="10">
- <TextBlock FontWeight="SemiBold">Serial Number</TextBlock>
- <TextBox Text="{Binding ActiveMachine.SerialNumber}"></TextBox>
- <TextBlock FontWeight="SemiBold">Name</TextBlock>
- <TextBox Text="{Binding ActiveMachine.Name}"></TextBox>
+ <StackPanel>
+ <controls:TableGrid RowHeight="50" Margin="10">
+ <TextBlock FontWeight="SemiBold">Serial Number</TextBlock>
+ <TextBox Text="{Binding ActiveMachine.SerialNumber}"></TextBox>
- <TextBlock FontWeight="SemiBold">Machine Version</TextBlock>
- <ComboBox Background="Transparent" ItemsSource="{Binding ActiveMachineAdapter.MachineVersions}" SelectedItem="{Binding ActiveMachine.MachineVersion}" DisplayMemberPath="Name" Style="{StaticResource TransparentComboBoxStyle}"></ComboBox>
+ <TextBlock FontWeight="SemiBold">Name</TextBlock>
+ <TextBox Text="{Binding ActiveMachine.Name}"></TextBox>
- <TextBlock FontWeight="SemiBold">Organization</TextBlock>
- <ComboBox Background="Transparent" ItemsSource="{Binding ActiveMachineAdapter.Organizations}" SelectedItem="{Binding ActiveMachine.Organization}" DisplayMemberPath="Name" 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>
- <TextBlock FontWeight="SemiBold">Site</TextBlock>
- <ComboBox Background="Transparent" ItemsSource="{Binding Sites}" SelectedItem="{Binding SelectedSite}" DisplayMemberPath="Name" Style="{StaticResource TransparentComboBoxStyle}"></ComboBox>
+ <TextBlock FontWeight="SemiBold">Organization</TextBlock>
+ <ComboBox Background="Transparent" ItemsSource="{Binding ActiveMachineAdapter.Organizations}" SelectedItem="{Binding ActiveMachine.Organization}" DisplayMemberPath="Name" Style="{StaticResource TransparentComboBoxStyle}"></ComboBox>
- <TextBlock FontWeight="SemiBold">OS Key</TextBlock>
- <TextBox Text="{Binding ActiveMachine.OsKey}"></TextBox>
+ <TextBlock FontWeight="SemiBold">Site</TextBlock>
+ <ComboBox Background="Transparent" ItemsSource="{Binding Sites}" SelectedItem="{Binding SelectedSite}" DisplayMemberPath="Name" Style="{StaticResource TransparentComboBoxStyle}"></ComboBox>
+
+ <TextBlock FontWeight="SemiBold">OS Key</TextBlock>
+ <TextBox Text="{Binding ActiveMachine.OsKey}"></TextBox>
+
+ <TextBlock FontWeight="SemiBold">Device COM Port</TextBlock>
+ <TextBox Text="{Binding ActiveMachine.DeviceComPort}"></TextBox>
+ </controls:TableGrid>
+
+ <Button Margin="0 20 0 0" Background="{StaticResource RedBrush300}" ToolTip="Make this machine configuration as a prototype for the selected machine version" BorderBrush="{StaticResource RedBrush300}" Width="200" Height="45" VerticalAlignment="Bottom" Command="{Binding MakePrototypeCommand}">
+ <StackPanel Orientation="Horizontal">
+ <materialDesign:PackIcon Kind="Copyright" Width="24" Height="24" />
+ <TextBlock VerticalAlignment="Center" Margin="10 0 0 0">MAKE PROTOTYPE</TextBlock>
+ </StackPanel>
+ </Button>
+ </StackPanel>
- <TextBlock FontWeight="SemiBold">Device COM Port</TextBlock>
- <TextBox Text="{Binding ActiveMachine.DeviceComPort}"></TextBox>
- </controls:TableGrid>
<Rectangle Grid.Column="1" StrokeThickness="1" Stroke="{StaticResource borderBrush}" HorizontalAlignment="Center" Margin="50 50" />
<controls:TableGrid RowHeight="50" Margin="10" Grid.Column="2">
<TextBlock FontWeight="SemiBold">Auto Login</TextBlock>
@@ -109,7 +120,7 @@
</TextBlock>
</StackPanel>
- <Button Command="{Binding ResetDeviceRegistrationCommand}" HorizontalAlignment="Center" VerticalAlignment="Center" Background="{StaticResource RedBrush300}" BorderBrush="{StaticResource RedBrush300}" Padding="10" Height="Auto">RESET DEVICE REGISTRATION</Button>
+ <Button Command="{Binding ResetDeviceRegistrationCommand}" HorizontalAlignment="Center" VerticalAlignment="Center" Background="{StaticResource RedBrush300}" BorderBrush="{StaticResource RedBrush300}" Padding="10" Height="45" Width="240">RESET DEVICE REGISTRATION</Button>
</DockPanel>
</Border>
</StackPanel>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MainView.xaml
index bc9b038dc..833086bf0 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MainView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MainView.xaml
@@ -9,7 +9,7 @@
xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI"
mc:Ignorable="d"
d:DesignHeight="1080" d:DesignWidth="1920" Background="Transparent" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}">
- <Grid>
+ <Grid IsEnabled="{Binding IsFree}">
<controls:NavigationControl x:Name="navigationControl" TransitionType="Slide">
<local:MachinesView />
<local:MachineDetailsView/>