aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules
diff options
context:
space:
mode:
authorRoy <Roy.mail.net@gmail.com>2023-02-20 02:28:15 +0200
committerRoy <Roy.mail.net@gmail.com>2023-02-20 02:28:15 +0200
commit795f3ab6ea36551281ec6442aa16b9547af96adc (patch)
tree4b1af0d700014054ff7d0ac01e381bbd25699e59 /Software/Visual_Studio/MachineStudio/Modules
parentba39c2e2a012953f2f9633fa7df59b49cf3fd4c7 (diff)
downloadTango-795f3ab6ea36551281ec6442aa16b9547af96adc.tar.gz
Tango-795f3ab6ea36551281ec6442aa16b9547af96adc.zip
Incorporated machine type into machine creation and management + job runs.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules')
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/ViewModels/MainViewVM.cs3
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Views/MainView.xaml12
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Models/MachineModel.cs3
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MachineCreationDialogVM.cs3
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs11
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineCreationDialog.xaml16
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachinesView.xaml3
7 files changed, 43 insertions, 8 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/ViewModels/MainViewVM.cs
index 47fe19a05..ab86d8356 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/ViewModels/MainViewVM.cs
@@ -19,6 +19,7 @@ using System.IO;
using Tango.BL.ActionLogs;
using Tango.MachineStudio.Common.Authentication;
using Tango.BL.DTO;
+using Tango.BL.Enumerations;
namespace Tango.MachineStudio.HardwareDesigner.ViewModels
{
@@ -445,6 +446,8 @@ namespace Tango.MachineStudio.HardwareDesigner.ViewModels
await Task.Factory.StartNew(() =>
{
CurrentVersion.LastUpdated = DateTime.UtcNow;
+ CurrentVersion.UserName = _authentication.CurrentUser.Email;
+
_db.SaveChanges();
var dtoAfter = HardwareVersionDTO.FromObservable(CurrentVersion);
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Views/MainView.xaml
index 9ee2ffee7..134d5d455 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Views/MainView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Views/MainView.xaml
@@ -14,13 +14,14 @@
xmlns:vm="clr-namespace:Tango.MachineStudio.HardwareDesigner.ViewModels"
xmlns:observables="clr-namespace:Tango.BL.Entities;assembly=Tango.BL"
xmlns:global="clr-namespace:Tango.MachineStudio.HardwareDesigner"
+ xmlns:enumerations="clr-namespace:Tango.BL.Enumerations;assembly=Tango.BL"
mc:Ignorable="d"
d:DesignHeight="2000" d:DesignWidth="1280" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}">
<UserControl.Resources>
<converters:DoubleToIntConverter x:Key="DoubleToIntConverter" />
<converters:NullObjectToBooleanConverter x:Key="NullObjectToBooleanConverter" />
-
+ <converters:EnumToItemsSourceConverter x:Key="EnumToItemsSourceConverter" />
<Style TargetType="ListBox" x:Key="typesList" BasedOn="{StaticResource {x:Type ListBox}}">
<Setter Property="FontSize" Value="14"></Setter>
<Setter Property="ItemContainerStyle">
@@ -58,10 +59,11 @@
<TextBlock FontSize="30" FontStyle="Italic" VerticalAlignment="Center" Margin="50 10 10 0" Foreground="Silver" FontWeight="Bold">HARDWARE DESIGNER</TextBlock>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="10 10 0 0">
<materialDesign:PackIcon Kind="Pencil" Width="32" Height="32" Foreground="Silver" />
- <controls:SearchComboBox IsEnabled="{Binding IsFree}" ItemsSource="{Binding HardwareVersions}" SelectedItem="{Binding SelectedVersion}" Width="300" SearchProperty="FullName" FontSize="16" FontWeight="Bold" Margin="5 0 0 0" materialDesign:HintAssist.Hint="Hardware Version">
+
+ <controls:SearchComboBox IsEnabled="{Binding IsFree}" ItemsSource="{Binding HardwareVersions}" SelectedItem="{Binding SelectedVersion}" Width="400" SearchProperty="FullName" FontSize="16" FontWeight="Bold" Margin="5 0 0 0" materialDesign:HintAssist.Hint="Hardware Version">
<ComboBox.ItemTemplate>
<DataTemplate>
- <TextBlock><Run Text="{Binding Name}"></Run> <Run></Run> <Run Foreground="{StaticResource MainWindow.Foreground}" FontSize="14">v</Run><Run Foreground="{StaticResource MainWindow.Foreground}" FontSize="14" Text="{Binding Version}"></Run></TextBlock>
+ <TextBlock><Run Text="{Binding Name}"></Run> <Run></Run> <Run Foreground="{StaticResource MainWindow.Foreground}" FontSize="14">v</Run><Run Foreground="{StaticResource MainWindow.Foreground}" FontSize="14" Text="{Binding Version}"></Run> <Run Foreground="{StaticResource AccentColorBrush}" FontSize="14" Text="{Binding ForMachineType}"></Run></TextBlock>
</DataTemplate>
</ComboBox.ItemTemplate>
</controls:SearchComboBox>
@@ -385,8 +387,12 @@
<TextBlock Margin="0 10 0 0" FontSize="10" Foreground="{StaticResource GrayBrush}">Name</TextBlock>
<TextBox Text="{Binding CurrentVersion.Name,UpdateSourceTrigger=PropertyChanged}"></TextBox>
+ <TextBlock Margin="0 20 0 0" FontSize="10" Foreground="{StaticResource GrayBrush}">Machine Type</TextBlock>
+ <ComboBox ItemsSource="{Binding Source={x:Type enumerations:MachineTypes},Converter={StaticResource EnumToItemsSourceConverter}}" SelectedValue="{Binding CurrentVersion.ForMachineType,Mode=TwoWay}" SelectedValuePath="Value" DisplayMemberPath="DisplayName"/>
+
<TextBlock Margin="0 20 0 0" FontSize="10" Foreground="{StaticResource GrayBrush}">Version</TextBlock>
<mahApps:NumericUpDown Minimum="0" BorderThickness="0 0 0 1" HorizontalContentAlignment="Left" Maximum="1000" HasDecimals="True" Value="{Binding CurrentVersion.Version}" Foreground="{StaticResource GrayBrush}"/>
+
</StackPanel>
</materialDesign:Card>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Models/MachineModel.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Models/MachineModel.cs
index 8a2f5dd9f..38430e197 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Models/MachineModel.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Models/MachineModel.cs
@@ -4,6 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tango.BL.Entities;
+using Tango.BL.Enumerations;
using Tango.Core;
namespace Tango.MachineStudio.MachineDesigner.Models
@@ -12,6 +13,8 @@ namespace Tango.MachineStudio.MachineDesigner.Models
{
public String Guid { get; set; }
+ public MachineTypes MachineType { get; set; }
+
public String SerialNumber { get; set; }
public String Name { get; set; }
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 168ff62dd..c7c7267a4 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
@@ -4,6 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tango.BL.Entities;
+using Tango.BL.Enumerations;
using Tango.SharedUI;
namespace Tango.MachineStudio.MachineDesigner.ViewModels
@@ -32,6 +33,8 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
set { _serialNumber = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); }
}
+ public MachineTypes MachineType { get; set; }
+
private String _name;
public String Name
{
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 c31ea0a53..855f063fc 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
@@ -540,6 +540,7 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
ActiveMachine.Configuration = new Configuration();
ActiveMachine.SerialNumber = machineCreationDialogVM.SerialNumber;
ActiveMachine.Name = machineCreationDialogVM.Name;
+ ActiveMachine.Type = machineCreationDialogVM.MachineType;
ActiveMachineAdapter.Context.Machines.Add(ActiveMachine);
}
else
@@ -713,6 +714,14 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
errors.Add("Hardware version is required.");
}
+ if (ActiveMachine.Configuration.HardwareVersion != null)
+ {
+ if (ActiveMachine.Configuration.HardwareVersion.ForMachineType != ActiveMachine.Type)
+ {
+ errors.Add($"Hardware version '{ActiveMachine.Configuration.HardwareVersion.Name}' is intended only for {ActiveMachine.Configuration.HardwareVersion.ForMachineType} machines.");
+ }
+ }
+
foreach (var pack in ActiveMachine.Configuration.IdsPacks)
{
if (pack.LiquidType != null || pack.CartridgeType != null || pack.Dispenser != null || pack.IdsPackFormula != null || pack.MidTankType != null)
@@ -1013,6 +1022,7 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
{
x.Guid,
x.SerialNumber,
+ x.MachineType,
x.Name,
Organization = x.Organization.Name,
MachineVersion = x.MachineVersion.Name,
@@ -1030,6 +1040,7 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
MachineModel model = new MachineModel();
model.Guid = machine.Guid;
model.SerialNumber = machine.SerialNumber;
+ model.MachineType = (MachineTypes)machine.MachineType;
model.Name = machine.Name;
model.Organization = machine.Organization;
model.HardwareVersion = machine.HardwareVersionName + " v" + machine.HardwareVersionVersion;
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 8b3851036..b1a393875 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
@@ -8,11 +8,14 @@
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"
+ xmlns:enumerations="clr-namespace:Tango.BL.Enumerations;assembly=Tango.BL"
mc:Ignorable="d"
d:DesignHeight="400" d:DesignWidth="700" Height="460" Width="750" Background="{StaticResource Dialog.Background}" d:DataContext="{d:DesignInstance Type=vm:MachineCreationDialogVM, IsDesignTimeCreatable=False}" Foreground="{StaticResource Dialog.Foreground}">
<UserControl.Resources>
<converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"></converters:BooleanToVisibilityConverter>
+ <converters:EnumToItemsSourceConverter x:Key="EnumToItemsSourceConverter" />
+ <converters:IsNullToVisibilityInverseConverter x:Key="IsNullToVisibilityInverseConverter" />
</UserControl.Resources>
<Grid Margin="10">
@@ -20,7 +23,7 @@
<Grid DockPanel.Dock="Top">
<StackPanel Orientation="Horizontal">
<Grid>
- <Image Source="../Images/machine-full-fx.png" Width="120" RenderOptions.BitmapScalingMode="Fant"></Image>
+ <Image Source="{StaticResource Machines}" 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">
@@ -52,11 +55,16 @@
<Grid>
<StackPanel HorizontalAlignment="Left" VerticalAlignment="Top" Margin="20 20 0 0" Width="400">
<TextBlock TextWrapping="Wrap" Visibility="{Binding IsNewMachine,Converter={StaticResource BooleanToVisibilityConverter}}">
- <Run>Specify a machine prototype to create the new machine with default settings and configuration.</Run>
+ <Run>Specify a machine prototype and machine type to create the new machine with default settings and configuration.</Run>
</TextBlock>
- <ComboBox Visibility="{Binding IsNewMachine,Converter={StaticResource BooleanToVisibilityConverter}}" ItemsSource="{Binding Prototypes}" SelectedItem="{Binding SelectedPrototype}" DisplayMemberPath="Name" Margin="0 10 0 0" FontSize="16" materialDesign:HintAssist.Hint="NONE"></ComboBox>
-
+ <DockPanel Visibility="{Binding IsNewMachine,Converter={StaticResource BooleanToVisibilityConverter}}" Margin="0 10 0 0">
+ <ComboBox x:Name="comboProto" Width="200" ItemsSource="{Binding Prototypes}" SelectedItem="{Binding SelectedPrototype}" DisplayMemberPath="Name" FontSize="16" materialDesign:HintAssist.Hint="NONE"></ComboBox>
+ <ComboBox Visibility="{Binding ElementName=comboProto,Path=SelectedItem,Converter={StaticResource IsNullToVisibilityInverseConverter}}" Margin="30 0 0 0" ItemsSource="{Binding Source={x:Type enumerations:MachineTypes},Converter={StaticResource EnumToItemsSourceConverter}}" FontSize="16" SelectedValue="{Binding MachineType,Mode=TwoWay}" SelectedValuePath="Value" DisplayMemberPath="DisplayName">
+
+ </ComboBox>
+ </DockPanel>
+
<TextBlock Margin="0 20 0 0" FontSize="10">Serial Number</TextBlock>
<TextBox Margin="0 2 0 0" Text="{Binding SerialNumber,UpdateSourceTrigger=PropertyChanged}"></TextBox>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachinesView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachinesView.xaml
index 5fda6dbfa..3c73ecc2b 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachinesView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachinesView.xaml
@@ -22,7 +22,7 @@
<DockPanel Margin="100" MaxWidth="1200">
<Grid DockPanel.Dock="Top">
<StackPanel Orientation="Horizontal">
- <Image Source="../Images/machine-full-fx.png" Width="350" RenderOptions.BitmapScalingMode="Fant" Margin="10" />
+ <Image Source="{StaticResource Machines}" Width="350" RenderOptions.BitmapScalingMode="Fant" Margin="10" />
<StackPanel Orientation="Horizontal" VerticalAlignment="Bottom" Margin="0 0 0 10">
<materialDesign:PackIcon VerticalAlignment="Center" Kind="BarcodeScan" Width="32" Height="32" />
@@ -70,6 +70,7 @@
</Style>
</DataGrid.CellStyle>
<DataGrid.Columns>
+ <DataGridTextColumn Header="TYPE" Binding="{Binding MachineType}" Width="Auto" />
<DataGridTextColumn Header="SERIAL NUMBER" Binding="{Binding SerialNumber}" Width="Auto" />
<DataGridTextColumn Header="NAME" Binding="{Binding Name}" Width="Auto" />
<DataGridTextColumn Header="ORGANIZATION" Binding="{Binding Organization}" Width="Auto" />