aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-12-30 15:23:34 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-12-30 15:23:34 +0200
commit721e03d7e6926055111d4edbbdf5f700a11ed58a (patch)
tree8721b9b55923f3b9c23fbab5b22a770f5d169a01 /Software/Visual_Studio/MachineStudio/Modules
parentcc3480d4aac4175b1072060dd2d6d398d3451ae8 (diff)
downloadTango-721e03d7e6926055111d4edbbdf5f700a11ed58a.tar.gz
Tango-721e03d7e6926055111d4edbbdf5f700a11ed58a.zip
Working on new Machine Designer.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules')
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/ConfigurationsViewVM.cs1
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Tango.MachineStudio.MachineDesigner.csproj9
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs546
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/ConfigurationView.xaml55
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineDetailsView.xaml43
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineSettingsView.xaml99
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineSettingsView.xaml.cs28
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineView.xaml19
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachinesView.xaml7
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MainView.xaml3
10 files changed, 425 insertions, 385 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/ConfigurationsViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/ConfigurationsViewVM.cs
index 18c8c3daa..d5022c761 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/ConfigurationsViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/ConfigurationsViewVM.cs
@@ -18,7 +18,6 @@ namespace Tango.MachineStudio.DB.ViewModels
protected override void InitializeEntity(Configuration entity)
{
base.InitializeEntity(entity);
- entity.CreationDate = DateTime.UtcNow;
}
}
}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Tango.MachineStudio.MachineDesigner.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Tango.MachineStudio.MachineDesigner.csproj
index 8ced2e510..a55d7e696 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Tango.MachineStudio.MachineDesigner.csproj
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Tango.MachineStudio.MachineDesigner.csproj
@@ -83,6 +83,9 @@
<Compile Include="Views\MachineDetailsView.xaml.cs">
<DependentUpon>MachineDetailsView.xaml</DependentUpon>
</Compile>
+ <Compile Include="Views\MachineSettingsView.xaml.cs">
+ <DependentUpon>MachineSettingsView.xaml</DependentUpon>
+ </Compile>
<Compile Include="Views\MachinesView.xaml.cs">
<DependentUpon>MachinesView.xaml</DependentUpon>
</Compile>
@@ -103,6 +106,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
+ <Page Include="Views\MachineSettingsView.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ </Page>
<Page Include="Views\MachinesView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@@ -254,7 +261,7 @@
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<ProjectExtensions>
<VisualStudio>
- <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" />
+ <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" />
</VisualStudio>
</ProjectExtensions>
</Project> \ No newline at end of file
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 e2924a185..b0b97d7d4 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
@@ -26,30 +26,21 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
public class MainViewVM : StudioViewModel<IMainView>
{
private INotificationProvider _notification;
- private ObservablesContext _dbContext;
- private ObservablesContext _machineContext;
- private ObservablesContext _configContext;
#region Properties
- private ObservableCollection<Machine> _machines;
- /// <summary>
- /// Gets or sets the machines.
- /// </summary>
- public ObservableCollection<Machine> Machines
+ private ObservablesStaticCollections _machinesAdapter;
+ public ObservablesStaticCollections MachinesAdapter
{
- get { return _machines; }
- set { _machines = value; RaisePropertyChangedAuto(); }
+ get { return _machinesAdapter; }
+ set { _machinesAdapter = value; RaisePropertyChangedAuto(); }
}
- private ObservableCollection<Dispenser> _dispensers;
- /// <summary>
- /// Gets or sets the dispensers.
- /// </summary>
- public ObservableCollection<Dispenser> Dispensers
+ private ObservablesStaticCollections _activeMachineAdapter;
+ public ObservablesStaticCollections ActiveMachineAdapter
{
- get { return _dispensers; }
- set { _dispensers = value; RaisePropertyChangedAuto(); }
+ get { return _activeMachineAdapter; }
+ set { _activeMachineAdapter = value; RaisePropertyChangedAuto(); }
}
private Machine _selectedMachine;
@@ -80,17 +71,6 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
set { _activeMachine = value; RaisePropertyChangedAuto(); }
}
-
- private Configuration _configuration;
- /// <summary>
- /// Gets or sets the editable machine configuration.
- /// </summary>
- public Configuration Configuration
- {
- get { return _configuration; }
- set { _configuration = value; RaisePropertyChangedAuto(); }
- }
-
private IdsPack _selectedIds;
/// <summary>
/// Gets or sets the selected ids pack.
@@ -155,6 +135,11 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
/// </summary>
public RelayCommand EditMachineCommand { get; set; }
+ /// <summary>
+ /// Gets or sets the back to machines command.
+ /// </summary>
+ public RelayCommand BackToMachinesCommand { get; set; }
+
#endregion
#region Constructors
@@ -169,32 +154,17 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
/// </summary>
public MainViewVM(INotificationProvider notification)
{
- _dbContext = ObservablesContext.CreateDefault();
+ MachinesAdapter = new ObservablesStaticCollections(ObservablesContext.CreateDefault());
_notification = notification;
//SaveCommand = new RelayCommand(Save);
- AddIdsCommand = new RelayCommand(AddIds, (x) => Configuration != null && Configuration.IdsPacks.Count < 8);
+ AddIdsCommand = new RelayCommand(AddIds, (x) => ActiveMachine != null && ActiveMachine.Configuration != null && ActiveMachine.Configuration.IdsPacks.Count < 8);
RemoveIdsCommand = new RelayCommand(RemoveIds, (x) => SelectedIds != null);
- EditMachineCommand = new RelayCommand(EditSelectedMachine, () => SelectedMachine != null);
- }
-
- private async void EditSelectedMachine()
- {
- using (_notification.PushTaskItem("Loading machine details..."))
- {
- IsFree = false;
-
- if (_machineContext != null)
- {
- _machineContext.Dispose();
- }
-
- _machineContext = ObservablesContext.CreateDefault();
- ActiveMachine = (await new MachineBuilder(_machineContext).Set(SelectedMachine).WithOrganization().WithConfiguration().BuildAsync());
- View.NavigateTo(MachineDesignerNavigationView.MachineDetailsView);
-
- IsFree = true;
- }
+ EditMachineCommand = new RelayCommand(() => LoadSelectedMachine(), () => SelectedMachine != null);
+ BackToMachinesCommand = new RelayCommand(() => View.NavigateTo(MachineDesignerNavigationView.MachinesView));
+ SaveCommand = new RelayCommand(SaveMachine);
+ AddMachineCommand = new RelayCommand(AddNewMachine);
+ RemoveMachineCommand = new RelayCommand(RemoveSelectedMachine,() => SelectedMachine != null);
}
#endregion
@@ -208,59 +178,16 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
#endregion
- //private Task InitCollections()
- //{
- // return Task.Factory.StartNew(() =>
- // {
- // CanWork = false;
-
- // _dbContext = ObservablesContext.CreateDefault();
-
- // Adapter = new ObservablesStaticCollections();
- // Adapter.ApplicationDisplayPanelVersions = _dbContext.ApplicationDisplayPanelVersions.ToObservableCollection();
- // Adapter.ApplicationFirmwareVersions = _dbContext.ApplicationFirmwareVersions.ToObservableCollection();
- // Adapter.ApplicationOsVersions = _dbContext.ApplicationOsVersions.ToObservableCollection();
- // Adapter.EmbeddedFirmwareVersions = _dbContext.EmbeddedFirmwareVersions.ToObservableCollection();
- // Adapter.DispenserTypes = _dbContext.DispenserTypes.ToObservableCollection();
- // Adapter.LiquidTypes = _dbContext.LiquidTypes.ToObservableCollection();
- // Adapter.MidTankTypes = _dbContext.MidTankTypes.ToObservableCollection();
- // Adapter.CartridgeTypes = _dbContext.CartridgeTypes.ToObservableCollection();
- // Adapter.IdsPackFormulas = _dbContext.IdsPackFormulas.ToObservableCollection();
- // Adapter.HardwareVersions = _dbContext.HardwareVersions.ToObservableCollection();
- // Adapter.MachineVersions = _dbContext.MachineVersions.ToObservableCollection();
- // Adapter.Organizations = _dbContext.Organizations.ToObservableCollection();
-
- // Adapter.InitCollectionSources();
-
- // CanWork = true;
- // });
- //}
-
- private void Reset()
- {
- //using (_notification.PushTaskItem("Resetting designer..."))
- //{
- // SelectedMachine = null;
- // Machine = new Machine();
- // Configuration = new Configuration();
- // InitCollections();
- //}
- }
-
private async void OnDispensersFilterChanged()
{
if (!String.IsNullOrWhiteSpace(DispensersFilter))
{
IsFree = false;
- Dispensers = (await _configContext.Dispensers.Where(x => x.SerialNumber.ToLower().StartsWith(DispensersFilter.ToLower())).ToListAsync()).ToObservableCollection();
+ ActiveMachineAdapter.Dispensers = (await ActiveMachineAdapter.Context.Dispensers.Where(x => x.SerialNumber.ToLower().StartsWith(DispensersFilter.ToLower())).ToListAsync()).ToObservableCollection();
IsFree = true;
}
}
- #region Virtual Methods
-
- #endregion
-
#region Drag Drop Handlers
/// <summary>
@@ -270,7 +197,7 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
/// <param name="idsPack2">The ids pack2.</param>
public void DropIdsPack(IdsPack idsPack1, IdsPack idsPack2)
{
- Configuration.IdsPacks.Swap(idsPack1, idsPack2);
+ ActiveMachine.Configuration.IdsPacks.Swap(idsPack1, idsPack2);
}
/// <summary>
@@ -279,8 +206,8 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
/// <param name="applicationDisplayPanelVersion">The application display panel version.</param>
public void DropTouchPanel(ApplicationDisplayPanelVersion applicationDisplayPanelVersion)
{
- Configuration.ApplicationDisplayPanelVersion = applicationDisplayPanelVersion;
- Configuration.ApplicationDisplayPanelVersionGuid = applicationDisplayPanelVersion.Guid;
+ ActiveMachine.Configuration.ApplicationDisplayPanelVersion = applicationDisplayPanelVersion;
+ ActiveMachine.Configuration.ApplicationDisplayPanelVersionGuid = applicationDisplayPanelVersion.Guid;
}
/// <summary>
@@ -289,8 +216,8 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
/// <param name="applicationFirmwareVersion">The application firmware version.</param>
public void DropApplicationFirmwareVersion(ApplicationFirmwareVersion applicationFirmwareVersion)
{
- Configuration.ApplicationFirmwareVersion = applicationFirmwareVersion;
- Configuration.ApplicationFirmwareVersionGuid = applicationFirmwareVersion.Guid;
+ ActiveMachine.Configuration.ApplicationFirmwareVersion = applicationFirmwareVersion;
+ ActiveMachine.Configuration.ApplicationFirmwareVersionGuid = applicationFirmwareVersion.Guid;
}
/// <summary>
@@ -299,8 +226,8 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
/// <param name="hardwareVersion">The hardware version.</param>
public void DropHardwareVersion(HardwareVersion hardwareVersion)
{
- Configuration.HardwareVersion = hardwareVersion;
- Configuration.HardwareVersionGuid = hardwareVersion.Guid;
+ ActiveMachine.Configuration.HardwareVersion = hardwareVersion;
+ ActiveMachine.Configuration.HardwareVersionGuid = hardwareVersion.Guid;
}
/// <summary>
@@ -309,8 +236,8 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
/// <param name="embeddedFirmwareVersion">The embedded firmware version.</param>
public void DropEmbeddedFirmware(EmbeddedFirmwareVersion embeddedFirmwareVersion)
{
- Configuration.EmbeddedFirmwareVersion = embeddedFirmwareVersion;
- Configuration.EmbeddedFirmwareVersionGuid = embeddedFirmwareVersion.Guid;
+ ActiveMachine.Configuration.EmbeddedFirmwareVersion = embeddedFirmwareVersion;
+ ActiveMachine.Configuration.EmbeddedFirmwareVersionGuid = embeddedFirmwareVersion.Guid;
}
/// <summary>
@@ -319,8 +246,8 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
/// <param name="applicationOsVersion">The application os version.</param>
public void DropApplicationOsVersion(ApplicationOsVersion applicationOsVersion)
{
- Configuration.ApplicationOsVersion = applicationOsVersion;
- Configuration.ApplicationOsVersionGuid = applicationOsVersion.Guid;
+ ActiveMachine.Configuration.ApplicationOsVersion = applicationOsVersion;
+ ActiveMachine.Configuration.ApplicationOsVersionGuid = applicationOsVersion.Guid;
}
/// <summary>
@@ -388,7 +315,7 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
/// </summary>
private void RemoveIds()
{
- _dbContext.IdsPacks.Remove(SelectedIds);
+ ActiveMachineAdapter.Context.IdsPacks.Remove(SelectedIds);
SelectedIds = null;
}
@@ -397,249 +324,242 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
/// </summary>
private void AddIds()
{
- _dbContext.IdsPacks.Add(new IdsPack() { Configuration = Configuration });
+ ActiveMachineAdapter.Context.IdsPacks.Add(new IdsPack() { Configuration = ActiveMachine.Configuration });
InvalidateRelayCommands();
}
- ///// <summary>
- ///// Saves the current machine configuration.
- ///// </summary>
- //private async void Save()
- //{
- // foreach (var ids in Configuration.IdsPacks)
- // {
- // ids.PackIndex = Configuration.IdsPacks.IndexOf(ids);
- // ids.Configuration = Configuration;
- // ids.ConfigurationGuid = Configuration.Guid;
- // }
-
- // //Validate
-
- // List<String> errors = new List<string>();
-
- // if (Machine.MachineVersion == null)
- // {
- // errors.Add("Machine version is required.");
- // }
-
- // if (Machine.Name.IsNullOrWhiteSpace())
- // {
- // errors.Add("Machine name is required.");
- // }
-
- // if (Machine.Organization == null)
- // {
- // errors.Add("Machine organization is required.");
- // }
-
- // if (Machine.SerialNumber.IsNullOrWhiteSpace())
- // {
- // errors.Add("Machine serial number is required.");
- // }
-
- // if (Configuration.Name.IsNullOrWhiteSpace())
- // {
- // errors.Add("Configuration name is required.");
- // }
+ private async void LoadSelectedMachine(bool newMachine = false)
+ {
+ using (_notification.PushTaskItem("Loading machine details..."))
+ {
+ try
+ {
+ IsFree = false;
- // if (Configuration.ApplicationDisplayPanelVersion == null)
- // {
- // errors.Add("Touch Panel is required.");
- // }
+ if (ActiveMachineAdapter != null)
+ {
+ ActiveMachineAdapter.Context.Dispose();
+ }
- // if (Configuration.ApplicationFirmwareVersion == null)
- // {
- // errors.Add("Application firmware is required.");
- // }
+ ActiveMachineAdapter = new ObservablesStaticCollections(ObservablesContext.CreateDefault());
+ ActiveMachineAdapter.Organizations = (await ActiveMachineAdapter.Context.Organizations.ToListAsync()).ToObservableCollection();
+ ActiveMachineAdapter.MachineVersions = (await ActiveMachineAdapter.Context.MachineVersions.ToListAsync()).ToObservableCollection();
+ ActiveMachineAdapter.Rmls = (await ActiveMachineAdapter.Context.Rmls.ToListAsync()).ToObservableCollection();
+ ActiveMachineAdapter.ColorSpaces = (await ActiveMachineAdapter.Context.ColorSpaces.ToListAsync()).ToObservableCollection();
+ ActiveMachineAdapter.SpoolTypes = (await ActiveMachineAdapter.Context.SpoolTypes.ToListAsync()).ToObservableCollection();
- // if (Configuration.ApplicationOsVersion == null)
- // {
- // errors.Add("Application operation system is required.");
- // }
+ ActiveMachineAdapter.ApplicationDisplayPanelVersions = (await ActiveMachineAdapter.Context.ApplicationDisplayPanelVersions.ToListAsync()).ToObservableCollection();
+ ActiveMachineAdapter.ApplicationFirmwareVersions = (await ActiveMachineAdapter.Context.ApplicationFirmwareVersions.ToListAsync()).ToObservableCollection();
+ ActiveMachineAdapter.ApplicationOsVersions = (await ActiveMachineAdapter.Context.ApplicationOsVersions.ToListAsync()).ToObservableCollection();
+ ActiveMachineAdapter.EmbeddedFirmwareVersions = (await ActiveMachineAdapter.Context.EmbeddedFirmwareVersions.ToListAsync()).ToObservableCollection();
+ ActiveMachineAdapter.DispenserTypes = (await ActiveMachineAdapter.Context.DispenserTypes.ToListAsync()).ToObservableCollection();
+ ActiveMachineAdapter.LiquidTypes = (await ActiveMachineAdapter.Context.LiquidTypes.ToListAsync()).ToObservableCollection();
+ ActiveMachineAdapter.MidTankTypes = (await ActiveMachineAdapter.Context.MidTankTypes.ToListAsync()).ToObservableCollection();
+ ActiveMachineAdapter.CartridgeTypes = (await ActiveMachineAdapter.Context.CartridgeTypes.ToListAsync()).ToObservableCollection();
+ ActiveMachineAdapter.IdsPackFormulas = (await ActiveMachineAdapter.Context.IdsPackFormulas.ToListAsync()).ToObservableCollection();
+ ActiveMachineAdapter.HardwareVersions = (await ActiveMachineAdapter.Context.HardwareVersions.ToListAsync()).ToObservableCollection();
+ ActiveMachineAdapter.MachineVersions = (await ActiveMachineAdapter.Context.MachineVersions.ToListAsync()).ToObservableCollection();
+ ActiveMachineAdapter.Organizations = (await ActiveMachineAdapter.Context.Organizations.ToListAsync()).ToObservableCollection();
- // if (Configuration.EmbeddedFirmwareVersion == null)
- // {
- // errors.Add("Embedded firmware is required.");
- // }
+ if (!newMachine)
+ {
+ ActiveMachine = (await new MachineBuilder(ActiveMachineAdapter.Context).Set(SelectedMachine.Guid).WithOrganization().WithConfiguration().WithSpools().BuildAsync());
+ }
+ else
+ {
+ ActiveMachine = new Machine();
+ ActiveMachine.Configuration = new Configuration();
+ ActiveMachineAdapter.Context.Machines.Add(ActiveMachine);
+ }
- // if (Configuration.HardwareVersion == null)
- // {
- // errors.Add("Hardware version is required.");
- // }
+ View.NavigateTo(MachineDesignerNavigationView.MachineDetailsView);
+ }
+ catch (Exception ex)
+ {
+ LogManager.Log(ex, $"Error loading machine details for serial number {SelectedMachine.SerialNumber}");
+ _notification.ShowError($"An error occurred while trying to load the selected machine details.\n{ex.Message}");
+ }
+ finally
+ {
+ IsFree = true;
+ InvalidateRelayCommands();
+ }
+ }
+ }
- // foreach (var pack in Configuration.IdsPacks)
- // {
- // if (pack.LiquidType != null || pack.CartridgeType != null || pack.Dispenser != null || pack.IdsPackFormula != null || pack.MidTankType != null)
- // {
- // if (pack.CartridgeType == null)
- // {
- // errors.Add(String.Format("Cartridge type is required on IDS pack '{0}'.", pack.PackIndex));
- // }
- // if (pack.Dispenser == null)
- // {
- // errors.Add(String.Format("Dispenser is required on IDS pack '{0}'.", pack.PackIndex));
- // }
- // if (pack.LiquidType == null)
- // {
- // errors.Add(String.Format("Liquid type is required on IDS pack '{0}'.", pack.PackIndex));
- // }
- // if (pack.MidTankType == null)
- // {
- // errors.Add(String.Format("Mid Tank type is required on IDS pack '{0}'.", pack.PackIndex));
- // }
- // if (pack.IdsPackFormula == null)
- // {
- // errors.Add(String.Format("Formula type is required on IDS pack '{0}'.", pack.PackIndex));
- // }
+ private async void SaveMachine()
+ {
+ foreach (var ids in ActiveMachine.Configuration.IdsPacks)
+ {
+ ids.PackIndex = ActiveMachine.Configuration.IdsPacks.IndexOf(ids);
+ ids.Configuration = ActiveMachine.Configuration;
+ ids.ConfigurationGuid = ActiveMachine.Configuration.Guid;
+ }
- // pack.IsEmpty = false;
- // }
- // else
- // {
- // pack.IsEmpty = true;
- // }
- // }
+ List<String> errors = new List<string>();
- // if (errors.Count > 0)
- // {
- // String errorsString = "Please fix the following validation errors before trying to save." + Environment.NewLine + Environment.NewLine;
- // errorsString += String.Join(Environment.NewLine, errors);
- // _notification.ShowError(errorsString);
- // return;
- // }
+ if (ActiveMachine.MachineVersion == null)
+ {
+ errors.Add("Machine version is required.");
+ }
- // //Validate
+ if (ActiveMachine.Name.IsNullOrWhiteSpace())
+ {
+ errors.Add("Machine name is required.");
+ }
- // try
- // {
- // CanWork = false;
+ if (ActiveMachine.Organization == null)
+ {
+ errors.Add("Machine organization is required.");
+ }
- // using (_notification.PushTaskItem("Saving Machine Configuration..."))
- // {
- // if (!_dbContext.Machines.Any(x => x.SerialNumber.ToLower() == Machine.SerialNumber.ToLower()))
- // {
- // if (!_notification.ShowQuestion("The specified machine serial number does not exist. Do you wish to create a new machine?"))
- // {
- // CanWork = true;
- // return;
- // }
- // else
- // {
- // Machine.Configuration = Configuration;
- // Configuration.CreationDate = DateTime.UtcNow;
- // Machine.ProductionDate = DateTime.UtcNow;
+ if (ActiveMachine.SerialNumber.IsNullOrWhiteSpace())
+ {
+ errors.Add("Machine serial number is required.");
+ }
- // _dbContext.Machines.Add(Machine);
- // }
- // }
+ if (ActiveMachine.Configuration.ApplicationDisplayPanelVersion == null)
+ {
+ errors.Add("Touch Panel is required.");
+ }
- // await _dbContext.SaveChangesAsync();
- // OnSelectedMachineChanged();
+ if (ActiveMachine.Configuration.ApplicationFirmwareVersion == null)
+ {
+ errors.Add("Application firmware is required.");
+ }
- // }
- // }
- // catch (Exception ex)
- // {
- // _notification.ShowError("An error occurred while trying to save the configuration" + Environment.NewLine + ex.Message);
- // }
- // finally
- // {
- // CanWork = true;
- // InvalidateRelayCommands();
- // }
- //}
+ if (ActiveMachine.Configuration.ApplicationOsVersion == null)
+ {
+ errors.Add("Application operation system is required.");
+ }
- ///// <summary>
- ///// Sets the current configuration to the selected machine version default configuration.
- ///// </summary>
- //private async void SetVersionConfiguration()
- //{
- // if (Machine.MachineVersion != null)
- // {
- // using (_notification.PushTaskItem("Applying default configuration..."))
- // {
- // CanWork = false;
+ if (ActiveMachine.Configuration.EmbeddedFirmwareVersion == null)
+ {
+ errors.Add("Embedded firmware is required.");
+ }
- // await Task.Factory.StartNew(() =>
- // {
- // var version = _dbContext.MachineVersions.Where(x => x.Guid == Machine.MachineVersion.Guid).Include(x => x.DefaultConfiguration).FirstOrDefault();
- // var version_config = _dbContext.Adapter.GetConfiguration(x => x.Guid == version.DefaultConfiguration.Guid);
- // Configuration = version_config.Clone();
- // Machine.Configuration = Configuration;
- // });
+ if (ActiveMachine.Configuration.HardwareVersion == null)
+ {
+ errors.Add("Hardware version is required.");
+ }
- // CanWork = true;
- // }
- // }
- // else
- // {
- // _notification.ShowError("No machine version selected.");
- // }
- //}
+ foreach (var pack in ActiveMachine.Configuration.IdsPacks)
+ {
+ if (pack.LiquidType != null || pack.CartridgeType != null || pack.Dispenser != null || pack.IdsPackFormula != null || pack.MidTankType != null)
+ {
+ if (pack.CartridgeType == null)
+ {
+ errors.Add(String.Format("Cartridge type is required on IDS pack '{0}'.", pack.PackIndex));
+ }
+ if (pack.Dispenser == null)
+ {
+ errors.Add(String.Format("Dispenser is required on IDS pack '{0}'.", pack.PackIndex));
+ }
+ if (pack.LiquidType == null)
+ {
+ errors.Add(String.Format("Liquid type is required on IDS pack '{0}'.", pack.PackIndex));
+ }
+ if (pack.MidTankType == null)
+ {
+ errors.Add(String.Format("Mid Tank type is required on IDS pack '{0}'.", pack.PackIndex));
+ }
+ if (pack.IdsPackFormula == null)
+ {
+ errors.Add(String.Format("Formula type is required on IDS pack '{0}'.", pack.PackIndex));
+ }
- ///// <summary>
- ///// Sets the current configuration as a default machine version configuration.
- ///// </summary>
- //private void SetAsDefaultConfiguration()
- //{
- // _notification.ShowModalDialog<MachineVersionDialogVM>(async (vm) =>
- // {
- // CanWork = false;
+ pack.IsEmpty = false;
+ }
+ else
+ {
+ pack.IsEmpty = true;
+ }
+ }
- // try
- // {
- // using (_notification.PushTaskItem("Saving Default Configuration..."))
- // {
- // if (vm.SelectedVersion != null)
- // {
- // var version = _dbContext.MachineVersions.Where(x => x.Guid == vm.SelectedVersion.Guid).Include(x => x.DefaultConfiguration).SingleOrDefault(x => x.Guid == vm.SelectedVersion.Guid);
+ foreach (var pack in ActiveMachine.Configuration.IdsPacks.Where(x => x.Dispenser != null))
+ {
+ if (ActiveMachine.Configuration.IdsPacks.Where(x => x.Dispenser == pack.Dispenser).Count() > 1)
+ {
+ errors.Add($"Dispenser '{pack.Dispenser.SerialNumber}' is installed on multiple IDS packs.");
+ }
- // _dbContext.Configurations.Remove(version.DefaultConfiguration);
+ if (ActiveMachineAdapter.Context.IdsPacks.Count(x => x.ConfigurationGuid != pack.ConfigurationGuid && x.DispenserGuid == pack.DispenserGuid) > 0)
+ {
+ errors.Add($"Dispenser '{pack.Dispenser.SerialNumber}' is already installed on a different machine.");
+ }
+ }
- // var cloned = Configuration.Clone();
- // _dbContext.Configurations.Add(cloned);
- // version.DefaultConfiguration = cloned;
+ if (errors.Count > 0)
+ {
+ String errorsString = "Please fix the following validation errors before trying to save." + Environment.NewLine + Environment.NewLine;
+ errorsString += String.Join(Environment.NewLine, errors.Distinct());
+ _notification.ShowError(errorsString);
+ return;
+ }
- // await _dbContext.SaveChangesAsync();
- // }
- // else
- // {
- // MachineVersion newVersion = new MachineVersion();
- // newVersion.Version = vm.Version;
- // newVersion.Name = vm.VersionName;
+ try
+ {
+ IsFree = false;
- // var cloned = Configuration.Clone();
+ using (_notification.PushTaskItem("Saving Machine Details..."))
+ {
- // _dbContext.Configurations.Add(cloned);
- // newVersion.DefaultConfiguration = cloned;
- // _dbContext.MachineVersions.Add(newVersion);
- // await _dbContext.SaveChangesAsync();
- // }
- // }
- // }
- // catch (Exception ex)
- // {
- // _notification.ShowError(ex.Message);
- // }
- // finally
- // {
- // CanWork = true;
- // }
+ ActiveMachine.ConfigurationGuid = ActiveMachine.Configuration.Guid;
+ ActiveMachine.LastUpdated = DateTime.UtcNow;
+ ActiveMachine.ProductionDate = DateTime.UtcNow;
+ await ActiveMachineAdapter.Context.SaveChangesAsync();
+ }
+ }
+ catch (Exception ex)
+ {
+ LogManager.Log(ex, "Error saving machine details.");
+ _notification.ShowError("An error occurred while trying to save the machine details" + Environment.NewLine + ex.Message);
+ }
+ finally
+ {
+ IsFree = true;
+ InvalidateRelayCommands();
+ }
+ }
- // }, () =>
- // {
+ private void AddNewMachine()
+ {
+ LoadSelectedMachine(true);
+ }
- // });
- //}
+ private async void RemoveSelectedMachine()
+ {
+ if (_notification.ShowQuestion("Are you sure you want to delete the selected machine?"))
+ {
+ using (_notification.PushTaskItem("Removing machine..."))
+ {
+ try
+ {
+ IsFree = false;
+ await SelectedMachine.DeleteCascadeAsync(MachinesAdapter.Context);
+ MachinesAdapter.Context.Machines.Remove(SelectedMachine);
+ }
+ catch (Exception ex)
+ {
+ LogManager.Log(ex, $"Error removing machine {SelectedMachine.SerialNumber}.");
+ _notification.ShowError($"An error occurred while trying to delete the selected machine.\n{ex.Message}");
+ }
+ finally
+ {
+ IsFree = true;
+ }
+ }
+ }
+ }
#endregion
private async void OnFilterChanged()
{
- if (!String.IsNullOrWhiteSpace(Filter))
+ if (Filter != null)
{
IsFree = false;
- Machines = (await _dbContext.Machines.Where(x => x.SerialNumber.StartsWith(Filter)).ToListAsync()).ToObservableCollection();
+ MachinesAdapter.Machines = (await MachinesAdapter.Context.Machines.Where(x => x.SerialNumber.StartsWith(Filter)).Include(x => x.Organization).Include(x => x.MachineVersion).ToListAsync()).ToObservableCollection();
IsFree = true;
}
}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/ConfigurationView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/ConfigurationView.xaml
index a96cd4685..97eceaa7d 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/ConfigurationView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/ConfigurationView.xaml
@@ -102,8 +102,8 @@
<StackPanel Orientation="Horizontal">
<Image Source="../Images/hardware.png" Width="10" VerticalAlignment="Center" Margin="5" RenderOptions.BitmapScalingMode="Fant"></Image>
<TextBlock Padding="2 0 2 0" VerticalAlignment="Center" TextAlignment="Center" Foreground="Gainsboro" IsHitTestVisible="False" FontSize="6" TextWrapping="Wrap">
- <Run Text="{Binding Configuration.HardwareVersion.Name}"></Run>
- <Run Text="{Binding Configuration.HardwareVersion.Version}"></Run>
+ <Run Text="{Binding ActiveMachine.Configuration.HardwareVersion.Name}"></Run>
+ <Run Text="{Binding ActiveMachine.Configuration.HardwareVersion.Version}"></Run>
</TextBlock>
</StackPanel>
</Border>
@@ -145,7 +145,7 @@
<TextBlock HorizontalAlignment="Center">8</TextBlock>
</UniformGrid>
<Grid x:Name="gridIds" Width="310" Height="195" Canvas.Top="314" Canvas.Left="420">
- <ListBox ItemsSource="{Binding Configuration.IdsPacks}" SelectedItem="{Binding SelectedIds}" ScrollViewer.VerticalScrollBarVisibility="Disabled" ScrollViewer.HorizontalScrollBarVisibility="Disabled">
+ <ListBox ItemsSource="{Binding ActiveMachine.Configuration.IdsPacks}" SelectedItem="{Binding SelectedIds}" ScrollViewer.VerticalScrollBarVisibility="Disabled" ScrollViewer.HorizontalScrollBarVisibility="Disabled">
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem" BasedOn="{StaticResource {x:Type ListBoxItem}}">
<Setter Property="Padding" Value="0"></Setter>
@@ -261,7 +261,7 @@
<Style TargetType="Grid">
<Setter Property="Visibility" Value="Hidden"></Setter>
<Style.Triggers>
- <DataTrigger Binding="{Binding Configuration.IdsPacks.Count}" Value="0">
+ <DataTrigger Binding="{Binding ActiveMachine.Configuration.IdsPacks.Count}" Value="0">
<Setter Property="Visibility" Value="Visible"></Setter>
</DataTrigger>
</Style.Triggers>
@@ -284,7 +284,7 @@
<Grid Width="61" IsHitTestVisible="True" SnapsToDevicePixels="True" ClipToBounds="True" Height="42" Canvas.Left="85" Canvas.Top="385">
<StackPanel Orientation="Horizontal">
<Image Source="../Images/embedded.png" Width="10" VerticalAlignment="Center" Margin="1" RenderOptions.BitmapScalingMode="Fant"></Image>
- <TextBlock VerticalAlignment="Center" Padding="1" Foreground="Gainsboro" IsHitTestVisible="False" FontSize="5" TextAlignment="Center" TextWrapping="Wrap" Height="15" Margin="0,6,0,0" Width="47"><Run Text="{Binding Configuration.EmbeddedFirmwareVersion.Name}"/><Run Text=" "/><Run Text="{Binding Configuration.EmbeddedFirmwareVersion.Version}"/></TextBlock>
+ <TextBlock VerticalAlignment="Center" Padding="1" Foreground="Gainsboro" IsHitTestVisible="False" FontSize="5" TextAlignment="Center" TextWrapping="Wrap" Height="15" Margin="0,6,0,0" Width="47"><Run Text="{Binding ActiveMachine.Configuration.EmbeddedFirmwareVersion.Name}"/><Run Text=" "/><Run Text="{Binding ActiveMachine.Configuration.EmbeddedFirmwareVersion.Version}"/></TextBlock>
</StackPanel>
</Grid>
@@ -338,8 +338,8 @@
<StackPanel>
<Image Source="../Images/tablet.png" Width="10" Margin="2" RenderOptions.BitmapScalingMode="Fant"></Image>
<TextBlock Padding="2 0 2 0" Foreground="Gainsboro" IsHitTestVisible="False" FontSize="6" TextAlignment="Center" TextWrapping="Wrap">
- <Run Text="{Binding Configuration.ApplicationDisplayPanelVersion.Name}"></Run>
- <Run Text="{Binding Configuration.ApplicationDisplayPanelVersion.Version}"></Run>
+ <Run Text="{Binding ActiveMachine.Configuration.ApplicationDisplayPanelVersion.Name}"></Run>
+ <Run Text="{Binding ActiveMachine.Configuration.ApplicationDisplayPanelVersion.Version}"></Run>
</TextBlock>
</StackPanel>
@@ -347,16 +347,16 @@
<StackPanel Grid.Row="1" >
<Image Source="../Images/application-firmware.png" Width="10" Margin="2" RenderOptions.BitmapScalingMode="Fant"></Image>
<TextBlock Padding="2 0 2 0" IsHitTestVisible="False" Foreground="Gainsboro" FontSize="6" TextAlignment="Center" TextWrapping="Wrap">
- <Run Text="{Binding Configuration.ApplicationFirmwareVersion.Name}"></Run>
- <Run Text="{Binding Configuration.ApplicationFirmwareVersion.Version}"></Run>
+ <Run Text="{Binding ActiveMachine.Configuration.ApplicationFirmwareVersion.Name}"></Run>
+ <Run Text="{Binding ActiveMachine.Configuration.ApplicationFirmwareVersion.Version}"></Run>
</TextBlock>
</StackPanel>
<StackPanel Grid.Row="2" >
<Image Source="../Images/android.png" Width="10" Margin="2" RenderOptions.BitmapScalingMode="Fant"></Image>
<TextBlock Padding="2 0 2 0" IsHitTestVisible="False" Foreground="Gainsboro" FontSize="6" TextAlignment="Center" TextWrapping="Wrap">
- <Run Text="{Binding Configuration.ApplicationOsVersion.Name}"></Run>
- <Run Text="{Binding Configuration.ApplicationOsVersion.Version}"></Run>
+ <Run Text="{Binding ActiveMachine.Configuration.ApplicationOsVersion.Name}"></Run>
+ <Run Text="{Binding ActiveMachine.Configuration.ApplicationOsVersion.Version}"></Run>
</TextBlock>
</StackPanel>
</Grid>
@@ -369,7 +369,7 @@
<Grid>
<TextBlock Margin="10" FontStyle="Italic" FontWeight="Bold" HorizontalAlignment="Center" VerticalAlignment="Top" Foreground="Gray" FontSize="16">IDS PACKS</TextBlock>
<ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
- <ItemsControl ItemsSource="{Binding Configuration.IdsPacks}" FontSize="10" Foreground="DimGray" Margin="10 30 10 10">
+ <ItemsControl ItemsSource="{Binding ActiveMachine.Configuration.IdsPacks}" FontSize="10" Foreground="DimGray" Margin="10 30 10 10">
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel>
@@ -424,7 +424,7 @@
<materialDesign:PackIcon Width="24" Height="24" Kind="BarcodeScan" VerticalAlignment="Center" />
<TextBox Margin="5 0 0 0" materialDesign:HintAssist.Hint="Serial Number" Text="{Binding DispensersFilter,UpdateSourceTrigger=PropertyChanged}"></TextBox>
</DockPanel>
- <ListBox Margin="0 10 0 20" ItemsSource="{Binding Adapter.Dispensers}" HorizontalContentAlignment="Stretch" Height="200">
+ <ListBox Margin="0 10 0 20" ItemsSource="{Binding ActiveMachineAdapter.Dispensers}" HorizontalContentAlignment="Stretch" Height="200">
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem" BasedOn="{StaticResource {x:Type ListBoxItem}}">
<Setter Property="HorizontalContentAlignment" Value="Stretch"></Setter>
@@ -451,7 +451,7 @@
</Expander>
<Border Height="1" HorizontalAlignment="Stretch" Background="{DynamicResource MaterialDesignDivider}" SnapsToDevicePixels="True" />
<Expander HorizontalAlignment="Stretch" Header="Mid Tanks">
- <ListBox ItemsSource="{Binding Adapter.MidTankTypesViewSource}" HorizontalContentAlignment="Stretch">
+ <ListBox ItemsSource="{Binding ActiveMachineAdapter.MidTankTypes}" HorizontalContentAlignment="Stretch">
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem" BasedOn="{StaticResource {x:Type ListBoxItem}}">
<Setter Property="HorizontalContentAlignment" Value="Stretch"></Setter>
@@ -477,7 +477,7 @@
</Expander>
<Border Height="1" HorizontalAlignment="Stretch" Background="{DynamicResource MaterialDesignDivider}" SnapsToDevicePixels="True" />
<Expander HorizontalAlignment="Stretch" Header="Cartridges">
- <ListBox ItemsSource="{Binding Adapter.CartridgeTypesViewSource}" HorizontalContentAlignment="Stretch">
+ <ListBox ItemsSource="{Binding ActiveMachineAdapter.CartridgeTypes}" HorizontalContentAlignment="Stretch">
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem" BasedOn="{StaticResource {x:Type ListBoxItem}}">
<Setter Property="HorizontalContentAlignment" Value="Stretch"></Setter>
@@ -503,7 +503,7 @@
</Expander>
<Border Height="1" HorizontalAlignment="Stretch" Background="{DynamicResource MaterialDesignDivider}" SnapsToDevicePixels="True" />
<Expander HorizontalAlignment="Stretch" Header="Liquids">
- <ListBox ItemsSource="{Binding Adapter.LiquidTypesViewSource}" HorizontalContentAlignment="Stretch">
+ <ListBox ItemsSource="{Binding ActiveMachineAdapter.LiquidTypes}" HorizontalContentAlignment="Stretch">
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem" BasedOn="{StaticResource {x:Type ListBoxItem}}">
<Setter Property="HorizontalContentAlignment" Value="Stretch"></Setter>
@@ -535,7 +535,7 @@
</Expander>
<Border Height="1" HorizontalAlignment="Stretch" Background="{DynamicResource MaterialDesignDivider}" SnapsToDevicePixels="True" />
<Expander HorizontalAlignment="Stretch" Header="IDS Pack Formulas">
- <ListBox ItemsSource="{Binding Adapter.IdsPackFormulasViewSource}" HorizontalContentAlignment="Stretch">
+ <ListBox ItemsSource="{Binding ActiveMachineAdapter.IdsPackFormulas}" HorizontalContentAlignment="Stretch">
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem" BasedOn="{StaticResource {x:Type ListBoxItem}}">
<Setter Property="HorizontalContentAlignment" Value="Stretch"></Setter>
@@ -561,7 +561,7 @@
</Expander>
<Border Height="1" HorizontalAlignment="Stretch" Background="{DynamicResource MaterialDesignDivider}" SnapsToDevicePixels="True" />
<Expander HorizontalAlignment="Stretch" Header="Touch Panels">
- <ListBox ItemsSource="{Binding Adapter.ApplicationDisplayPanelVersionsViewSource}" HorizontalContentAlignment="Stretch">
+ <ListBox ItemsSource="{Binding ActiveMachineAdapter.ApplicationDisplayPanelVersions}" HorizontalContentAlignment="Stretch">
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem" BasedOn="{StaticResource {x:Type ListBoxItem}}">
<Setter Property="HorizontalContentAlignment" Value="Stretch"></Setter>
@@ -588,7 +588,7 @@
</Expander>
<Border Height="1" HorizontalAlignment="Stretch" Background="{DynamicResource MaterialDesignDivider}" SnapsToDevicePixels="True" />
<Expander HorizontalAlignment="Stretch" Header="Operation Systems">
- <ListBox ItemsSource="{Binding Adapter.ApplicationOsVersionsViewSource}" HorizontalContentAlignment="Stretch">
+ <ListBox ItemsSource="{Binding ActiveMachineAdapter.ApplicationOsVersions}" HorizontalContentAlignment="Stretch">
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem" BasedOn="{StaticResource {x:Type ListBoxItem}}">
<Setter Property="HorizontalContentAlignment" Value="Stretch"></Setter>
@@ -615,7 +615,7 @@
</Expander>
<Border Height="1" HorizontalAlignment="Stretch" Background="{DynamicResource MaterialDesignDivider}" SnapsToDevicePixels="True" />
<Expander HorizontalAlignment="Stretch" Header="Application Firmwares">
- <ListBox ItemsSource="{Binding Adapter.ApplicationFirmwareVersionsViewSource}" HorizontalContentAlignment="Stretch">
+ <ListBox ItemsSource="{Binding ActiveMachineAdapter.ApplicationFirmwareVersions}" HorizontalContentAlignment="Stretch">
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem" BasedOn="{StaticResource {x:Type ListBoxItem}}">
<Setter Property="HorizontalContentAlignment" Value="Stretch"></Setter>
@@ -642,7 +642,7 @@
</Expander>
<Border Height="1" HorizontalAlignment="Stretch" Background="{DynamicResource MaterialDesignDivider}" SnapsToDevicePixels="True" />
<Expander HorizontalAlignment="Stretch" Header="Embedded Firmwares">
- <ListBox ItemsSource="{Binding Adapter.EmbeddedFirmwareVersionsViewSource}" HorizontalContentAlignment="Stretch">
+ <ListBox ItemsSource="{Binding ActiveMachineAdapter.EmbeddedFirmwareVersions}" HorizontalContentAlignment="Stretch">
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem" BasedOn="{StaticResource {x:Type ListBoxItem}}">
<Setter Property="HorizontalContentAlignment" Value="Stretch"></Setter>
@@ -669,7 +669,7 @@
</Expander>
<Border Height="1" HorizontalAlignment="Stretch" Background="{DynamicResource MaterialDesignDivider}" SnapsToDevicePixels="True" />
<Expander HorizontalAlignment="Stretch" Header="Hardware Versions">
- <ListBox ItemsSource="{Binding Adapter.HardwareVersionsViewSource}" HorizontalContentAlignment="Stretch">
+ <ListBox ItemsSource="{Binding ActiveMachineAdapter.HardwareVersions}" HorizontalContentAlignment="Stretch">
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem" BasedOn="{StaticResource {x:Type ListBoxItem}}">
<Setter Property="HorizontalContentAlignment" Value="Stretch"></Setter>
@@ -699,17 +699,6 @@
</StackPanel>
</Grid>
</ScrollViewer>
-
- <Grid Grid.Row="1" Margin="10">
- <Grid>
- <Button Height="50" Command="{Binding SaveCommand}" Margin="0 0 5 0">
- <StackPanel Orientation="Horizontal">
- <materialDesign:PackIcon Width="20" Height="20" VerticalAlignment="Center" Kind="ContentSaveSettings"></materialDesign:PackIcon>
- <TextBlock FontSize="14" Margin="10 0 0 0" VerticalAlignment="Center">SAVE</TextBlock>
- </StackPanel>
- </Button>
- </Grid>
- </Grid>
</Grid>
</Grid>
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 320ce58aa..4b021e424 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,39 +5,54 @@
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:observables="clr-namespace:Tango.BL.Entities;assembly=Tango.BL"
+ xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:vm="clr-namespace:Tango.MachineStudio.MachineDesigner.ViewModels"
- xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
- xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI"
+ 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 Margin="20">
<DockPanel>
<Grid DockPanel.Dock="Top">
<StackPanel Orientation="Horizontal">
- <Button Style="{StaticResource MaterialDesignFlatButton}" Height="Auto" Command="{Binding BackToDispensersCommand}">
+ <Button Style="{StaticResource MaterialDesignFlatButton}" Height="Auto" Command="{Binding BackToMachinesCommand}">
<materialDesign:PackIcon Kind="ArrowLeft" Width="50" Height="50" Foreground="#202020" ToolTip="Back to RML list" />
</Button>
- <TextBlock VerticalAlignment="Center" Margin="10 0 0 0" FontSize="34">
- <Run>MACHINE</Run>
- <Run Text="{Binding ActiveMachine.SerialNumber}"></Run>
+ <TextBlock VerticalAlignment="Center" Margin="10 0 0 0" FontSize="34" Text="{Binding ActiveMachine.Name}">
+
</TextBlock>
</StackPanel>
- <Button HorizontalAlignment="Right" Width="170" Height="45" Margin="0 0 20 0" 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>
- </StackPanel>
- </Button>
+ <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0 0 20 0">
+ <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>
+ </StackPanel>
+ </Button>
+ </StackPanel>
</Grid>
<Grid DockPanel.Dock="Bottom">
</Grid>
- <Grid Margin="0 20">
+ <Grid>
+ <TabControl Background="Transparent">
+ <TabControl.Resources>
+ <Style TargetType="TabPanel">
+ <Setter Property="HorizontalAlignment" Value="Center"/>
+ </Style>
+ </TabControl.Resources>
+ <TabItem Header="SETTINGS">
+ <local:MachineSettingsView/>
+ </TabItem>
+ <TabItem Header="CONFIGURATION">
+ <local:ConfigurationView/>
+ </TabItem>
+ <TabItem Header="SPOOLS">
+ </TabItem>
+ </TabControl>
</Grid>
</DockPanel>
</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
new file mode 100644
index 000000000..63d1d2305
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineSettingsView.xaml
@@ -0,0 +1,99 @@
+<UserControl x:Class="Tango.MachineStudio.MachineDesigner.Views.MachineSettingsView"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ 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:mahapps="http://metro.mahapps.com/winfx/xaml/controls"
+ xmlns:observables="clr-namespace:Tango.BL.Entities;assembly=Tango.BL"
+ xmlns:vm="clr-namespace:Tango.MachineStudio.MachineDesigner.ViewModels"
+ xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI"
+ xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
+ xmlns:converters="clr-namespace:Tango.SharedUI.Converters;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 Margin="20">
+ <DockPanel>
+ <Grid DockPanel.Dock="Bottom">
+
+ </Grid>
+
+ <Grid Margin="0 20">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="111*"/>
+ <ColumnDefinition Width="124*"/>
+ </Grid.ColumnDefinitions>
+
+ <local:MachineView DataContext="{Binding ActiveMachine}" IsHitTestVisible="False" />
+
+ <Border Grid.Column="1" Margin="100 140" CornerRadius="5" Background="#68F6F6F6" Padding="10" BorderBrush="Silver" BorderThickness="1">
+ <Grid>
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition/>
+ <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>
+
+ <TextBlock FontWeight="SemiBold">Machine Version</TextBlock>
+ <ComboBox Background="#F4F4F4" ItemsSource="{Binding ActiveMachineAdapter.MachineVersions}" SelectedItem="{Binding ActiveMachine.MachineVersion}" DisplayMemberPath="Name"></ComboBox>
+
+ <TextBlock FontWeight="SemiBold">Organization</TextBlock>
+ <ComboBox Background="#F4F4F4" ItemsSource="{Binding ActiveMachineAdapter.Organizations}" SelectedItem="{Binding ActiveMachine.Organization}" DisplayMemberPath="Name"></ComboBox>
+
+ <TextBlock FontWeight="SemiBold">Default RML</TextBlock>
+ <ComboBox Background="#F4F4F4" ItemsSource="{Binding ActiveMachineAdapter.Rmls}" SelectedItem="{Binding ActiveMachine.DefaultRml}" DisplayMemberPath="Name"></ComboBox>
+
+ <TextBlock FontWeight="SemiBold">Loaded RML</TextBlock>
+ <ComboBox Background="#F4F4F4" ItemsSource="{Binding ActiveMachineAdapter.Rmls}" SelectedValue="{Binding ActiveMachine.LoadedRmlGuid}" SelectedValuePath="Guid" DisplayMemberPath="Name"></ComboBox>
+
+ <TextBlock FontWeight="SemiBold">Default Color Space</TextBlock>
+ <ComboBox Background="#F4F4F4" ItemsSource="{Binding ActiveMachineAdapter.ColorSpaces}" SelectedItem="{Binding ActiveMachine.DefaultColorSpace}" DisplayMemberPath="Name"></ComboBox>
+
+ <TextBlock FontWeight="SemiBold">Default Segment Length</TextBlock>
+ <mahapps:NumericUpDown HideUpDownButtons="True" BorderThickness="0 0 0 1" Background="Transparent" Minimum="0" Maximum="1000" Value="{Binding ActiveMachine.DefaultSegmentLength}" HasDecimals="False"></mahapps:NumericUpDown>
+
+ <TextBlock FontWeight="SemiBold">Default Spool Type</TextBlock>
+ <ComboBox ItemsSource="{Binding ActiveMachineAdapter.SpoolTypes}" SelectedItem="{Binding ActiveMachine.DefaultSpoolType}" DisplayMemberPath="Name"></ComboBox>
+
+ <TextBlock FontWeight="SemiBold">OS Key</TextBlock>
+ <TextBox Text="{Binding ActiveMachine.OsKey}"></TextBox>
+ </controls:TableGrid>
+ <Rectangle Grid.Column="1" StrokeThickness="1" Stroke="Silver" HorizontalAlignment="Center" Margin="50 50" />
+ <controls:TableGrid RowHeight="50" Margin="10" Grid.Column="2">
+ <TextBlock FontWeight="SemiBold">Auto Login</TextBlock>
+ <ToggleButton HorizontalAlignment="Left" IsChecked="{Binding ActiveMachine.AutoLogin}"></ToggleButton>
+
+ <TextBlock FontWeight="SemiBold">Auto Check For Updates</TextBlock>
+ <ToggleButton HorizontalAlignment="Left" IsChecked="{Binding ActiveMachine.AutoCheckForUpdates}"></ToggleButton>
+
+ <TextBlock FontWeight="SemiBold">Setup Activation</TextBlock>
+ <ToggleButton HorizontalAlignment="Left" IsChecked="{Binding ActiveMachine.SetupActivation}"></ToggleButton>
+
+ <TextBlock FontWeight="SemiBold">Setup Remote Assistance</TextBlock>
+ <ToggleButton HorizontalAlignment="Left" IsChecked="{Binding ActiveMachine.SetupRemoteAssistance}"></ToggleButton>
+
+ <TextBlock FontWeight="SemiBold">Setup UWF</TextBlock>
+ <ToggleButton HorizontalAlignment="Left" IsChecked="{Binding ActiveMachine.SetupUwf}"></ToggleButton>
+
+ <TextBlock FontWeight="SemiBold">Setup Firmware</TextBlock>
+ <ToggleButton HorizontalAlignment="Left" IsChecked="{Binding ActiveMachine.SetupFirmware}"></ToggleButton>
+
+ <TextBlock FontWeight="SemiBold">Setup FPGA</TextBlock>
+ <ToggleButton HorizontalAlignment="Left" IsChecked="{Binding ActiveMachine.SetupFpga}"></ToggleButton>
+
+ <TextBlock FontWeight="SemiBold">Is Demo Machine</TextBlock>
+ <ToggleButton HorizontalAlignment="Left" IsChecked="{Binding ActiveMachine.IsDemo}"></ToggleButton>
+ </controls:TableGrid>
+ </Grid>
+ </Border>
+ </Grid>
+ </DockPanel>
+ </Grid>
+</UserControl>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineSettingsView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineSettingsView.xaml.cs
new file mode 100644
index 000000000..29367c3c4
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineSettingsView.xaml.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace Tango.MachineStudio.MachineDesigner.Views
+{
+ /// <summary>
+ /// Interaction logic for MachineDetailsView.xaml
+ /// </summary>
+ public partial class MachineSettingsView : UserControl
+ {
+ public MachineSettingsView()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineView.xaml
index ded14930a..d6afd41bf 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineView.xaml
@@ -69,25 +69,6 @@
<Rectangle Stroke="Gray" HorizontalAlignment="Left" StrokeThickness="1" StrokeDashArray="5" RenderTransformOrigin="0.5,0.5"/>
</Grid>
- <TextBlock Canvas.Top="222" Canvas.Left="446" FontStyle="Italic" Foreground="Gray">Add IDS</TextBlock>
- <Grid Width="23" Height="20" Canvas.Top="231" Canvas.Left="414">
- <Rectangle Stroke="Gray" VerticalAlignment="Top" StrokeThickness="1" StrokeDashArray="5" RenderTransformOrigin="0.5,0.5"/>
- <Rectangle Stroke="Gray" HorizontalAlignment="Left" StrokeThickness="1" StrokeDashArray="5" RenderTransformOrigin="0.5,0.5"/>
- </Grid>
-
- <TextBlock Canvas.Top="255" Canvas.Left="500" FontStyle="Italic" Foreground="Gray">Remove IDS</TextBlock>
- <Grid Width="35" Height="8" Canvas.Top="264" Canvas.Left="460">
- <Rectangle Stroke="Gray" VerticalAlignment="Top" StrokeThickness="1" StrokeDashArray="5" RenderTransformOrigin="0.5,0.5"/>
- </Grid>
-
- <Button Style="{StaticResource MaterialDesignFlatButton}" Height="24" Width="24" Padding="0" Canvas.Left="402" Canvas.Top="253">
- <materialDesign:PackIcon Kind="Plus" Width="24" Height="24"></materialDesign:PackIcon>
- </Button>
-
- <Button Style="{StaticResource MaterialDesignFlatButton}" Height="24" Width="24" Padding="0" Canvas.Left="430" Canvas.Top="252">
- <materialDesign:PackIcon Kind="Minus" Width="24" Height="24"></materialDesign:PackIcon>
- </Button>
-
<UniformGrid Width="310" Canvas.Top="295" Canvas.Left="420" Rows="1" Columns="8" TextElement.FontSize="9">
<TextBlock HorizontalAlignment="Center">1</TextBlock>
<TextBlock HorizontalAlignment="Center">2</TextBlock>
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 48ce34688..91eda3491 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
@@ -53,7 +53,7 @@
</StackPanel>
</Grid>
<Grid>
- <DataGrid Margin="0 0 0 10" BorderBrush="Silver" IsReadOnly="True" BorderThickness="1" Background="#93FFFFFF" AlternatingRowBackground="#C9F6F6F6" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" ItemsSource="{Binding Machines}" SelectedItem="{Binding SelectedMachine}">
+ <DataGrid Margin="0 0 0 10" SelectionMode="Single" SelectionUnit="FullRow" BorderBrush="Silver" IsReadOnly="True" BorderThickness="1" Background="#93FFFFFF" AlternatingRowBackground="#C9F6F6F6" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" ItemsSource="{Binding MachinesAdapter.Machines}" SelectedItem="{Binding SelectedMachine}">
<DataGrid.CellStyle>
<Style TargetType="DataGridCell" BasedOn="{StaticResource {x:Type DataGridCell}}">
<Setter Property="BorderThickness" Value="0"/>
@@ -64,7 +64,10 @@
<DataGrid.Columns>
<DataGridTextColumn Header="SERIAL NUMBER" Binding="{Binding SerialNumber}" Width="Auto" />
<DataGridTextColumn Header="NAME" Binding="{Binding Name}" Width="Auto" />
- <DataGridTextColumn Header="LAST UPDATED" Binding="{Binding LastUpdated,Converter={StaticResource DateTimeUTCToShortDateTimeConverter}}" Width="Auto" />
+ <DataGridTextColumn Header="ORGANIZATION" Binding="{Binding Organization.Name}" Width="Auto" />
+ <DataGridTextColumn Header="VERSION" Binding="{Binding MachineVersion.Name}" Width="Auto" />
+ <DataGridTextColumn Header="DEMO MACHINE" Binding="{Binding IsDemo}" Width="Auto" />
+ <DataGridTextColumn Header="LAST UPDATED" Binding="{Binding LastUpdated,Converter={StaticResource DateTimeUTCToShortDateTimeConverter}}" Width="1*" />
</DataGrid.Columns>
</DataGrid>
</Grid>
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 0ffcf400a..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,11 +9,10 @@
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/>
- <local:ConfigurationView/>
</controls:NavigationControl>
</Grid>
</UserControl>