aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules
diff options
context:
space:
mode:
authorShlomo Hecht <shlomo@twine-s.com>2018-08-26 10:55:44 +0300
committerShlomo Hecht <shlomo@twine-s.com>2018-08-26 10:55:44 +0300
commit6e2fbaffeec9d6e3518ea9706eea107a4f1b348c (patch)
treef50b3d8962dd37188061f8f52c1a7aeff1642232 /Software/Visual_Studio/MachineStudio/Modules
parentdb3dc558ec5fe5f3584081795865cd22f912da7d (diff)
parente6704dce7a2b7f6d5f9bbf1b8374cc7f00ea061e (diff)
downloadTango-6e2fbaffeec9d6e3518ea9706eea107a4f1b348c.tar.gz
Tango-6e2fbaffeec9d6e3518ea9706eea107a4f1b348c.zip
merge
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules')
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Properties/AssemblyInfo.cs2
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Tango.MachineStudio.ColorLab.csproj2
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/MainViewVM.cs131
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/MainView.xaml6
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Properties/AssemblyInfo.cs2
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Tango.MachineStudio.DB.csproj2
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/MainViewVM.cs77
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/MainDBView.xaml14
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Properties/AssemblyInfo.cs2
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Tango.MachineStudio.DataCapture.csproj11
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/app.config14
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/packages.config1
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Navigation/DeveloperNavigationManager.cs2
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Properties/AssemblyInfo.cs2
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj14
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModelLocator.cs2
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs470
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml6
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml.cs2
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MachineJobSelectionView.xaml271
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml2
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/app.config4
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Properties/AssemblyInfo.cs2
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Tango.MachineStudio.HardwareDesigner.csproj2
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/ViewModels/MainViewVM.cs755
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Views/MainView.xaml78
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/App.config4
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Properties/AssemblyInfo.cs2
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Tango.MachineStudio.Logging.csproj2
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/EventsViewVM.cs74
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/AutoComplete/MachineVersionsProvider.cs2
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/AutoComplete/MachinesProvider.cs29
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Properties/AssemblyInfo.cs2
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Tango.MachineStudio.MachineDesigner.csproj16
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MachineVersionDialogVM.cs4
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs268
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineView.xaml1
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MainView.xaml9
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/app.config14
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/packages.config1
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/Properties/AssemblyInfo.cs2
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/Tango.MachineStudio.Stubs.csproj11
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/ViewModels/MainViewVM.cs7
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/app.config10
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/packages.config1
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/Tango.MachineStudio.Synchronization.csproj2
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/BlowerElementEditor.xaml19
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/BreakSensorElementEditor.xaml19
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ControllerElementEditor.xaml19
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DancerElementEditor.xaml19
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DigitalInElementEditor.xaml19
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DigitalOutElementEditor.xaml19
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DispenserElementEditor.xaml19
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/JobRunnerElementEditor.xaml19
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MeterElementEditor.xaml19
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MonitorElementEditor.xaml19
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MotorElementEditor.xaml19
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MotorGroupElementEditor.xaml19
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MultiGraphElementEditor.xaml17
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/PidElementEditor.xaml19
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ProcessParametersElementEditor.xaml19
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/SingleGraphElementEditor.xaml17
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/SpeedSensorElementEditor.xaml19
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ThreadMotionElementEditor.xaml19
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/WinderElementEditor.xaml19
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Properties/AssemblyInfo.cs2
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/JobRunnerTemplate.xaml4
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/ProcessParametersTemplate.xaml2
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Tango.MachineStudio.Technician.csproj11
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/BlowerItem.cs3
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/BreakSensorItem.cs3
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/DancerItem.cs2
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/DispenserItem.cs2
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/JobRunnerItem.cs1
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MotorGroupItem.cs2
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MotorItem.cs2
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/PidItem.cs2
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/ProcessParametersItem.cs18
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/SpeedSensorItem.cs2
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/TechItem.cs4
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/WinderItem.cs2
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs159
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml.cs2
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/app.config10
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/packages.config1
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Properties/AssemblyInfo.cs2
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Tango.MachineStudio.UsersAndRoles.csproj2
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/ViewModels/MainViewVM.cs50
88 files changed, 1727 insertions, 1255 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Properties/AssemblyInfo.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Properties/AssemblyInfo.cs
index bda64c925..77d9cc0d8 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Properties/AssemblyInfo.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Properties/AssemblyInfo.cs
@@ -5,7 +5,7 @@ using System.Runtime.InteropServices;
using System.Windows;
[assembly: AssemblyTitle("Tango - Machine Studio Color Lab Module")]
-[assembly: AssemblyVersion("2.0.8.1633")]
+[assembly: AssemblyVersion("2.0.10.1159")]
[assembly: ComVisible(false)]
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Tango.MachineStudio.ColorLab.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Tango.MachineStudio.ColorLab.csproj
index a0d471522..7e8a9e126 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Tango.MachineStudio.ColorLab.csproj
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Tango.MachineStudio.ColorLab.csproj
@@ -8,7 +8,7 @@
<OutputType>library</OutputType>
<RootNamespace>Tango.MachineStudio.ColorLab</RootNamespace>
<AssemblyName>Tango.MachineStudio.ColorLab</AssemblyName>
- <TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
+ <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/MainViewVM.cs
index 5b317e6d2..02f496b1f 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/MainViewVM.cs
@@ -25,7 +25,7 @@ using Tango.SharedUI.Controls;
namespace Tango.MachineStudio.ColorLab.ViewModels
{
- public class MainViewVM : StudioViewModel<ColorLabModule>
+ public class MainViewVM : StudioViewModel
{
private ObservablesContext _dbContext;
private INotificationProvider _notification;
@@ -239,34 +239,57 @@ namespace Tango.MachineStudio.ColorLab.ViewModels
#endregion
+ #region Constructors
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="MainViewVM"/> class.
+ /// </summary>
+ /// <param name="notification">The notification.</param>
public MainViewVM(INotificationProvider notification) : base()
{
_notification = notification;
- _dbContext = ObservablesContext.CreateDefault();
-
CCT = new Cct();
SourceColor = new RgbVM();
SourceColor.ColorChanged += SourceColor_ColorChanged;
- Machines = _dbContext.Machines.ToObservableCollection();
- ColorSpaces = _dbContext.ColorSpaces.ToObservableCollection();
- Rmls = _dbContext.Rmls.ToObservableCollection();
- ImportForwardDataCommand = new RelayCommand(ImportForwardData, () => SelectedRML != null);
- ImportInverseDataCommand = new RelayCommand(ImportInverseData, () => SelectedRML != null);
+ ImportForwardDataCommand = new RelayCommand(ImportForwardData, () => SelectedRML != null && IsFree);
+ ImportInverseDataCommand = new RelayCommand(ImportInverseData, () => SelectedRML != null && IsFree);
- ExportForwardDataCommand = new RelayCommand(ExportForwardData, () => SelectedRML != null && CCT != null && CCT.ForwardFileName != null);
- ExportInverseDataCommand = new RelayCommand(ExportInverseData, () => SelectedRML != null && CCT != null && CCT.InverseFileName != null);
+ ExportForwardDataCommand = new RelayCommand(ExportForwardData, () => SelectedRML != null && CCT != null && CCT.ForwardFileName != null && IsFree);
+ ExportInverseDataCommand = new RelayCommand(ExportInverseData, () => SelectedRML != null && CCT != null && CCT.InverseFileName != null && IsFree);
- SaveCommand = new RelayCommand(Save, () => SelectedRML != null);
+ SaveCommand = new RelayCommand(Save, () => SelectedRML != null && IsFree);
}
+ #endregion
+
+ #region Event Handlers
+
private void SourceColor_ColorChanged(object sender, Color e)
{
GetHiveSuggestions();
}
+ #endregion
+
+ #region Application Ready
+
+ public override void OnApplicationReady()
+ {
+ Task.Factory.StartNew(() =>
+ {
+ _dbContext = ObservablesContext.CreateDefault();
+
+ Machines = _dbContext.Machines.ToObservableCollection();
+ ColorSpaces = _dbContext.ColorSpaces.ToObservableCollection();
+ Rmls = _dbContext.Rmls.ToObservableCollection();
+ });
+ }
+
+ #endregion
+
#region ColorLab
private void GetHiveSuggestions()
@@ -417,6 +440,10 @@ namespace Tango.MachineStudio.ColorLab.ViewModels
{
if (SelectedMachine != null)
{
+ IsFree = false;
+
+ _dbContext.Adapter.GetConfiguration(x => x.Guid == SelectedMachine.ConfigurationGuid);
+
LiquidVolumes = SelectedMachine.Configuration.NoneEmptyIdsPacks.OrderBy(x => x.PackIndex).Select(x => new LiquidVolumeVM()
{
Color = x.LiquidType.Color,
@@ -424,12 +451,17 @@ namespace Tango.MachineStudio.ColorLab.ViewModels
IdsPack = x,
}).ToObservableCollection();
+
+ LiquidVolumes.EnableCrossThreadOperations();
+
LiquidVolumes.ToList().ForEach(x => x.VolumeChanged += (s, e) => OnLiquidVolumeChanged());
InvalidateLiquidFactorsCalibrationData();
SelectedMachine.Modified -= SelectedMachine_Modified;
SelectedMachine.Modified += SelectedMachine_Modified;
+
+ IsFree = true;
}
}
@@ -515,42 +547,61 @@ namespace Tango.MachineStudio.ColorLab.ViewModels
#region RML
- private void InvalidateLiquidFactorsCalibrationData()
+ private async void InvalidateLiquidFactorsCalibrationData()
{
if (SelectedRML != null && SelectedMachine != null)
{
- LiquidTypesRmls = SelectedMachine.Configuration.NoneEmptyIdsPacks.OrderBy(x => x.PackIndex).Select(x => x.LiquidType).SelectMany(x => x.LiquidTypesRmls).Where(x => x.Rml.Guid == SelectedRML.Guid).ToList();
- //RmlProcessParametersTableGroup = SelectedRML.ProcessParametersTablesGroups.ToList().SingleOrDefault(x => x.Active);
-
- LiquidsCalibrationData = new ObservableCollection<CalibrationDataVM>();
+ IsFree = false;
- foreach (var idsPack in SelectedMachine.Configuration.NoneEmptyIdsPacks.OrderBy(x => x.PackIndex))
+ await Task.Factory.StartNew(() =>
{
- CalibrationDataVM vm = new CalibrationDataVM();
- vm.Name = idsPack.LiquidType.Name;
- vm.Color = idsPack.LiquidType.Color;
- vm.IdsPack = idsPack;
+ using (_notification.PushTaskItem("Loading RML data..."))
+ {
+ _dbContext.Adapter.GetConfiguration(x => x.Guid == SelectedMachine.ConfigurationGuid);
+ _dbContext.Adapter.GetRmlCCTs(SelectedRML.Guid);
+ _dbContext.Adapter.GetRmlCATs(SelectedRML.Guid, SelectedMachine.Guid);
+ _dbContext.Adapter.GetRmlLiquidTypes(SelectedRML.Guid);
- var cat = idsPack.LiquidType.Cats.FirstOrDefault(x => x.Machine == SelectedMachine && x.Rml == SelectedRML);
+ LiquidTypesRmls = SelectedMachine.Configuration.NoneEmptyIdsPacks.OrderBy(x => x.PackIndex).Select(x => x.LiquidType).SelectMany(x => x.LiquidTypesRmls).Where(x => x.Rml.Guid == SelectedRML.Guid).ToList();
+ //RmlProcessParametersTableGroup = SelectedRML.ProcessParametersTablesGroups.ToList().SingleOrDefault(x => x.Active);
- if (cat != null)
- {
- var calData = cat.GetCalibrationData();
- vm.CalibrationPoints = calData.CalibrationPoints.Select(x => new CalibrationDataPointVM(x.X, x.Y)).ToObservableCollection();
- }
+ LiquidsCalibrationData = new ObservableCollection<CalibrationDataVM>();
+ LiquidsCalibrationData.EnableCrossThreadOperations();
- LiquidsCalibrationData.Add(vm);
- }
+ foreach (var idsPack in SelectedMachine.Configuration.NoneEmptyIdsPacks.OrderBy(x => x.PackIndex))
+ {
+ CalibrationDataVM vm = new CalibrationDataVM();
+ vm.Name = idsPack.LiquidType.Name;
+ vm.Color = idsPack.LiquidType.Color;
+ vm.IdsPack = idsPack;
- _isNewCCT = false;
- CCT = SelectedRML.Ccts.FirstOrDefault();
+ var cat = idsPack.LiquidType.Cats.FirstOrDefault(x => x.Machine == SelectedMachine && x.Rml == SelectedRML);
- if (CCT == null)
- {
- CCT = new Cct();
- CCT.Rml = SelectedRML;
- _isNewCCT = true;
- }
+ if (cat != null)
+ {
+ var calData = cat.GetCalibrationData();
+ vm.CalibrationPoints = calData.CalibrationPoints.Select(x => new CalibrationDataPointVM(x.X, x.Y)).ToObservableCollection();
+ }
+
+ InvokeUINow(() =>
+ {
+ LiquidsCalibrationData.Add(vm);
+ });
+ }
+
+ _isNewCCT = false;
+ CCT = SelectedRML.Ccts.FirstOrDefault();
+
+ if (CCT == null)
+ {
+ CCT = new Cct();
+ CCT.Rml = SelectedRML;
+ _isNewCCT = true;
+ }
+ }
+ });
+
+ IsFree = true;
}
}
@@ -564,6 +615,8 @@ namespace Tango.MachineStudio.ColorLab.ViewModels
{
try
{
+ IsFree = false;
+
if (_isNewCCT)
{
_dbContext.Ccts.Add(CCT);
@@ -601,6 +654,10 @@ namespace Tango.MachineStudio.ColorLab.ViewModels
{
_notification.ShowError(LogManager.Log(ex, "An error occurred while trying to save to data base.").Message + Environment.NewLine + ex.Message);
}
+ finally
+ {
+ IsFree = true;
+ }
}
}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/MainView.xaml
index d8ef015be..78eaf04e8 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/MainView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/MainView.xaml
@@ -35,7 +35,7 @@
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
- <Grid Background="#B1FFFFFF">
+ <Grid Background="#B1FFFFFF" IsEnabled="{Binding IsFree}">
<DockPanel>
<Grid DockPanel.Dock="Bottom" Margin="20">
<Button Height="60" Command="{Binding SaveCommand}" Width="200" HorizontalAlignment="Right">
@@ -269,7 +269,7 @@
</StackPanel>
</StackPanel>
- <ItemsControl ItemsSource="{Binding LiquidVolumes}" VerticalAlignment="Center" MinWidth="420">
+ <ItemsControl ItemsSource="{Binding LiquidVolumes}" VerticalAlignment="Center" MinWidth="420" IsEnabled="{Binding IsFree}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel VerticalAlignment="Center" Orientation="Horizontal" IsItemsHost="True"></StackPanel>
@@ -361,7 +361,7 @@
</Grid>
<Grid Margin="0 20 0 0">
- <ItemsControl DockPanel.Dock="Top" ItemsSource="{Binding LiquidsCalibrationData}">
+ <ItemsControl DockPanel.Dock="Top" ItemsSource="{Binding LiquidsCalibrationData}" IsEnabled="{Binding IsFree}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid Rows="1" />
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Properties/AssemblyInfo.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Properties/AssemblyInfo.cs
index 3b589e28b..fe6b7a013 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Properties/AssemblyInfo.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Properties/AssemblyInfo.cs
@@ -5,7 +5,7 @@ using System.Runtime.InteropServices;
using System.Windows;
[assembly: AssemblyTitle("Tango - Machine Studio DB Module")]
-[assembly: AssemblyVersion("2.0.7.1633")]
+[assembly: AssemblyVersion("2.0.9.1159")]
[assembly: ComVisible(false)]
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Tango.MachineStudio.DB.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Tango.MachineStudio.DB.csproj
index 393c4e491..259f2f652 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Tango.MachineStudio.DB.csproj
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Tango.MachineStudio.DB.csproj
@@ -8,7 +8,7 @@
<OutputType>library</OutputType>
<RootNamespace>Tango.MachineStudio.DB</RootNamespace>
<AssemblyName>Tango.MachineStudio.DB</AssemblyName>
- <TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
+ <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/MainViewVM.cs
index 727436306..9503e4c38 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/MainViewVM.cs
@@ -7,6 +7,7 @@ using System.Threading.Tasks;
using System.Windows;
using Tango.BL;
using Tango.BL.Entities;
+using Tango.Core.Commands;
using Tango.Core.DI;
using Tango.MachineStudio.Common;
using Tango.MachineStudio.Common.StudioApplication;
@@ -14,36 +15,72 @@ using Tango.SharedUI;
namespace Tango.MachineStudio.DB.ViewModels
{
- public class MainViewVM : StudioViewModel<DBModule>
+ public class MainViewVM : StudioViewModel
{
- public MainViewVM() : base()
+ private bool _isLoading;
+ public bool IsLoading
{
+ get { return _isLoading; }
+ set { _isLoading = value; RaisePropertyChangedAuto(); }
+ }
+ private bool _notLoaded;
+ public bool NotLoaded
+ {
+ get { return _notLoaded; }
+ set { _notLoaded = value; RaisePropertyChangedAuto(); }
}
- public override void OnModuleRequest(params object[] args)
+ public RelayCommand LoadCommand { get; set; }
+
+ public MainViewVM() : base()
{
- if (args != null && args.Length > 0 && args[0] is IObservableEntity)
- {
- var arg = args[0];
+ NotLoaded = true;
+ LoadCommand = new RelayCommand(LoadAdapter,() => !IsLoading);
+ }
- String vmName = arg.GetType().Name + "sViewVM";
+ private async void LoadAdapter()
+ {
+ IsLoading = true;
+ InvalidateRelayCommands();
- Type vmType = Assembly.GetAssembly(typeof(MainViewVM)).GetTypes().SingleOrDefault(x => x.Name == vmName);
+ await Task.Factory.StartNew(() =>
+ {
+ ObservablesEntitiesAdapter.Instance.Initialize();
+ });
- if (vmType == null)
- {
- vmName = arg.GetType().BaseType.Name + "sViewVM";
- vmType = Assembly.GetAssembly(typeof(MainViewVM)).GetTypes().SingleOrDefault(x => x.Name == vmName);
- }
+ IsLoading = false;
+ NotLoaded = false;
+ }
- if (vmType != null)
- {
- var vm = TangoIOC.Default.GetInstance(vmType);
- vmType.GetProperty("SelectedEntity").SetValue(vm, arg);
- vmType.GetMethod("OnEdit", BindingFlags.Instance | BindingFlags.NonPublic).Invoke(vm, new object[] { });
- }
- }
+ public override void OnApplicationReady()
+ {
+
}
+
+ //public override void OnModuleRequest(params object[] args)
+ //{
+ // if (args != null && args.Length > 0 && args[0] is IObservableEntity)
+ // {
+ // var arg = args[0];
+
+ // String vmName = arg.GetType().Name + "sViewVM";
+
+ // Type vmType = Assembly.GetAssembly(typeof(MainViewVM)).GetTypes().SingleOrDefault(x => x.Name == vmName);
+
+ // if (vmType == null)
+ // {
+ // vmName = arg.GetType().BaseType.Name + "sViewVM";
+ // vmType = Assembly.GetAssembly(typeof(MainViewVM)).GetTypes().SingleOrDefault(x => x.Name == vmName);
+ // }
+
+ // if (vmType != null)
+ // {
+ // var vm = TangoIOC.Default.GetInstance(vmType);
+ // vmType.GetProperty("SelectedEntity").SetValue(vm, arg);
+ // vmType.GetMethod("OnEdit", BindingFlags.Instance | BindingFlags.NonPublic).Invoke(vm, new object[] { });
+ // }
+ // }
+ //}
}
}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/MainDBView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/MainDBView.xaml
index a6edd80da..050ce5f31 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/MainDBView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/MainDBView.xaml
@@ -6,6 +6,7 @@
xmlns:dockablz="clr-namespace:Dragablz.Dockablz;assembly=Dragablz"
xmlns:dragablz="clr-namespace:Dragablz;assembly=Dragablz"
xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI"
+ xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
xmlns:managers="clr-namespace:Tango.MachineStudio.DB.Managers"
@@ -154,5 +155,18 @@
<Thumb HorizontalAlignment="Left" Opacity="0" Width="5" VerticalAlignment="Stretch" Cursor="SizeWE" DragDelta="Thumb_DragDelta"></Thumb>
</Grid>
+
+ <Grid Background="#C9000000" Visibility="{Binding NotLoaded,Converter={StaticResource BoolToVisConverter}}">
+ <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0 20 0 0">
+ <TextBlock TextAlignment="Center" FontSize="16" Foreground="Gainsboro">
+ <Run>The Database module is considered obsolete and will be removed in the future.</Run>
+ <LineBreak/>
+ <Run>Loading the module will require some time and memory.</Run>
+ </TextBlock>
+
+ <Button Height="50" Width="200" Margin="0 40 0 0" Command="{Binding LoadCommand}">LOAD</Button>
+ <mahapps:ProgressRing Margin="0 20 0 0" IsActive="{Binding IsLoading}" />
+ </StackPanel>
+ </Grid>
</Grid>
</UserControl>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Properties/AssemblyInfo.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Properties/AssemblyInfo.cs
index 51246a5d1..01b5df038 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Properties/AssemblyInfo.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Properties/AssemblyInfo.cs
@@ -5,7 +5,7 @@ using System.Runtime.InteropServices;
using System.Windows;
[assembly: AssemblyTitle("Tango - Machine Studio Data Capturing Module")]
-[assembly: AssemblyVersion("2.0.8.1633")]
+[assembly: AssemblyVersion("2.0.10.1159")]
[assembly: ComVisible(false)]
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Tango.MachineStudio.DataCapture.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Tango.MachineStudio.DataCapture.csproj
index a8cd6b1cd..15df43f6e 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Tango.MachineStudio.DataCapture.csproj
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Tango.MachineStudio.DataCapture.csproj
@@ -8,7 +8,7 @@
<OutputType>library</OutputType>
<RootNamespace>Tango.MachineStudio.DataCapture</RootNamespace>
<AssemblyName>Tango.MachineStudio.DataCapture</AssemblyName>
- <TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
+ <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
@@ -31,6 +31,12 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
+ <Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
+ <HintPath>..\..\..\packages\EntityFramework.6.0.0\lib\net45\EntityFramework.dll</HintPath>
+ </Reference>
+ <Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
+ <HintPath>..\..\..\packages\EntityFramework.6.0.0\lib\net45\EntityFramework.SqlServer.dll</HintPath>
+ </Reference>
<Reference Include="Google.Protobuf, Version=3.4.1.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Google.Protobuf.3.4.1\lib\net45\Google.Protobuf.dll</HintPath>
</Reference>
@@ -44,6 +50,7 @@
<HintPath>..\..\..\packages\MaterialDesignThemes.2.3.1.953\lib\net45\MaterialDesignThemes.Wpf.dll</HintPath>
</Reference>
<Reference Include="System" />
+ <Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
@@ -188,7 +195,7 @@
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<ProjectExtensions>
<VisualStudio>
- <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" />
+ <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" />
</VisualStudio>
</ProjectExtensions>
</Project> \ No newline at end of file
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/app.config b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/app.config
index 5d794b958..0e58ccf54 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/app.config
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/app.config
@@ -1,5 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
+ <configSections>
+ <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
+ <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
+ </configSections>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
@@ -46,6 +50,16 @@
<assemblyIdentity name="System.Diagnostics.StackTrace" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
</dependentAssembly>
+ <dependentAssembly>
+ <assemblyIdentity name="System.Xml.ReaderWriter" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" />
+ </dependentAssembly>
</assemblyBinding>
</runtime>
+ <entityFramework>
+ <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
+ <providers>
+ <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
+ </providers>
+ </entityFramework>
</configuration> \ No newline at end of file
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/packages.config b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/packages.config
index 73dae1a0c..d1cf6cd7a 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/packages.config
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/packages.config
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="CommonServiceLocator" version="1.3" targetFramework="net46" />
+ <package id="EntityFramework" version="6.0.0" targetFramework="net472" />
<package id="Expression.Blend.Sdk" version="1.0.2" targetFramework="net46" />
<package id="Google.Protobuf" version="3.4.1" targetFramework="net46" />
<package id="MahApps.Metro" version="1.5.0" targetFramework="net46" />
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Navigation/DeveloperNavigationManager.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Navigation/DeveloperNavigationManager.cs
index ff8b0320d..b1039c2c5 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Navigation/DeveloperNavigationManager.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Navigation/DeveloperNavigationManager.cs
@@ -16,7 +16,7 @@ namespace Tango.MachineStudio.Developer.Navigation
public void NavigateTo(DeveloperNavigationView view)
{
LogManager.Log(String.Format("Navigating to view {0}...", view.ToString()));
- MainView.Instance.TransitionControl.NavigateTo(view.ToString());
+ MainView.Instance.NavigationControl.NavigateTo(view.ToString());
}
}
}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Properties/AssemblyInfo.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Properties/AssemblyInfo.cs
index 66e36649b..c29c487ae 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Properties/AssemblyInfo.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Properties/AssemblyInfo.cs
@@ -5,7 +5,7 @@ using System.Runtime.InteropServices;
using System.Windows;
[assembly: AssemblyTitle("Tango - Machine Studio Developer Module")]
-[assembly: AssemblyVersion("2.0.15.1633")]
+[assembly: AssemblyVersion("2.0.17.1159")]
[assembly: ComVisible(false)]
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj
index bd7484de8..cc9831ad9 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj
@@ -8,7 +8,7 @@
<OutputType>library</OutputType>
<RootNamespace>Tango.MachineStudio.Developer</RootNamespace>
<AssemblyName>Tango.MachineStudio.Developer</AssemblyName>
- <TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
+ <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
@@ -196,6 +196,10 @@
<Project>{b9ae25d6-be35-492f-9079-21a7f3e6f7cc}</Project>
<Name>RealTimeGraphEx</Name>
</ProjectReference>
+ <ProjectReference Include="..\..\..\SideChains\Tango.AutoComplete\Tango.AutoComplete.csproj">
+ <Project>{BB2ABB74-BA58-4812-83AA-EC8171F42DF4}</Project>
+ <Name>Tango.AutoComplete</Name>
+ </ProjectReference>
<ProjectReference Include="..\..\..\Tango.BL\Tango.BL.csproj">
<Project>{f441feee-322a-4943-b566-110e12fd3b72}</Project>
<Name>Tango.BL</Name>
@@ -264,10 +268,6 @@
<Project>{fc337a7f-1214-41d8-9992-78092a3b961e}</Project>
<Name>Tango.MachineStudio.DataCapture</Name>
</ProjectReference>
- <ProjectReference Include="..\Tango.MachineStudio.DB\Tango.MachineStudio.DB.csproj">
- <Project>{94f7acf8-55e1-4a02-b9bc-a818413fdbbf}</Project>
- <Name>Tango.MachineStudio.DB</Name>
- </ProjectReference>
<ProjectReference Include="..\Tango.MachineStudio.Logging\Tango.MachineStudio.Logging.csproj">
<Project>{1674f726-0e66-414f-b9fd-c6f20d7f07c7}</Project>
<Name>Tango.MachineStudio.Logging</Name>
@@ -276,10 +276,6 @@
<Project>{d0ce8122-077d-42a2-9490-028ae4769b52}</Project>
<Name>Tango.MachineStudio.MachineDesigner</Name>
</ProjectReference>
- <ProjectReference Include="..\Tango.MachineStudio.Technician\Tango.MachineStudio.Technician.csproj">
- <Project>{5d39c1e1-3ecd-4634-bd1b-2bcf71c54a15}</Project>
- <Name>Tango.MachineStudio.Technician</Name>
- </ProjectReference>
</ItemGroup>
<ItemGroup>
<Resource Include="Images\rgb.png" />
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModelLocator.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModelLocator.cs
index ebf2f2446..5f82984a4 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModelLocator.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModelLocator.cs
@@ -16,8 +16,8 @@ namespace Tango.MachineStudio.Developer
/// </summary>
static ViewModelLocator()
{
- TangoIOC.Default.Register<MainViewVM>();
TangoIOC.Default.Register<DeveloperNavigationManager, DeveloperNavigationManager>();
+ TangoIOC.Default.Register<MainViewVM>();
}
public static MainViewVM MainViewVM
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs
index dace2ceac..60c2e65f9 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs
@@ -41,6 +41,9 @@ using Tango.MachineStudio.Common;
using Tango.BL.ColorConversion;
using Tango.MachineStudio.Logging.ViewModels;
using Tango.MachineStudio.Logging.Views;
+using Tango.AutoComplete.Editors;
+using System.Data.Entity;
+using System.Runtime.ExceptionServices;
namespace Tango.MachineStudio.Developer.ViewModels
{
@@ -48,7 +51,8 @@ namespace Tango.MachineStudio.Developer.ViewModels
/// Represents the developer module main view, view model.
/// </summary>
/// <seealso cref="Tango.SharedUI.ViewModel" />
- public class MainViewVM : StudioViewModel<DeveloperModule>
+ [TangoCreateWhenRegistered]
+ public class MainViewVM : StudioViewModel
{
private static object _syncLock = new object();
private const string EMB_FORMATS_EXPORT = "Baby Lock (PES)|*.pes|Tajima (DST)|*.dst|EXP|*.exp|PCS|*.pcs|HUS|*.hus|KSM|*.ksm";
@@ -71,6 +75,7 @@ namespace Tango.MachineStudio.Developer.ViewModels
private bool _hiveOpened;
private bool _color_changed_from_hive;
private bool _dialog_shown;
+ private bool _disable_gamut_check;
#region Properties
@@ -104,16 +109,6 @@ namespace Tango.MachineStudio.Developer.ViewModels
set { _runningJobStatus = value; RaisePropertyChangedAuto(); }
}
- private ObservableCollection<Machine> _machines;
- /// <summary>
- /// Gets or sets the machines.
- /// </summary>
- public ObservableCollection<Machine> Machines
- {
- get { return _machines; }
- set { _machines = value; RaisePropertyChangedAuto(); }
- }
-
private ObservableCollection<ColorSpace> _colorSpaces;
/// <summary>
/// Gets or sets the color spaces.
@@ -173,19 +168,32 @@ namespace Tango.MachineStudio.Developer.ViewModels
get { return _selectedMachine; }
set
{
- _selectedMachine = value;
- OnSelectedMachineChanged();
- RaisePropertyChangedAuto();
- InvalidateRelayCommands();
-
- if (_selectedMachine != null)
+ if (value != null && _selectedMachine != value)
{
- _selectedMachine.Modified -= SelectedMachine_Modified;
- _selectedMachine.Modified += SelectedMachine_Modified;
+ _selectedMachine = value;
+ OnSelectedMachineChanged();
+ RaisePropertyChangedAuto();
+ InvalidateRelayCommands();
+
+ if (_selectedMachine != null)
+ {
+ _selectedMachine.Modified -= SelectedMachine_Modified;
+ _selectedMachine.Modified += SelectedMachine_Modified;
+ }
}
}
}
+ private bool _canWork;
+ /// <summary>
+ /// Gets or sets a value indicating whether this instance is loading machine.
+ /// </summary>
+ public bool CanWork
+ {
+ get { return _canWork; }
+ set { _canWork = value; RaisePropertyChangedAuto(); }
+ }
+
private List<LiquidTypesRml> _liquidTypesRmls;
/// <summary>
/// Gets or sets the liquid types RMLS.
@@ -248,7 +256,6 @@ namespace Tango.MachineStudio.Developer.ViewModels
{
_activeJob = value;
RaisePropertyChangedAuto();
- OnActiveJobChanged();
}
}
@@ -322,7 +329,7 @@ namespace Tango.MachineStudio.Developer.ViewModels
set
{
_selectedRML = value;
- InvalidateLiquidFactorsAndProcessTables();
+ OnSelectedRMLChanged();
RaisePropertyChangedAuto();
InvalidateRelayCommands();
}
@@ -504,6 +511,11 @@ namespace Tango.MachineStudio.Developer.ViewModels
set { _selectedJobEvent = value; RaisePropertyChangedAuto(); OnSelectedJobEventChanged(); }
}
+ /// <summary>
+ /// Gets or sets the machines providers.
+ /// </summary>
+ public ISuggestionProvider MachinesProvider { get; set; }
+
#endregion
#region Commands
@@ -643,28 +655,7 @@ namespace Tango.MachineStudio.Developer.ViewModels
/// <param name="notificationProvider">The notification provider.</param>
public MainViewVM(IStudioApplicationManager applicationManager, INotificationProvider notificationProvider, IDiagnosticsFrameProvider diagnosticsFrameProvider, IVideoCaptureProvider videoCaptureProvider, DeveloperNavigationManager navigation, IAuthenticationProvider authentication, IEventLogger eventLogger, ISpeechProvider speech)
{
- _settings = SettingsManager.Default.GetOrCreate<DeveloperModuleSettings>();
-
- SelectedJobs = new ObservableCollection<Job>();
-
- JobEvents = new ObservableCollection<MachinesEvent>();
-
- LogManager.Log("Initializing machine Db context...");
- _machineDbContext = ObservablesContext.CreateDefault();
-
- Machines = _machineDbContext.Machines.ToObservableCollection();
-
- if (_settings.LastSelectedMachineGuid != null)
- {
- LogManager.Log("Setting last selected machine from settings...");
- SelectedMachine = _machineDbContext.Machines.SingleOrDefault(x => x.Guid == _settings.LastSelectedMachineGuid);
- }
-
- if (_settings.LastSelectedJobGuid != null && SelectedMachine != null)
- {
- LogManager.Log("Setting last selected job from settings...");
- SelectedMachineJob = SelectedMachine.Jobs.SingleOrDefault(x => x.Guid == _settings.LastSelectedJobGuid);
- }
+ CanWork = true;
_authentication = authentication;
@@ -684,36 +675,76 @@ namespace Tango.MachineStudio.Developer.ViewModels
});
//Initialize Commands...
- EditMachineCommand = new RelayCommand(EditMachine, () => SelectedMachine != null);
- EditRMLCommand = new RelayCommand(EditRML, () => SelectedRML != null);
+ EditMachineCommand = new RelayCommand(EditMachine, () => SelectedMachine != null && CanWork);
+ EditRMLCommand = new RelayCommand(EditRML, () => SelectedRML != null && CanWork);
ToggleSideBarCommand = new RelayCommand(() => IsSideBarOpened = !IsSideBarOpened);
- SaveLiquidFactorsCommand = new RelayCommand(SaveLiquidFactors, () => SelectedRML != null);
- AddSegmentCommand = new RelayCommand(AddSegment, () => ActiveJob != null);
- RemoveSegmentCommand = new RelayCommand(RemoveSelectedSegments, () => SelectedSegment != null);
- AddJobCommand = new RelayCommand(AddJob, () => SelectedMachine != null);
- RemoveJobCommand = new RelayCommand(RemoveSelectedJobs, () => SelectedMachineJob != null);
- AddBrushStopCommand = new RelayCommand(AddBrushStop, () => SelectedSegment != null);
- RemoveBrushStopCommand = new RelayCommand(RemoveSelectedBrushStops, () => SelectedBrushStop != null);
- SaveJobCommand = new RelayCommand(SaveActiveJob, () => SelectedMachine != null);
- DiscardJobCommand = new RelayCommand(BackToJobs, () => SelectedMachine != null);
- StartJobCommand = new RelayCommand(StartJob, () => ActiveJob != null && !IsJobRunning && MachineOperator != null && !MachineOperator.MachineEventsStateProvider.Events.ToList().Exists(x => x.ActionTypes.Contains(BL.Enumerations.ActionTypes.PreventJobExecution)));
+ SaveLiquidFactorsCommand = new RelayCommand(SaveLiquidFactors, () => SelectedRML != null && CanWork);
+ AddSegmentCommand = new RelayCommand(AddSegment, () => ActiveJob != null && CanWork);
+ RemoveSegmentCommand = new RelayCommand(RemoveSelectedSegments, () => SelectedSegment != null && CanWork);
+ AddJobCommand = new RelayCommand(AddJob, () => SelectedMachine != null && CanWork);
+ RemoveJobCommand = new RelayCommand(RemoveSelectedJobs, () => SelectedMachineJob != null && CanWork);
+ AddBrushStopCommand = new RelayCommand(AddBrushStop, () => SelectedSegment != null && CanWork);
+ RemoveBrushStopCommand = new RelayCommand(RemoveSelectedBrushStops, () => SelectedBrushStop != null && CanWork);
+ SaveJobCommand = new RelayCommand(SaveActiveJob, () => SelectedMachine != null && CanWork);
+ DiscardJobCommand = new RelayCommand(BackToJobs, () => SelectedMachine != null && CanWork);
+ StartJobCommand = new RelayCommand(StartJob, () => ActiveJob != null && CanWork && !IsJobRunning && MachineOperator != null && !MachineOperator.MachineEventsStateProvider.Events.ToList().Exists(x => x.ActionTypes.Contains(BL.Enumerations.ActionTypes.PreventJobExecution)));
StartJobAndRecordCommand = new RelayCommand(StartJobAndRecord, () => _dataCaptureVM != null && !_dataCaptureVM.Recorder.IsRecording && !_dataCaptureVM.Player.IsPlaying && ActiveJob != null && !IsJobRunning && MachineOperator != null && !MachineOperator.MachineEventsStateProvider.Events.ToList().Exists(x => x.ActionTypes.Contains(BL.Enumerations.ActionTypes.PreventJobExecution)));
- StopJobCommand = new RelayCommand(StopJob, () => IsJobRunning);
+ StopJobCommand = new RelayCommand(StopJob, () => IsJobRunning && CanWork);
CloseJobCompletionStatusCommand = new RelayCommand(CloseJobCompletionStatusBar);
- LoadJobCommand = new RelayCommand(LoadSelectedJob, () => SelectedMachineJob != null);
- DuplicateJobCommand = new RelayCommand(DuplicateSelectedJobs, () => SelectedMachineJob != null);
- DuplicateSegmentCommand = new RelayCommand(DuplicateSelectedSegments, () => SelectedSegment != null);
- DuplicateBrushStopCommand = new RelayCommand(DuplicateSelectedBrushStops, () => SelectedBrushStop != null);
- SaveProcessParametersCommand = new RelayCommand(SaveProcessParameters, () => SelectedRML != null && SelectedRML.ProcessParametersTablesGroups.Count > 0);
- PushProcessParametersCommand = new RelayCommand(PushProcessParameters, () => SelectedRML != null && SelectedRML.ProcessParametersTablesGroups.Count > 0 && SelectedProcessParametersTable != null && MachineOperator != null);
- ImportEmbroideryFileCommand = new RelayCommand(ImportEmbroideryFile, () => SelectedMachine != null);
- DisplayJobEmbroideryFileCommand = new RelayCommand<Job>(DisplayJobEmbroideryFile);
- ReloadMachinesCommand = new RelayCommand(ReloadMachine);
+ LoadJobCommand = new RelayCommand(LoadSelectedJob, () => SelectedMachineJob != null && CanWork);
+ DuplicateJobCommand = new RelayCommand(DuplicateSelectedJobs, () => SelectedMachineJob != null && CanWork);
+ DuplicateSegmentCommand = new RelayCommand(DuplicateSelectedSegments, () => SelectedSegment != null && CanWork);
+ DuplicateBrushStopCommand = new RelayCommand(DuplicateSelectedBrushStops, () => SelectedBrushStop != null && CanWork);
+ SaveProcessParametersCommand = new RelayCommand(SaveProcessParameters, () => SelectedRML != null && CanWork && SelectedRML.ProcessParametersTablesGroups.Count > 0);
+ PushProcessParametersCommand = new RelayCommand(PushProcessParameters, () => SelectedRML != null && CanWork && SelectedRML.ProcessParametersTablesGroups.Count > 0 && SelectedProcessParametersTable != null && MachineOperator != null);
+ ImportEmbroideryFileCommand = new RelayCommand(ImportEmbroideryFile, () => SelectedMachine != null && CanWork);
+ DisplayJobEmbroideryFileCommand = new RelayCommand<Job>(DisplayJobEmbroideryFile, () => CanWork);
+ ReloadMachinesCommand = new RelayCommand(() => LoadMachine(), () => CanWork && SelectedMachine != null);
ApplicationManager.ConnectedMachineChanged += ApplicationManager_ConnectedMachineChanged;
_eventLogger.NewLog += _eventLogger_NewLog;
+
+ MachinesProvider = new SuggestionProvider((filter) =>
+ {
+ try
+ {
+ return _machineDbContext.Machines.Where(x => x.SerialNumber.StartsWith(filter)).ToList();
+ }
+ catch
+ {
+ return null;
+ }
+ });
+ }
+
+ #endregion
+
+ #region Application Ready
+
+ public override void OnApplicationReady()
+ {
+ _settings = SettingsManager.Default.GetOrCreate<DeveloperModuleSettings>();
+
+ SelectedJobs = new ObservableCollection<Job>();
+ JobEvents = new ObservableCollection<MachinesEvent>();
+
+ LogManager.Log("Initializing machine Db context...");
+ _machineDbContext = ObservablesContext.CreateDefault();
+
+ if (_settings.LastSelectedMachineGuid != null)
+ {
+ LogManager.Log("Setting last selected machine from settings...");
+ SelectedMachine = _machineDbContext.Machines.SingleOrDefault(x => x.Guid == _settings.LastSelectedMachineGuid);
+ }
+
+ if (_settings.LastSelectedJobGuid != null && SelectedMachine != null)
+ {
+ LogManager.Log("Setting last selected job from settings...");
+ SelectedMachineJob = SelectedMachine.Jobs.SingleOrDefault(x => x.Guid == _settings.LastSelectedJobGuid);
+ }
+
_colorConversionThread = new Thread(ColorConversionThreadMethod);
_colorConversionThread.IsBackground = true;
_colorConversionThread.Start();
@@ -723,37 +754,42 @@ namespace Tango.MachineStudio.Developer.ViewModels
#region Color Conversion
+ [HandleProcessCorruptedStateExceptions]
private void ColorConversionThreadMethod()
{
while (true)
{
- if (IsVisible && ActiveJob != null && ActiveJob.Segments != null)
+ if (!_disable_gamut_check && IsVisible && ActiveJob != null && ActiveJob.Segments != null)
{
- var stops = ActiveJob.Segments.SelectMany(x => x.BrushStops).ToList();
-
- foreach (var stop in stops)
+ try
{
- if (stop.ColorSpace.Code == BL.Enumerations.ColorSpaces.Volume.ToInt32() && !stop.IsLiquidVolumesOutOfRange)
+ var stops = ActiveJob.Segments.SelectMany(x => x.BrushStops).ToList();
+
+ foreach (var stop in stops)
{
- try
+ if (stop.ColorSpace.Code == BL.Enumerations.ColorSpaces.Volume.ToInt32() && !stop.IsLiquidVolumesOutOfRange)
{
- var output = TangoColorConverter.GetSuggestions(stop);
+ try
+ {
+ var output = TangoColorConverter.GetSuggestions(stop);
- stop.Red = output.SingleCoordinates.Red;
- stop.Green = output.SingleCoordinates.Green;
- stop.Blue = output.SingleCoordinates.Blue;
+ stop.Red = output.SingleCoordinates.Red;
+ stop.Green = output.SingleCoordinates.Green;
+ stop.Blue = output.SingleCoordinates.Blue;
+ }
+ catch { }
}
- catch { }
- }
- else if (stop.ColorSpace.Code == BL.Enumerations.ColorSpaces.RGB.ToInt32() && !stop.Corrected)
- {
- try
+ else if (stop.ColorSpace.Code == BL.Enumerations.ColorSpaces.RGB.ToInt32() && !stop.Corrected)
{
- stop.IsOutOfGamut = TangoColorConverter.IsOutOfGamut(stop);
+ try
+ {
+ stop.IsOutOfGamut = TangoColorConverter.IsOutOfGamut(stop);
+ }
+ catch { }
}
- catch { }
}
}
+ catch { }
}
Thread.Sleep(500);
@@ -950,9 +986,12 @@ namespace Tango.MachineStudio.Developer.ViewModels
if (RmlProcessParametersTableGroup != null && RmlProcessParametersTableGroup.ProcessParametersTables.Count > 0)
{
LogManager.Log("Process parameters group changed...");
- SelectedProcessParametersTable = RmlProcessParametersTableGroup.ProcessParametersTables.OrderBy(x => x.TableIndex).FirstOrDefault();
- UpdateEstimatedDuration();
+ InvokeUI(() =>
+ {
+ SelectedProcessParametersTable = RmlProcessParametersTableGroup.ProcessParametersTables.OrderBy(x => x.TableIndex).FirstOrDefault();
+ UpdateEstimatedDuration();
+ });
}
}
@@ -992,9 +1031,7 @@ namespace Tango.MachineStudio.Developer.ViewModels
if (SelectedMachine != null)
{
LogManager.Log(String.Format("Machine {0} changed.", SelectedMachine.SerialNumber));
- ReloadMachine();
- JobsCollectionView = CollectionViewSource.GetDefaultView(SelectedMachine.Jobs);
- JobsCollectionView.SortDescriptions.Add(new SortDescription(nameof(Job.LastUpdated), ListSortDirection.Descending));
+ LoadMachine();
}
}
@@ -1018,19 +1055,6 @@ namespace Tango.MachineStudio.Developer.ViewModels
};
}
- /// <summary>
- /// Called when the active job has changed.
- /// </summary>
- protected virtual void OnActiveJobChanged()
- {
- if (ActiveJob != null)
- {
- LogManager.Log(String.Format("Active job {0} changed.", ActiveJob.Name));
- SegmentsCollectionView = CollectionViewSource.GetDefaultView(ActiveJob.Segments);
- SegmentsCollectionView.SortDescriptions.Add(new SortDescription(nameof(Segment.SegmentIndex), ListSortDirection.Ascending));
- }
- }
-
#endregion
#region Drag & Drop
@@ -1297,12 +1321,21 @@ namespace Tango.MachineStudio.Developer.ViewModels
{
if (SelectedRML != null)
{
+ CanWork = false;
+
using (_notification.PushTaskItem("Saving Liquid Factors..."))
{
LogManager.Log(String.Format("Saving liquid factors for RML {0}...", SelectedRML.Name));
await SelectedRML.SaveAsync(_activeJobDbContext);
- InvalidateLiquidFactorsAndProcessTables();
+ LiquidTypesRmls = ActiveJob.Machine.Configuration.NoneEmptyIdsPacks.Where(x => !x.IsEmpty).OrderBy(x => x.PackIndex).Select(x => x.LiquidType).SelectMany(x => x.LiquidTypesRmls).Where(x => x.Rml.Guid == SelectedRML.Guid).ToList();
+
+ if (SelectedSegment != null)
+ {
+ SetSegmentBrushStopsLiquidVolumes(SelectedSegment);
+ }
}
+
+ CanWork = true;
}
}
@@ -1312,7 +1345,6 @@ namespace Tango.MachineStudio.Developer.ViewModels
private void EditRML()
{
LogManager.Log(String.Format("Requesting DB module for RML {0} editing...", SelectedRML.Name));
- ApplicationManager.RequestModule("Data Base", SelectedRML);
}
/// <summary>
@@ -1323,7 +1355,10 @@ namespace Tango.MachineStudio.Developer.ViewModels
if (SelectedRML != null && SelectedMachine != null)
{
LogManager.Log("Invalidating liquid factors, process parameters and process group history...");
- LiquidTypesRmls = SelectedMachine.Configuration.NoneEmptyIdsPacks.Where(x => !x.IsEmpty).OrderBy(x => x.PackIndex).Select(x => x.LiquidType).SelectMany(x => x.LiquidTypesRmls).Where(x => x.Rml.Guid == SelectedRML.Guid).ToList();
+ LiquidTypesRmls = ActiveJob.Machine.Configuration.NoneEmptyIdsPacks.Where(x => !x.IsEmpty).OrderBy(x => x.PackIndex).Select(x => x.LiquidType).SelectMany(x => x.LiquidTypesRmls).Where(x => x.Rml.Guid == SelectedRML.Guid).ToList();
+
+ _activeJobDbContext.ProcessParametersTablesGroups.Where(x => x.RmlGuid == SelectedRML.Guid).Include(x => x.ProcessParametersTables).ToList();
+
RmlProcessParametersTableGroup = SelectedRML.ProcessParametersTablesGroups.ToList().SingleOrDefault(x => x.Active);
var selectedHistory = RmlProcessParametersTableGroup;
@@ -1334,11 +1369,26 @@ namespace Tango.MachineStudio.Developer.ViewModels
RmlProcessParametersTableGroup.ProcessParametersTables = RmlProcessParametersTableGroup.ProcessParametersTables.OrderBy(x => x.TableIndex).ToObservableCollection();
}
- GroupsHistory = SelectedRML.ProcessParametersTablesGroups.OrderByDescending(x => x.SaveDate).OrderBy(x => !x.Active).ToObservableCollection();
+ GroupsHistory = SelectedRML.ProcessParametersTablesGroups.OrderByDescending(x => x.SaveDate).OrderBy(x => !x.Active).ToObservableCollection();
_selectedGroupHistory = selectedHistory;
- RaisePropertyChangedAuto(nameof(SelectedGroupHistory));
+ InvokeUI(() =>
+ {
+ RaisePropertyChanged(nameof(SelectedGroupHistory));
+ RaisePropertyChanged(nameof(RmlProcessParametersTableGroup));
+ });
+ }
+ }
+
+ private async void OnSelectedRMLChanged()
+ {
+ using (_notification.PushTaskItem("Loading RML..."))
+ {
+ await Task.Factory.StartNew(() =>
+ {
+ InvalidateLiquidFactorsAndProcessTables();
+ });
}
}
@@ -1375,6 +1425,8 @@ namespace Tango.MachineStudio.Developer.ViewModels
if (response == null) return;
+ CanWork = false;
+
using (_notification.PushTaskItem("Saving Parameters Group..."))
{
LogManager.Log(String.Format("Saving process parameters group under the name {0}...", response));
@@ -1408,6 +1460,8 @@ namespace Tango.MachineStudio.Developer.ViewModels
InvalidateLiquidFactorsAndProcessTables();
}
+
+ CanWork = true;
}
#endregion
@@ -1417,84 +1471,138 @@ namespace Tango.MachineStudio.Developer.ViewModels
/// <summary>
/// Loads the selected job.
/// </summary>
- private void LoadSelectedJob()
+ private async void LoadSelectedJob()
{
if (SelectedMachineJob != null)
{
+ CanWork = false;
+
using (_notification.PushTaskItem("Loading job details..."))
{
- LogManager.Log(String.Format("Loading job {0}...", SelectedMachineJob.Name));
- SelectedSegments = new ObservableCollection<Segment>();
- SelectedBrushStops = new ObservableCollection<BrushStop>();
- SelectedRML = null;
- SelectedSegment = null;
- SelectedGroupHistory = null;
- SelectedBrushStop = null;
- SelectedProcessParametersTable = null;
- RmlProcessParametersTableGroup = null;
+ await Task.Factory.StartNew(() =>
+ {
+ _disable_gamut_check = true;
+ LogManager.Log(String.Format("Loading job {0}...", SelectedMachineJob.Name));
+ SelectedSegments = new ObservableCollection<Segment>();
+ SelectedBrushStops = new ObservableCollection<BrushStop>();
+ SelectedRML = null;
+ SelectedSegment = null;
+ SelectedGroupHistory = null;
+ SelectedBrushStop = null;
+ SelectedProcessParametersTable = null;
+ RmlProcessParametersTableGroup = null;
- _blockInvalidateCommands = false;
+ _blockInvalidateCommands = false;
- LogManager.Log("Creating active job DB context...");
- _activeJobDbContext = ObservablesContext.CreateDefault();
- _activeJobDbContext.Configuration.LazyLoadingEnabled = true;
+ LogManager.Log("Creating active job DB context...");
+ _activeJobDbContext = ObservablesContext.CreateDefault();
- LogManager.Log("Initializing available color spaces, RMLs & Winding methods...");
- var processParamsGroups = _activeJobDbContext.ProcessParametersTablesGroups.ToList();
- var processParams = _activeJobDbContext.ProcessParametersTables.ToList();
- ColorSpaces = _activeJobDbContext.ColorSpaces.ToObservableCollection();
- Rmls = _activeJobDbContext.Rmls.ToObservableCollection();
- WindingMethods = _activeJobDbContext.WindingMethods.ToObservableCollection();
- SpoolTypes = _activeJobDbContext.SpoolTypes.ToObservableCollection();
+ LogManager.Log("Initializing available color spaces, RMLs & Winding methods...");
+ //var processParamsGroups = _activeJobDbContext.ProcessParametersTablesGroups.ToList();
+ //var processParams = _activeJobDbContext.ProcessParametersTables.ToList();
- LogManager.Log("Setting active job...");
- _activeJob = _activeJobDbContext.Jobs.SingleOrDefault(x => x.Guid == SelectedMachineJob.Guid);
+ ColorSpaces = _activeJobDbContext.ColorSpaces.ToObservableCollection();
+ Rmls = _activeJobDbContext.Rmls.ToObservableCollection();
+ WindingMethods = _activeJobDbContext.WindingMethods.ToObservableCollection();
+ SpoolTypes = _activeJobDbContext.SpoolTypes.ToObservableCollection();
- _selectedRML = ActiveJob.Rml;
+ LogManager.Log("Setting active job...");
+ ActiveJob = _activeJobDbContext.Jobs.Include(x => x.Rml).Include(x => x.Segments).Include(x => x.Segments.Select(y => y.BrushStops)).SingleOrDefault(x => x.Guid == SelectedMachineJob.Guid);
- LogManager.Log("Setting selected segment...");
- _selectedSegment = ActiveJob.Segments.FirstOrDefault();
+ _activeJobDbContext.Ccts.Where(x => x.RmlGuid == ActiveJob.RmlGuid).ToList();
+ _activeJobDbContext.Cats.Where(x => x.RmlGuid == ActiveJob.RmlGuid).ToList();
+ _activeJobDbContext.Machines.SingleOrDefault(x => x.Guid == ActiveJob.MachineGuid);
+ _activeJobDbContext.Configurations.SingleOrDefault(x => x.Guid == ActiveJob.Machine.ConfigurationGuid);
- ActiveJob.LengthChanged -= ActiveJob_LengthChanged;
- ActiveJob.LengthChanged += ActiveJob_LengthChanged;
+ _activeJobDbContext.LiquidTypesRmls.ToList();
- ActiveJob = _activeJob;
+ _activeJobDbContext.IdsPackFormulas.ToList();
+ _activeJobDbContext.LiquidTypes.ToList();
+ _activeJobDbContext.MidTankTypes.ToList();
+ _activeJobDbContext.DispenserTypes.ToList();
- SelectedRML = _selectedRML;
- SelectedSegment = _selectedSegment;
+ _activeJobDbContext.IdsPacks.Where(x => x.ConfigurationGuid == ActiveJob.Machine.ConfigurationGuid).ToList();
- UpdateEstimatedDuration();
- _blockInvalidateCommands = false;
- InvalidateRelayCommands();
+
+ LogManager.Log("Setting selected segment...");
+ _selectedSegment = ActiveJob.Segments.FirstOrDefault();
+
+ ActiveJob.LengthChanged -= ActiveJob_LengthChanged;
+ ActiveJob.LengthChanged += ActiveJob_LengthChanged;
+
+ _selectedRML = ActiveJob.Rml;
+ InvalidateLiquidFactorsAndProcessTables();
+ RaisePropertyChanged(nameof(SelectedRML));
+
+ UpdateEstimatedDuration();
+
+ _blockInvalidateCommands = false;
+ InvalidateRelayCommands();
+
+ _disable_gamut_check = false;
+ });
+
+ SegmentsCollectionView = CollectionViewSource.GetDefaultView(ActiveJob.Segments);
+ SegmentsCollectionView.SortDescriptions.Add(new SortDescription(nameof(Segment.SegmentIndex), ListSortDirection.Ascending));
+
+ SelectedSegment = _selectedSegment;
UIHelper.DoEvents();
_navigation.NavigateTo(DeveloperNavigationView.JobView);
-
}
+
+ CanWork = true;
}
}
/// <summary>
/// Saves the active job.
/// </summary>
- private void SaveActiveJob()
+ private async void SaveActiveJob()
{
if (ActiveJob != null)
{
+ CanWork = false;
+
using (_notification.PushTaskItem("Saving job details..."))
{
- LogManager.Log(String.Format("Saving the active job {0}...", ActiveJob.Name));
- ActiveJob.LastUpdated = DateTime.UtcNow;
- ActiveJob.Rml = SelectedRML;
- ActiveJob.EstimatedDurationMili = (int)EstimatedDuration.TotalMilliseconds;
+ await Task.Factory.StartNew(() =>
+ {
+ LogManager.Log(String.Format("Saving the active job {0}...", ActiveJob.Name));
+ ActiveJob.LastUpdated = DateTime.UtcNow;
+ ActiveJob.Rml = SelectedRML;
+ ActiveJob.EstimatedDurationMili = (int)EstimatedDuration.TotalMilliseconds;
+ _activeJobDbContext.SaveChanges();
+
+ _machineDbContext.Entry(SelectedMachineJob).Reload();
+
+
+ _machineDbContext.Entry(SelectedMachineJob).Collection(x => x.Segments).Load();
+
+ foreach (var segment in SelectedMachineJob.Segments.ToList())
+ {
+ _machineDbContext.Entry(segment).Collection(x => x.BrushStops).Load();
- _activeJobDbContext.SaveChanges();
- ReloadMachine();
- SelectedMachineJob = SelectedMachine.Jobs.SingleOrDefault(x => x.Guid == ActiveJob.Guid);
+ foreach (var brushStop in segment.BrushStops.ToList())
+ {
+ _machineDbContext.Entry(brushStop).Reload();
+ }
+
+ _machineDbContext.Entry(segment).Reload();
+ }
+
+ InvokeUI(() =>
+ {
+ SelectedMachineJob.Segments = SelectedMachineJob.Segments;
+ });
+
+ });
}
+
+ CanWork = true;
}
}
@@ -1527,19 +1635,51 @@ namespace Tango.MachineStudio.Developer.ViewModels
#region Private Methods
- private void ReloadMachine()
+ private async void LoadMachine()
{
- LogManager.Log("Reloading selected machine...");
- _machineDbContext.Dispose();
- _machineDbContext = ObservablesContext.CreateDefault();
- _machineDbContext.Configuration.LazyLoadingEnabled = true;
- String machineGuid = _selectedMachine.Guid;
- Machines = _machineDbContext.Machines.ToObservableCollection();
- _selectedMachine = Machines.SingleOrDefault(x => x.Guid == machineGuid);
- RaisePropertyChanged(nameof(SelectedMachine));
+ try
+ {
+ LogManager.Log("Loading selected machine...");
+
+ CanWork = false;
+
+ using (_notification.PushTaskItem("Loading selected machine..."))
+ {
+ await _machineDbContext.Jobs.Where(x => x.MachineGuid == SelectedMachine.Guid).Include(x => x.User).Include(x => x.User.Contact).LoadAsync();
+ await _machineDbContext.Configurations.SingleOrDefaultAsync(x => x.Guid == SelectedMachine.ConfigurationGuid);
+
+ await _machineDbContext.ColorSpaces.LoadAsync();
+
+ SelectedMachine.Configuration.IdsPacks.EnableCrossThreadOperations();
+
+ await _machineDbContext.IdsPacks.OrderBy(x => x.PackIndex).Where(x => x.ConfigurationGuid == SelectedMachine.ConfigurationGuid).
+ Include(x => x.CartridgeType).
+ Include(x => x.DispenserType).
+ Include(x => x.LiquidType).
+ Include(x => x.IdsPackFormula).
+ Include(x => x.MidTankType).LoadAsync();
+
+ RaisePropertyChanged(nameof(SelectedMachine));
+
+ JobsCollectionView = CollectionViewSource.GetDefaultView(SelectedMachine.Jobs);
+ JobsCollectionView.SortDescriptions.Add(new SortDescription(nameof(Job.LastUpdated), ListSortDirection.Descending));
+ }
- JobsCollectionView = CollectionViewSource.GetDefaultView(SelectedMachine.Jobs);
- JobsCollectionView.SortDescriptions.Add(new SortDescription(nameof(Job.LastUpdated), ListSortDirection.Descending));
+ CanWork = true;
+
+ foreach (var job in SelectedMachine.Jobs.OrderByDescending(x => x.LastUpdated))
+ {
+ if (!CanWork) break;
+ job.Segments.EnableCrossThreadOperations();
+ await _machineDbContext.Segments.Where(x => x.JobGuid == job.Guid).Include(x => x.BrushStops).OrderBy(x => x.SegmentIndex).LoadAsync();
+ }
+ }
+ catch (Exception ex)
+ {
+ LogManager.Log(ex);
+ _notification.ShowError("An error occurred while trying to load the selected machine.");
+ CanWork = true;
+ }
}
private void UpdateEstimatedDuration()
@@ -1557,7 +1697,7 @@ namespace Tango.MachineStudio.Developer.ViewModels
LogManager.Log("Setting segment brush stops liquid volumes...");
foreach (var stop in segment.BrushStops)
{
- stop.SetLiquidVolumes(SelectedMachine.Configuration, SelectedRML, SelectedProcessParametersTable);
+ stop.SetLiquidVolumes(ActiveJob.Machine.Configuration, SelectedRML, SelectedProcessParametersTable);
}
}
}
@@ -1568,7 +1708,6 @@ namespace Tango.MachineStudio.Developer.ViewModels
private void EditMachine()
{
LogManager.Log(String.Format("Requesting machine designer module for machine {0} editing...", SelectedMachine.SerialNumber));
- ApplicationManager.RequestModule("Machine Designer", SelectedMachine);
}
#endregion
@@ -1713,14 +1852,15 @@ namespace Tango.MachineStudio.Developer.ViewModels
newJob.Rml = _machineDbContext.Rmls.FirstOrDefault();
newJob.WindingMethod = _machineDbContext.WindingMethods.FirstOrDefault();
newJob.SpoolType = _machineDbContext.SpoolTypes.FirstOrDefault();
+ newJob.ColorSpace = _machineDbContext.ColorSpaces.FirstOrDefault();
newJob.Machine = SelectedMachine;
SelectedMachine.Jobs.Add(newJob);
+ newJob.AddSolidSegment();
LogManager.Log("Saving selected machine to database...");
await SelectedMachine.SaveAsync(_machineDbContext);
SelectedMachineJob = newJob;
LoadSelectedJob();
- AddSegment();
}
}
}
@@ -1769,7 +1909,7 @@ namespace Tango.MachineStudio.Developer.ViewModels
stop.OffsetPercent = 100;
stop.Segment = SelectedSegment;
- stop.ColorSpace = _activeJobDbContext.ColorSpaces.FirstOrDefault();
+ stop.ColorSpace = ColorSpaces.FirstOrDefault();
stop.Color = Colors.Black;
stop.SetLiquidVolumes(SelectedMachine.Configuration, SelectedRML, SelectedProcessParametersTable);
SelectedSegment.BrushStops.Add(stop);
@@ -1821,6 +1961,8 @@ namespace Tango.MachineStudio.Developer.ViewModels
{
using (_notification.PushTaskItem("Cloning selected jobs..."))
{
+ CanWork = false;
+
LogManager.LogFormat("Duplicating {0} jobs...", SelectedJobs.Count);
int index = SelectedMachine.Jobs.Max(x => x.JobIndex);
@@ -1834,6 +1976,8 @@ namespace Tango.MachineStudio.Developer.ViewModels
LogManager.Log("Saving selected machine to database...");
await SelectedMachine.SaveAsync(_machineDbContext);
+
+ CanWork = true;
}
}
}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml
index 1b96b27ce..016718075 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml
@@ -11,11 +11,9 @@
xmlns:hive="clr-namespace:Tango.Hive;assembly=Tango.Hive"
xmlns:automation="clr-namespace:Tango.MachineStudio.Common.Automation;assembly=Tango.MachineStudio.Common"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
- xmlns:techViews="clr-namespace:Tango.MachineStudio.Technician.Views;assembly=Tango.MachineStudio.Technician"
xmlns:colorPicker="clr-namespace:Tango;assembly=Tango.ColorPicker"
xmlns:dispensing="clr-namespace:Tango.BL.Dispensing;assembly=Tango.BL"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
- xmlns:db="clr-namespace:Tango.MachineStudio.DB.Views.DBViews;assembly=Tango.MachineStudio.DB"
xmlns:commonControls="clr-namespace:Tango.MachineStudio.Common.Controls;assembly=Tango.MachineStudio.Common"
xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI"
xmlns:designer="clr-namespace:Tango.MachineStudio.MachineDesigner.Views;assembly=Tango.MachineStudio.MachineDesigner"
@@ -1495,9 +1493,9 @@
</Grid>
</Grid>
</Expander>
- <Expander Header="CONTROL PARAMETERS" IsExpanded="False" Background="#8EFFFFFF">
+ <!--<Expander Header="CONTROL PARAMETERS" IsExpanded="False" Background="#8EFFFFFF">
- </Expander>
+ </Expander>-->
</StackPanel>
</ScrollViewer>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml.cs
index bb17a502d..2942d36af 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml.cs
@@ -64,7 +64,7 @@ namespace Tango.MachineStudio.Developer.Views
if (_vm != null && _vm.ActiveJob != null)
{
List<Segment> segments = new List<Segment>();
- foreach (var s in _vm.ActiveJob.Segments)
+ foreach (var s in _vm.ActiveJob.Segments.OrderBy(x => x.SegmentIndex))
{
segments.Add(s);
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MachineJobSelectionView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MachineJobSelectionView.xaml
index c151b62bc..279a9daf3 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MachineJobSelectionView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MachineJobSelectionView.xaml
@@ -6,6 +6,7 @@
xmlns:global="clr-namespace:Tango.MachineStudio.Developer"
xmlns:designer="clr-namespace:Tango.MachineStudio.MachineDesigner.Views;assembly=Tango.MachineStudio.MachineDesigner"
xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls"
+ xmlns:autoComplete="clr-namespace:Tango.AutoComplete.Editors;assembly=Tango.AutoComplete"
xmlns:automation="clr-namespace:Tango.MachineStudio.Common.Automation;assembly=Tango.MachineStudio.Common"
xmlns:localConverters="clr-namespace:Tango.MachineStudio.Developer.Converters"
xmlns:vm="clr-namespace:Tango.MachineStudio.Developer.ViewModels"
@@ -13,6 +14,7 @@
xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI"
xmlns:observables="clr-namespace:Tango.BL.Entities;assembly=Tango.BL"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:commonControls="clr-namespace:Tango.MachineStudio.Common.Controls;assembly=Tango.MachineStudio.Common"
xmlns:local="clr-namespace:Tango.MachineStudio.Developer.Views"
mc:Ignorable="d"
x:Name="control" d:DesignHeight="1080" d:DesignWidth="1920" Background="Transparent" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}">
@@ -23,6 +25,7 @@
<localConverters:MillisecondsToTimeSpanConverter x:Key="MillisecondsToTimeSpanConverter" />
<converters:GreaterThanToBooleanConverter x:Key="GreaterThanToBooleanConverter" />
<converters:MathOperatorConverter x:Key="MathOperatorConverter" />
+ <converters:BooleanInverseConverter x:Key="BooleanInverseConverter" />
</UserControl.Resources>
<Grid>
@@ -36,20 +39,20 @@
<StackPanel>
<TextBlock Margin="40 20" FontSize="30" FontWeight="SemiBold" FontStyle="Italic">TARGET MACHINE</TextBlock>
- <DockPanel Margin="40 0 40 0">
+ <DockPanel Margin="40 0 40 0" IsEnabled="{Binding CanWork}">
<Button Command="{Binding ReloadMachinesCommand}" DockPanel.Dock="Right" ToolTip="Reload" Foreground="#404040" Margin="20 0 0 0" Padding="0" Width="40" Height="Auto" Style="{StaticResource MaterialDesignFlatButton}">
<materialDesign:PackIcon Kind="Refresh" Width="24" Height="24" />
</Button>
- <ComboBox ItemsSource="{Binding Machines}" FontSize="20" SelectedItem="{Binding SelectedMachine}" materialDesign:HintAssist.Hint="Serial Number">
- <ComboBox.ItemTemplate>
+ <autoComplete:AutoCompleteTextBox Provider="{Binding MachinesProvider}" LoadingContent="Loading..." FontSize="20" SelectedItem="{Binding SelectedMachine,Mode=TwoWay}" materialDesign:HintAssist.Hint="Serial Number" DisplayMember="SerialNumber">
+ <autoComplete:AutoCompleteTextBox.ItemTemplate>
<DataTemplate>
<StackPanel>
<TextBlock Text="{Binding SerialNumber}" FontWeight="Bold" FontStyle="Italic"></TextBlock>
<TextBlock FontSize="11" Text="{Binding Name}" Foreground="Gray"></TextBlock>
</StackPanel>
</DataTemplate>
- </ComboBox.ItemTemplate>
- </ComboBox>
+ </autoComplete:AutoCompleteTextBox.ItemTemplate>
+ </autoComplete:AutoCompleteTextBox>
</DockPanel>
<designer:MachineView Width="600" IsHitTestVisible="False" Margin="0 40 0 0" DataContext="{Binding SelectedMachine}" />
<Button Command="{Binding EditMachineCommand}" HorizontalAlignment="Right" Margin="0 10 20 20" Style="{StaticResource MaterialDesignFlatButton}">
@@ -127,141 +130,139 @@
</Grid>
<Grid Margin="0 20 0 0">
- <controls:MultiSelectDataGrid MouseDoubleClick="MultiSelectDataGrid_MouseDoubleClick" AutomationProperties.AutomationId="{x:Static automation:Developer.JobsDataGrid}" Style="{StaticResource {x:Type DataGrid}}" CanUserAddRows="False" CanUserDeleteRows="False" CanUserResizeColumns="True" CanUserSortColumns="True" AutoGenerateColumns="False" Background="Transparent" ItemsSource="{Binding JobsCollectionView}" SelectedItem="{Binding SelectedMachineJob}" SelectedItemsList="{Binding SelectedJobs,Mode=TwoWay}">
- <DataGrid.CellStyle>
- <Style TargetType="DataGridCell" BasedOn="{StaticResource {x:Type DataGridCell}}">
- <Setter Property="BorderThickness" Value="0"/>
- <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
- <Setter Property="VerticalContentAlignment" Value="Center"></Setter>
- </Style>
- </DataGrid.CellStyle>
- <DataGrid.Columns>
- <DataGridTemplateColumn>
- <DataGridTemplateColumn.CellTemplate>
- <DataTemplate DataType="{x:Type observables:Job}">
- <ContentControl>
- <ContentControl.Style>
- <Style TargetType="ContentControl">
- <Setter Property="Content">
- <Setter.Value>
- <Image Source="../Images/rgb.png" Width="40" Margin="5"></Image>
- </Setter.Value>
- </Setter>
- <Style.Triggers>
- <DataTrigger Binding="{Binding HasEmbroideryFile}" Value="True">
- <Setter Property="Content">
- <Setter.Value>
- <Button ToolTip="Press to display the attached embroidery file information" Style="{StaticResource emptyButton}" Cursor="Hand" Command="{Binding DataContext.DisplayJobEmbroideryFileCommand, Source={x:Reference control}}" CommandParameter="{Binding}">
- <Image Source="../Images/job-emb.png" Width="40" Margin="5"></Image>
- </Button>
- </Setter.Value>
- </Setter>
- </DataTrigger>
- </Style.Triggers>
- </Style>
- </ContentControl.Style>
- </ContentControl>
- </DataTemplate>
- </DataGridTemplateColumn.CellTemplate>
- </DataGridTemplateColumn>
- <DataGridTemplateColumn Header="NAME" CanUserSort="True" SortMemberPath="Name">
- <DataGridTemplateColumn.CellTemplate>
- <DataTemplate>
- <TextBlock Text="{Binding Name}" VerticalAlignment="Center" FontSize="14"></TextBlock>
- </DataTemplate>
- </DataGridTemplateColumn.CellTemplate>
- </DataGridTemplateColumn>
- <DataGridTemplateColumn Header="CREATION DATE" Width="150" CanUserSort="True" SortMemberPath="CreationDate">
- <DataGridTemplateColumn.CellTemplate>
- <DataTemplate>
- <TextBlock Text="{Binding CreationDate,Converter={StaticResource DateTimeUTCToShortDateTimeConverter}}" VerticalAlignment="Center" FontSize="14"></TextBlock>
- </DataTemplate>
- </DataGridTemplateColumn.CellTemplate>
- </DataGridTemplateColumn>
- <DataGridTemplateColumn Header="LAST MODIFIED" Width="150" CanUserSort="True" SortMemberPath="LastUpdated">
- <DataGridTemplateColumn.CellTemplate>
- <DataTemplate>
- <TextBlock Text="{Binding LastUpdated,Converter={StaticResource DateTimeUTCToShortDateTimeConverter}}" VerticalAlignment="Center" FontSize="14"></TextBlock>
- </DataTemplate>
- </DataGridTemplateColumn.CellTemplate>
- </DataGridTemplateColumn>
- <DataGridTemplateColumn Header="LAST RUN" Width="150" CanUserSort="True" SortMemberPath="LastRun">
- <DataGridTemplateColumn.CellTemplate>
- <DataTemplate>
- <TextBlock Text="{Binding LastRun,Converter={StaticResource DateTimeUTCToShortDateTimeConverter},FallbackValue='Never',TargetNullValue='Never'}" VerticalAlignment="Center" FontSize="14"></TextBlock>
- </DataTemplate>
- </DataGridTemplateColumn.CellTemplate>
- </DataGridTemplateColumn>
- <DataGridTemplateColumn Header="USER" Width="100" CanUserSort="True" SortMemberPath="User">
- <DataGridTemplateColumn.CellTemplate>
- <DataTemplate>
- <TextBlock Text="{Binding User.Contact.FirstName}" VerticalAlignment="Center" FontSize="14"></TextBlock>
- </DataTemplate>
- </DataGridTemplateColumn.CellTemplate>
- </DataGridTemplateColumn>
- <DataGridTemplateColumn Header="LENGTH" Width="100" CanUserSort="True" SortMemberPath="Length">
- <DataGridTemplateColumn.CellTemplate>
- <DataTemplate>
- <TextBlock VerticalAlignment="Center" FontSize="14">
- <Run Text="{Binding Length,Mode=OneWay,StringFormat=N2}"></Run>
- <Run Text="m" Foreground="Gray"></Run>
- </TextBlock>
- </DataTemplate>
- </DataGridTemplateColumn.CellTemplate>
- </DataGridTemplateColumn>
- <DataGridTemplateColumn Header="DURATION" Width="100" CanUserSort="True" SortMemberPath="EstimatedDurationMili">
- <DataGridTemplateColumn.CellTemplate>
- <DataTemplate>
- <TextBlock VerticalAlignment="Center" FontSize="14">
- <Run Text="{Binding EstimatedDurationMili,Converter={StaticResource MillisecondsToTimeSpanConverter},Mode=OneWay,StringFormat=hh\\:mm\\:ss,TargetNullValue='Unknown'}"></Run>
- </TextBlock>
- </DataTemplate>
- </DataGridTemplateColumn.CellTemplate>
- </DataGridTemplateColumn>
- <DataGridTemplateColumn Width="1*" Header="SEGMENTS" CanUserSort="True" SortMemberPath="Segments.Count">
- <DataGridTemplateColumn.CellTemplate>
- <DataTemplate>
- <StackPanel Orientation="Horizontal">
- <ItemsControl HorizontalAlignment="Right" ItemsSource="{Binding Segments}">
- <ItemsControl.ItemsPanel>
- <ItemsPanelTemplate>
- <StackPanel Orientation="Horizontal" HorizontalAlignment="Left" MaxWidth="110">
-
- </StackPanel>
- </ItemsPanelTemplate>
- </ItemsControl.ItemsPanel>
- <ItemsControl.ItemTemplate>
- <DataTemplate>
- <Border Width="25" Height="25" Margin="10 0 0 0" BorderThickness="1" BorderBrush="DimGray" CornerRadius="3">
- <Border.Background>
- <MultiBinding Converter="{StaticResource SegmentToBrushConverterMulti}">
- <Binding Path="."></Binding>
- </MultiBinding>
- </Border.Background>
- </Border>
- </DataTemplate>
- </ItemsControl.ItemTemplate>
- </ItemsControl>
- <StackPanel Orientation="Horizontal" Margin="0 0 0 0" VerticalAlignment="Center">
- <StackPanel.Style>
- <Style TargetType="StackPanel">
- <Setter Property="Visibility" Value="Collapsed"></Setter>
+ <commonControls:LoadingPanel IsLoading="{Binding CanWork,Converter={StaticResource BooleanInverseConverter}}">
+ <controls:MultiSelectDataGrid MouseDoubleClick="MultiSelectDataGrid_MouseDoubleClick" AutomationProperties.AutomationId="{x:Static automation:Developer.JobsDataGrid}" Style="{StaticResource {x:Type DataGrid}}" CanUserAddRows="False" CanUserDeleteRows="False" CanUserResizeColumns="True" CanUserSortColumns="True" AutoGenerateColumns="False" Background="Transparent" ItemsSource="{Binding JobsCollectionView}" SelectedItem="{Binding SelectedMachineJob}" SelectedItemsList="{Binding SelectedJobs,Mode=TwoWay}">
+ <DataGrid.CellStyle>
+ <Style TargetType="DataGridCell" BasedOn="{StaticResource {x:Type DataGridCell}}">
+ <Setter Property="BorderThickness" Value="0"/>
+ <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
+ <Setter Property="VerticalContentAlignment" Value="Center"></Setter>
+ </Style>
+ </DataGrid.CellStyle>
+ <DataGrid.Columns>
+ <DataGridTemplateColumn>
+ <DataGridTemplateColumn.CellTemplate>
+ <DataTemplate DataType="{x:Type observables:Job}">
+ <ContentControl>
+ <ContentControl.Style>
+ <Style TargetType="ContentControl">
+ <Setter Property="Content">
+ <Setter.Value>
+ <Image Source="../Images/rgb.png" Width="40" Margin="5"></Image>
+ </Setter.Value>
+ </Setter>
<Style.Triggers>
- <DataTrigger Binding="{Binding Segments.Count,Converter={StaticResource GreaterThanToBooleanConverter},ConverterParameter=3}" Value="True">
- <Setter Property="Visibility" Value="Visible"></Setter>
+ <DataTrigger Binding="{Binding HasEmbroideryFile}" Value="True">
+ <Setter Property="Content">
+ <Setter.Value>
+ <Button ToolTip="Press to display the attached embroidery file information" Style="{StaticResource emptyButton}" Cursor="Hand" Command="{Binding DataContext.DisplayJobEmbroideryFileCommand, Source={x:Reference control}}" CommandParameter="{Binding}">
+ <Image Source="../Images/job-emb.png" Width="40" Margin="5"></Image>
+ </Button>
+ </Setter.Value>
+ </Setter>
</DataTrigger>
</Style.Triggers>
</Style>
- </StackPanel.Style>
- <materialDesign:PackIcon Kind="Plus" Width="18" Height="18" VerticalAlignment="Center" />
- <TextBlock Margin="0 -3 0 0" Text="{Binding Segments.Count,Converter={StaticResource MathOperatorConverter},ConverterParameter='-3'}" FontSize="16" VerticalAlignment="Center" FontWeight="SemiBold" FontStyle="Italic"></TextBlock>
+ </ContentControl.Style>
+ </ContentControl>
+ </DataTemplate>
+ </DataGridTemplateColumn.CellTemplate>
+ </DataGridTemplateColumn>
+ <DataGridTemplateColumn Header="NAME" CanUserSort="True" SortMemberPath="Name">
+ <DataGridTemplateColumn.CellTemplate>
+ <DataTemplate>
+ <TextBlock Text="{Binding Name}" VerticalAlignment="Center" FontSize="14"></TextBlock>
+ </DataTemplate>
+ </DataGridTemplateColumn.CellTemplate>
+ </DataGridTemplateColumn>
+ <DataGridTemplateColumn Header="CREATION DATE" Width="150" CanUserSort="True" SortMemberPath="CreationDate">
+ <DataGridTemplateColumn.CellTemplate>
+ <DataTemplate>
+ <TextBlock Text="{Binding CreationDate,Converter={StaticResource DateTimeUTCToShortDateTimeConverter}}" VerticalAlignment="Center" FontSize="14"></TextBlock>
+ </DataTemplate>
+ </DataGridTemplateColumn.CellTemplate>
+ </DataGridTemplateColumn>
+ <DataGridTemplateColumn Header="LAST MODIFIED" Width="150" CanUserSort="True" SortMemberPath="LastUpdated">
+ <DataGridTemplateColumn.CellTemplate>
+ <DataTemplate>
+ <TextBlock Text="{Binding LastUpdated,Converter={StaticResource DateTimeUTCToShortDateTimeConverter}}" VerticalAlignment="Center" FontSize="14"></TextBlock>
+ </DataTemplate>
+ </DataGridTemplateColumn.CellTemplate>
+ </DataGridTemplateColumn>
+ <DataGridTemplateColumn Header="LAST RUN" Width="150" CanUserSort="True" SortMemberPath="LastRun">
+ <DataGridTemplateColumn.CellTemplate>
+ <DataTemplate>
+ <TextBlock Text="{Binding LastRun,Converter={StaticResource DateTimeUTCToShortDateTimeConverter},FallbackValue='Never',TargetNullValue='Never'}" VerticalAlignment="Center" FontSize="14"></TextBlock>
+ </DataTemplate>
+ </DataGridTemplateColumn.CellTemplate>
+ </DataGridTemplateColumn>
+ <DataGridTemplateColumn Header="USER" Width="100" CanUserSort="True" SortMemberPath="User">
+ <DataGridTemplateColumn.CellTemplate>
+ <DataTemplate>
+ <TextBlock Text="{Binding User.Contact.FirstName}" VerticalAlignment="Center" FontSize="14"></TextBlock>
+ </DataTemplate>
+ </DataGridTemplateColumn.CellTemplate>
+ </DataGridTemplateColumn>
+ <DataGridTemplateColumn Header="LENGTH" Width="100" CanUserSort="True" SortMemberPath="Length">
+ <DataGridTemplateColumn.CellTemplate>
+ <DataTemplate>
+ <TextBlock VerticalAlignment="Center" FontSize="14">
+ <Run Text="{Binding Length,Mode=OneWay,StringFormat=N2}"></Run>
+ <Run Text="m" Foreground="Gray"></Run>
+ </TextBlock>
+ </DataTemplate>
+ </DataGridTemplateColumn.CellTemplate>
+ </DataGridTemplateColumn>
+ <DataGridTemplateColumn Header="DURATION" Width="100" CanUserSort="True" SortMemberPath="EstimatedDurationMili">
+ <DataGridTemplateColumn.CellTemplate>
+ <DataTemplate>
+ <TextBlock VerticalAlignment="Center" FontSize="14">
+ <Run Text="{Binding EstimatedDurationMili,Converter={StaticResource MillisecondsToTimeSpanConverter},Mode=OneWay,StringFormat=hh\\:mm\\:ss,TargetNullValue='Unknown'}"></Run>
+ </TextBlock>
+ </DataTemplate>
+ </DataGridTemplateColumn.CellTemplate>
+ </DataGridTemplateColumn>
+ <DataGridTemplateColumn Width="1*" Header="SEGMENTS" CanUserSort="True" SortMemberPath="Segments.Count">
+ <DataGridTemplateColumn.CellTemplate>
+ <DataTemplate>
+ <StackPanel Orientation="Horizontal">
+ <ItemsControl HorizontalAlignment="Right" ItemsSource="{Binding Segments}">
+ <ItemsControl.ItemsPanel>
+ <ItemsPanelTemplate>
+ <StackPanel Orientation="Horizontal" HorizontalAlignment="Left" MaxWidth="110">
+
+ </StackPanel>
+ </ItemsPanelTemplate>
+ </ItemsControl.ItemsPanel>
+ <ItemsControl.ItemTemplate>
+ <DataTemplate>
+ <Border Width="25" Height="25" Margin="10 0 0 0" BorderThickness="1" BorderBrush="DimGray" CornerRadius="3" Background="{Binding SegmentBrush}">
+
+ </Border>
+ </DataTemplate>
+ </ItemsControl.ItemTemplate>
+ </ItemsControl>
+ <StackPanel Orientation="Horizontal" Margin="0 0 0 0" VerticalAlignment="Center">
+ <StackPanel.Style>
+ <Style TargetType="StackPanel">
+ <Setter Property="Visibility" Value="Collapsed"></Setter>
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding Segments.Count,Converter={StaticResource GreaterThanToBooleanConverter},ConverterParameter=3}" Value="True">
+ <Setter Property="Visibility" Value="Visible"></Setter>
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </StackPanel.Style>
+ <materialDesign:PackIcon Kind="Plus" Width="18" Height="18" VerticalAlignment="Center" />
+ <TextBlock Margin="0 -3 0 0" Text="{Binding Segments.Count,Converter={StaticResource MathOperatorConverter},ConverterParameter='-3'}" FontSize="16" VerticalAlignment="Center" FontWeight="SemiBold" FontStyle="Italic"></TextBlock>
+ </StackPanel>
</StackPanel>
- </StackPanel>
- </DataTemplate>
- </DataGridTemplateColumn.CellTemplate>
- </DataGridTemplateColumn>
- </DataGrid.Columns>
- </controls:MultiSelectDataGrid>
+ </DataTemplate>
+ </DataGridTemplateColumn.CellTemplate>
+ </DataGridTemplateColumn>
+ </DataGrid.Columns>
+ </controls:MultiSelectDataGrid>
+ </commonControls:LoadingPanel>
</Grid>
</DockPanel>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml
index a7348d869..68cd65ad4 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml
@@ -575,7 +575,7 @@
<Grid Grid.Row="1">
- <controls:NavigationControl x:Name="TransitionControl" TransitionType="Slide" KeepElementsAttached="True">
+ <controls:NavigationControl x:Name="NavigationControl" TransitionType="Slide" KeepElementsAttached="True">
<local:MachineJobSelectionView controls:NavigationControl.NavigationName="MachineJobSelectionView" />
<local:JobView controls:NavigationControl.NavigationName="JobView" />
<local:RunningJobView controls:NavigationControl.NavigationName="RunningJobView" />
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/app.config b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/app.config
index 77b7003e2..0e58ccf54 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/app.config
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/app.config
@@ -50,6 +50,10 @@
<assemblyIdentity name="System.Diagnostics.StackTrace" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
</dependentAssembly>
+ <dependentAssembly>
+ <assemblyIdentity name="System.Xml.ReaderWriter" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" />
+ </dependentAssembly>
</assemblyBinding>
</runtime>
<entityFramework>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Properties/AssemblyInfo.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Properties/AssemblyInfo.cs
index 54e27ec27..6807ed5c8 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Properties/AssemblyInfo.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Properties/AssemblyInfo.cs
@@ -5,7 +5,7 @@ using System.Runtime.InteropServices;
using System.Windows;
[assembly: AssemblyTitle("Tango - Machine Studio Hardware Designer Module")]
-[assembly: AssemblyVersion("2.0.8.1633")]
+[assembly: AssemblyVersion("2.0.10.1159")]
[assembly: ComVisible(false)]
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Tango.MachineStudio.HardwareDesigner.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Tango.MachineStudio.HardwareDesigner.csproj
index 89942c6d6..efa7a669c 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Tango.MachineStudio.HardwareDesigner.csproj
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Tango.MachineStudio.HardwareDesigner.csproj
@@ -8,7 +8,7 @@
<OutputType>library</OutputType>
<RootNamespace>Tango.MachineStudio.HardwareDesigner</RootNamespace>
<AssemblyName>Tango.MachineStudio.HardwareDesigner</AssemblyName>
- <TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
+ <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
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 3dd4e62a3..6ba28cb72 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
@@ -11,118 +11,15 @@ using Tango.SharedUI;
using Tango.BL;
using Tango.SharedUI.Components;
using System.Runtime.CompilerServices;
+using Tango.MachineStudio.Common;
namespace Tango.MachineStudio.HardwareDesigner.ViewModels
{
- public class MainViewVM : ViewModel
+ public class MainViewVM : StudioViewModel
{
private INotificationProvider _notification;
private bool _isNew;
-
- private ObservablesEntitiesAdapter _adapter;
- public ObservablesEntitiesAdapter Adapter
- {
- get { return _adapter; }
- set { _adapter = value; RaisePropertyChangedAuto(); }
- }
-
- private SelectedObjectCollection<HardwareMotorType> _motorTypes;
- public SelectedObjectCollection<HardwareMotorType> MotorTypes
- {
- get { return _motorTypes; }
- set { _motorTypes = value; RaisePropertyChangedAuto(); }
- }
-
- private ObservableCollection<HardwareMotorType> _selectedMotorTypes;
- public ObservableCollection<HardwareMotorType> SelectedMotorTypes
- {
- get { return _selectedMotorTypes; }
- set { _selectedMotorTypes = value; RaisePropertyChangedAuto(); }
- }
-
- private SelectedObjectCollection<HardwareDancerType> _dancerTypes;
- public SelectedObjectCollection<HardwareDancerType> DancerTypes
- {
- get { return _dancerTypes; }
- set { _dancerTypes = value; RaisePropertyChangedAuto(); }
- }
-
- private ObservableCollection<HardwareDancerType> _selectedDancerTypes;
- public ObservableCollection<HardwareDancerType> SelectedDancerTypes
- {
- get { return _selectedDancerTypes; }
- set { _selectedDancerTypes = value; RaisePropertyChangedAuto(); }
- }
-
- private SelectedObjectCollection<HardwarePidControlType> _pidControlTypes;
- public SelectedObjectCollection<HardwarePidControlType> PidControlTypes
- {
- get { return _pidControlTypes; }
- set { _pidControlTypes = value; RaisePropertyChangedAuto(); }
- }
-
- private ObservableCollection<HardwarePidControlType> _selectedPidControlTypes;
- public ObservableCollection<HardwarePidControlType> SelectedPidControlTypes
- {
- get { return _selectedPidControlTypes; }
- set { _selectedPidControlTypes = value; RaisePropertyChangedAuto(); }
- }
-
- private SelectedObjectCollection<HardwareWinderType> _winderTypes;
- public SelectedObjectCollection<HardwareWinderType> WinderTypes
- {
- get { return _winderTypes; }
- set { _winderTypes = value; RaisePropertyChangedAuto(); }
- }
-
- private ObservableCollection<HardwareWinderType> _selectedWinderTypes;
- public ObservableCollection<HardwareWinderType> SelectedWinderTypes
- {
- get { return _selectedWinderTypes; }
- set { _selectedWinderTypes = value; RaisePropertyChangedAuto(); }
- }
-
- private SelectedObjectCollection<HardwareSpeedSensorType> _speedSensorTypes;
- public SelectedObjectCollection<HardwareSpeedSensorType> SpeedSensorTypes
- {
- get { return _speedSensorTypes; }
- set { _speedSensorTypes = value; RaisePropertyChangedAuto(); }
- }
-
- private ObservableCollection<HardwareSpeedSensorType> _selectedSpeedSensorTypes;
- public ObservableCollection<HardwareSpeedSensorType> SelectedSpeedSensorTypes
- {
- get { return _selectedSpeedSensorTypes; }
- set { _selectedSpeedSensorTypes = value; RaisePropertyChangedAuto(); }
- }
-
- private SelectedObjectCollection<HardwareBlowerType> _blowerTypes;
- public SelectedObjectCollection<HardwareBlowerType> BlowerTypes
- {
- get { return _blowerTypes; }
- set { _blowerTypes = value; RaisePropertyChangedAuto(); }
- }
-
- private ObservableCollection<HardwareBlowerType> _selectedBlowerTypes;
- public ObservableCollection<HardwareBlowerType> SelectedBlowerTypes
- {
- get { return _selectedBlowerTypes; }
- set { _selectedBlowerTypes = value; RaisePropertyChangedAuto(); }
- }
-
- private SelectedObjectCollection<HardwareBreakSensorType> _breakSensorTypes;
- public SelectedObjectCollection<HardwareBreakSensorType> BreakSensorTypes
- {
- get { return _breakSensorTypes; }
- set { _breakSensorTypes = value; RaisePropertyChangedAuto(); }
- }
-
- private ObservableCollection<HardwareBreakSensorType> _selectedBreakSensorTypes;
- public ObservableCollection<HardwareBreakSensorType> SelectedBreakSensorTypes
- {
- get { return _selectedBreakSensorTypes; }
- set { _selectedBreakSensorTypes = value; RaisePropertyChangedAuto(); }
- }
+ private ObservablesContext _db;
private HardwareVersion _selectedVersion;
public HardwareVersion SelectedVersion
@@ -144,25 +41,16 @@ namespace Tango.MachineStudio.HardwareDesigner.ViewModels
get { return _selectedHardwareObject; }
set
{
- _selectedHardwareObject = null;
- RaisePropertyChangedAuto();
_selectedHardwareObject = value;
RaisePropertyChangedAuto();
}
}
- private Object _selectedHardwareObjectType;
- public Object SelectedHardwareObjectType
+ private ObservableCollection<HardwareVersion> _hardwareVersions;
+ public ObservableCollection<HardwareVersion> HardwareVersions
{
- get { return _selectedHardwareObjectType; }
- set
- {
- _selectedHardwareObjectType = null;
- RaisePropertyChangedAuto();
- _selectedHardwareObjectType = value;
- RaisePropertyChangedAuto();
- OnSelectedHardwareObjectTypeChanged();
- }
+ get { return _hardwareVersions; }
+ set { _hardwareVersions = value; RaisePropertyChangedAuto(); }
}
public RelayCommand SaveCommand { get; set; }
@@ -179,429 +67,242 @@ namespace Tango.MachineStudio.HardwareDesigner.ViewModels
{
_notification = notification;
- Adapter = ObservablesEntitiesAdapter.Instance;
- SaveCommand = new RelayCommand(Save, () => SelectedVersion != null);
- NewCommand = new RelayCommand(New);
- DeleteCommand = new RelayCommand(Delete, () => !_isNew && SelectedVersion != null);
+ CurrentVersion = new HardwareVersion();
+
+ SaveCommand = new RelayCommand(Save, () => SelectedVersion != null && IsFree);
+ NewCommand = new RelayCommand(New, () => IsFree);
+ DeleteCommand = new RelayCommand(Delete, () => !_isNew && SelectedVersion != null && IsFree);
CurrentVersion = new HardwareVersion();
- CreateTemplate(CurrentVersion);
- CopyParametersCommand = new RelayCommand(CopyParameters, (x) => SelectedVersion != null && SelectedHardwareObjectType != null);
- CloneCommand = new RelayCommand(CloneCurrentVersion, () => SelectedVersion != null);
+ CopyParametersCommand = new RelayCommand(CopyParameters, (x) => SelectedVersion != null && IsFree);
+ CloneCommand = new RelayCommand(CloneCurrentVersion, () => SelectedVersion != null && IsFree);
+ }
+
+ public override void OnApplicationReady()
+ {
+ Task.Factory.StartNew(() =>
+ {
+ RefreshVersions();
+ CreateDefaultView();
+ });
}
private void CopyParameters(object obj)
{
- IObservableEntity source = obj.GetType().GetProperty("Data").GetValue(obj) as IObservableEntity;
- IObservableEntity target = null;
+ obj.MapPrimitivesTo(SelectedHardwareObject,
+ (prop) =>
+ !prop.PropertyType.IsEnum
+ &&
+ !prop.Name.ToLower().Contains("guid"));
+ }
- if (source is HardwareMotorType)
- {
- target = CurrentVersion.HardwareMotors.SingleOrDefault(x => x.HardwareMotorType == source);
- }
- else if (source is HardwareDancerType)
- {
- target = CurrentVersion.HardwareDancers.SingleOrDefault(x => x.HardwareDancerType == source);
- }
- else if (source is HardwarePidControlType)
- {
- target = CurrentVersion.HardwarePidControls.SingleOrDefault(x => x.HardwarePidControlType == source);
- }
- else if (source is HardwareWinderType)
- {
- target = CurrentVersion.HardwareWinders.SingleOrDefault(x => x.HardwareWinderType == source);
- }
- else if (source is HardwareSpeedSensorType)
- {
- target = CurrentVersion.HardwareSpeedSensors.SingleOrDefault(x => x.HardwareSpeedSensorType == source);
- }
- else if (source is HardwareBlowerType)
- {
- target = CurrentVersion.HardwareBlowers.SingleOrDefault(x => x.HardwareBlowerType == source);
- }
- else if (source is HardwareBreakSensorType)
- {
- target = CurrentVersion.HardwareBreakSensors.SingleOrDefault(x => x.HardwareBreakSensorType == source);
- }
+ private void CreateDefaultView()
+ {
+ if (_db != null) _db.Dispose();
- target.MapPrimitivesTo(SelectedHardwareObject);
+ _db = ObservablesContext.CreateDefault();
+
+ CurrentVersion.HardwareMotors = _db.HardwareMotorTypes.ToList().Select(x => new HardwareMotor() { HardwareMotorType = x }).ToObservableCollection();
+ CurrentVersion.HardwareDancers = _db.HardwareDancerTypes.ToList().Select(x => new HardwareDancer() { HardwareDancerType = x }).ToObservableCollection();
+ CurrentVersion.HardwarePidControls = _db.HardwarePidControlTypes.ToList().Select(x => new HardwarePidControl() { HardwarePidControlType = x }).ToObservableCollection();
+ CurrentVersion.HardwareWinders = _db.HardwareWinderTypes.ToList().Select(x => new HardwareWinder() { HardwareWinderType = x }).ToObservableCollection();
+ CurrentVersion.HardwareSpeedSensors = _db.HardwareSpeedSensorTypes.ToList().Select(x => new HardwareSpeedSensor() { HardwareSpeedSensorType = x }).ToObservableCollection();
+ CurrentVersion.HardwareBlowers = _db.HardwareBlowerTypes.ToList().Select(x => new HardwareBlower() { HardwareBlowerType = x }).ToObservableCollection();
+ CurrentVersion.HardwareBreakSensors = _db.HardwareBreakSensorTypes.ToList().Select(x => new HardwareBreakSensor() { HardwareBreakSensorType = x }).ToObservableCollection();
}
- private void OnSelectedHardwareObjectTypeChanged()
+ private void RefreshVersions()
{
- if (SelectedHardwareObjectType != null)
+ using (var db = ObservablesContext.CreateDefault())
{
- if (SelectedHardwareObjectType is SelectedObject<HardwareMotorType>)
+ _hardwareVersions = db.HardwareVersions.ToObservableCollection();
+ InvokeUI(() =>
{
- var type = (SelectedHardwareObjectType as SelectedObject<HardwareMotorType>).Data;
- var hardwareObj = CurrentVersion.HardwareMotors.SingleOrDefault(x => x.HardwareMotorType == type);
+ RaisePropertyChanged(nameof(HardwareVersions));
+ });
+ }
+ }
- if (hardwareObj != null)
- {
- SelectedHardwareObject = hardwareObj;
- }
- else
- {
- hardwareObj = new HardwareMotor() { HardwareMotorType = type };
- CurrentVersion.HardwareMotors.Add(hardwareObj);
- SelectedHardwareObject = hardwareObj;
- }
- }
- else if (SelectedHardwareObjectType is SelectedObject<HardwareDancerType>)
- {
- var type = (SelectedHardwareObjectType as SelectedObject<HardwareDancerType>).Data;
- var hardwareObj = CurrentVersion.HardwareDancers.SingleOrDefault(x => x.HardwareDancerType == type);
+ private void CreateVersionView(HardwareVersion selectedVersion)
+ {
+ if (_db != null) _db.Dispose();
- if (hardwareObj != null)
- {
- SelectedHardwareObject = hardwareObj;
- }
- else
- {
- hardwareObj = new HardwareDancer() { HardwareDancerType = type };
- CurrentVersion.HardwareDancers.Add(hardwareObj);
- SelectedHardwareObject = hardwareObj;
- }
- }
- else if (SelectedHardwareObjectType is SelectedObject<HardwarePidControlType>)
- {
- var type = (SelectedHardwareObjectType as SelectedObject<HardwarePidControlType>).Data;
- var hardwareObj = CurrentVersion.HardwarePidControls.SingleOrDefault(x => x.HardwarePidControlType == type);
+ _db = ObservablesContext.CreateDefault();
- if (hardwareObj != null)
- {
- SelectedHardwareObject = hardwareObj;
- }
- else
- {
- hardwareObj = new HardwarePidControl() { HardwarePidControlType = type };
- CurrentVersion.HardwarePidControls.Add(hardwareObj);
- SelectedHardwareObject = hardwareObj;
- }
- }
- else if (SelectedHardwareObjectType is SelectedObject<HardwareWinderType>)
- {
- var type = (SelectedHardwareObjectType as SelectedObject<HardwareWinderType>).Data;
- var hardwareObj = CurrentVersion.HardwareWinders.SingleOrDefault(x => x.HardwareWinderType == type);
+ CurrentVersion = _db.Adapter.GetHardwareVersion(x => x.Guid == selectedVersion.Guid);
- if (hardwareObj != null)
- {
- SelectedHardwareObject = hardwareObj;
- }
- else
- {
- hardwareObj = new HardwareWinder() { HardwareWinderType = type };
- CurrentVersion.HardwareWinders.Add(hardwareObj);
- SelectedHardwareObject = hardwareObj;
- }
- }
- else if (SelectedHardwareObjectType is SelectedObject<HardwareSpeedSensorType>)
- {
- var type = (SelectedHardwareObjectType as SelectedObject<HardwareSpeedSensorType>).Data;
- var hardwareObj = CurrentVersion.HardwareSpeedSensors.SingleOrDefault(x => x.HardwareSpeedSensorType == type);
- if (hardwareObj != null)
- {
- SelectedHardwareObject = hardwareObj;
- }
- else
- {
- hardwareObj = new HardwareSpeedSensor() { HardwareSpeedSensorType = type };
- CurrentVersion.HardwareSpeedSensors.Add(hardwareObj);
- SelectedHardwareObject = hardwareObj;
- }
- }
- else if (SelectedHardwareObjectType is SelectedObject<HardwareBlowerType>)
+ InvokeUINow(() =>
+ {
+ ObservablesStaticCollections.Instance.HardwareMotorTypes.Where(x => !CurrentVersion.HardwareMotors.ToList().Exists(y => y.HardwareMotorType.Code == x.Code)).ToList().ForEach(x =>
{
- var type = (SelectedHardwareObjectType as SelectedObject<HardwareBlowerType>).Data;
- var hardwareObj = CurrentVersion.HardwareBlowers.SingleOrDefault(x => x.HardwareBlowerType == type);
+ CurrentVersion.HardwareMotors.Add(new HardwareMotor()
+ {
+ HardwareMotorType = _db.HardwareMotorTypes.SingleOrDefault(y => y.Code == x.Code),
+ });
+ });
- if (hardwareObj != null)
+ CurrentVersion.HardwareMotors = CurrentVersion.HardwareMotors.OrderBy(x => x.HardwareMotorType.Code).ToObservableCollection();
+
+ ObservablesStaticCollections.Instance.HardwareDancerTypes.Where(x => !CurrentVersion.HardwareDancers.ToList().Exists(y => y.HardwareDancerType.Code == x.Code)).ToList().ForEach(x =>
+ {
+ CurrentVersion.HardwareDancers.Add(new HardwareDancer()
{
- SelectedHardwareObject = hardwareObj;
- }
- else
+ HardwareDancerType = _db.HardwareDancerTypes.SingleOrDefault(y => y.Code == x.Code)
+ });
+ });
+
+ CurrentVersion.HardwareDancers = CurrentVersion.HardwareDancers.OrderBy(x => x.HardwareDancerType.Code).ToObservableCollection();
+
+ ObservablesStaticCollections.Instance.HardwarePidControlTypes.Where(x => !CurrentVersion.HardwarePidControls.ToList().Exists(y => y.HardwarePidControlType.Code == x.Code)).ToList().ForEach(x =>
+ {
+ CurrentVersion.HardwarePidControls.Add(new HardwarePidControl()
{
- hardwareObj = new HardwareBlower() { HardwareBlowerType = type };
- CurrentVersion.HardwareBlowers.Add(hardwareObj);
- SelectedHardwareObject = hardwareObj;
- }
- }
- else if (SelectedHardwareObjectType is SelectedObject<HardwareBreakSensorType>)
+ HardwarePidControlType = _db.HardwarePidControlTypes.SingleOrDefault(y => y.Code == x.Code)
+ });
+ });
+
+ CurrentVersion.HardwarePidControls = CurrentVersion.HardwarePidControls.OrderBy(x => x.HardwarePidControlType.Code).ToObservableCollection();
+
+ ObservablesStaticCollections.Instance.HardwareWinderTypes.Where(x => !CurrentVersion.HardwareWinders.ToList().Exists(y => y.HardwareWinderType.Code == x.Code)).ToList().ForEach(x =>
{
- var type = (SelectedHardwareObjectType as SelectedObject<HardwareBreakSensorType>).Data;
- var hardwareObj = CurrentVersion.HardwareBreakSensors.SingleOrDefault(x => x.HardwareBreakSensorType == type);
+ CurrentVersion.HardwareWinders.Add(new HardwareWinder()
+ {
+ HardwareWinderType = _db.HardwareWinderTypes.SingleOrDefault(y => y.Code == x.Code)
+ });
+ });
+
+ CurrentVersion.HardwareWinders = CurrentVersion.HardwareWinders.OrderBy(x => x.HardwareWinderType.Code).ToObservableCollection();
- if (hardwareObj != null)
+ ObservablesStaticCollections.Instance.HardwareSpeedSensorTypes.Where(x => !CurrentVersion.HardwareSpeedSensors.ToList().Exists(y => y.HardwareSpeedSensorType.Code == x.Code)).ToList().ForEach(x =>
+ {
+ CurrentVersion.HardwareSpeedSensors.Add(new HardwareSpeedSensor()
{
- SelectedHardwareObject = hardwareObj;
- }
- else
+ HardwareSpeedSensorType = _db.HardwareSpeedSensorTypes.SingleOrDefault(y => y.Code == x.Code)
+ });
+ });
+
+ CurrentVersion.HardwareSpeedSensors = CurrentVersion.HardwareSpeedSensors.OrderBy(x => x.HardwareSpeedSensorType.Code).ToObservableCollection();
+
+ ObservablesStaticCollections.Instance.HardwareBlowerTypes.Where(x => !CurrentVersion.HardwareBlowers.ToList().Exists(y => y.HardwareBlowerType.Code == x.Code)).ToList().ForEach(x =>
+ {
+ CurrentVersion.HardwareBlowers.Add(new HardwareBlower()
{
- hardwareObj = new HardwareBreakSensor() { HardwareBreakSensorType = type };
- CurrentVersion.HardwareBreakSensors.Add(hardwareObj);
- SelectedHardwareObject = hardwareObj;
- }
- }
- }
- }
+ HardwareBlowerType = _db.HardwareBlowerTypes.SingleOrDefault(y => y.Code == x.Code)
+ });
+ });
- private void CreateTemplate(HardwareVersion version)
- {
- if (version == null)
- {
- SelectedMotorTypes = new ObservableCollection<HardwareMotorType>();
- SelectedDancerTypes = new ObservableCollection<HardwareDancerType>();
- SelectedPidControlTypes = new ObservableCollection<HardwarePidControlType>();
- SelectedWinderTypes = new ObservableCollection<HardwareWinderType>();
- SelectedSpeedSensorTypes = new ObservableCollection<HardwareSpeedSensorType>();
- SelectedBlowerTypes = new ObservableCollection<HardwareBlowerType>();
- SelectedBreakSensorTypes = new ObservableCollection<HardwareBreakSensorType>();
- }
- else
- {
- SelectedMotorTypes = version.HardwareMotors.Select(x => x.HardwareMotorType).ToObservableCollection();
- SelectedDancerTypes = version.HardwareDancers.Select(x => x.HardwareDancerType).ToObservableCollection();
- SelectedPidControlTypes = version.HardwarePidControls.Select(x => x.HardwarePidControlType).ToObservableCollection();
- SelectedWinderTypes = version.HardwareWinders.Select(x => x.HardwareWinderType).ToObservableCollection();
- SelectedSpeedSensorTypes = version.HardwareSpeedSensors.Select(x => x.HardwareSpeedSensorType).ToObservableCollection();
- SelectedBlowerTypes = version.HardwareBlowers.Select(x => x.HardwareBlowerType).ToObservableCollection();
- SelectedBreakSensorTypes = version.HardwareBreakSensors.Select(x => x.HardwareBreakSensorType).ToObservableCollection();
- }
+ CurrentVersion.HardwareBlowers = CurrentVersion.HardwareBlowers.OrderBy(x => x.HardwareBlowerType.Code).ToObservableCollection();
+
+ ObservablesStaticCollections.Instance.HardwareBreakSensorTypes.Where(x => !CurrentVersion.HardwareBreakSensors.ToList().Exists(y => y.HardwareBreakSensorType.Code == x.Code)).ToList().ForEach(x =>
+ {
+ CurrentVersion.HardwareBreakSensors.Add(new HardwareBreakSensor()
+ {
+ HardwareBreakSensorType = _db.HardwareBreakSensorTypes.SingleOrDefault(y => y.Code == x.Code)
+ });
+ });
- MotorTypes = new SelectedObjectCollection<HardwareMotorType>(Adapter.HardwareMotorTypes, SelectedMotorTypes);
- DancerTypes = new SelectedObjectCollection<HardwareDancerType>(Adapter.HardwareDancerTypes, SelectedDancerTypes);
- PidControlTypes = new SelectedObjectCollection<HardwarePidControlType>(Adapter.HardwarePidControlTypes, SelectedPidControlTypes);
- WinderTypes = new SelectedObjectCollection<HardwareWinderType>(Adapter.HardwareWinderTypes, SelectedWinderTypes);
- SpeedSensorTypes = new SelectedObjectCollection<HardwareSpeedSensorType>(Adapter.HardwareSpeedSensorTypes, SelectedSpeedSensorTypes);
- BlowerTypes = new SelectedObjectCollection<HardwareBlowerType>(Adapter.HardwareBlowerTypes, SelectedBlowerTypes);
- BreakSensorTypes = new SelectedObjectCollection<HardwareBreakSensorType>(Adapter.HardwareBreakSensorTypes, SelectedBreakSensorTypes);
+ CurrentVersion.HardwareBreakSensors = CurrentVersion.HardwareBreakSensors.OrderBy(x => x.HardwareBreakSensorType.Code).ToObservableCollection();
+ });
}
- private void OnSelectedVersionChanged()
+ private async void OnSelectedVersionChanged()
{
if (SelectedVersion != null)
{
- _isNew = false;
- CurrentVersion = SelectedVersion.Clone();
- CreateTemplate(CurrentVersion);
- }
+ using (_notification.PushTaskItem("Loading hardware version..."))
+ {
+ IsFree = false;
- InvalidateRelayCommands();
- }
+ await Task.Factory.StartNew(() =>
+ {
+ _isNew = false;
+ var selectedVersion = SelectedVersion;
+ RefreshVersions();
+ var version = _hardwareVersions.SingleOrDefault(X => X.Guid == selectedVersion.Guid);
+ CreateVersionView(SelectedVersion);
- private bool CheckCurrentVersionNull()
- {
- if (CurrentVersion == null)
- {
- _notification.ShowInfo("Please select a hardware version before attempting to insert any components.");
- return true;
+ InvokeUI(() =>
+ {
+ _selectedVersion = version;
+ RaisePropertyChanged(nameof(SelectedVersion));
+ });
+ });
+
+ IsFree = true;
+ }
}
- return false;
+ InvalidateRelayCommands();
}
- private void New()
+ private async void New()
{
String name = _notification.ShowTextInput("Enter hardware version name", "Name");
if (!String.IsNullOrWhiteSpace(name))
{
- SelectedVersion = null;
- CurrentVersion = new HardwareVersion();
- CurrentVersion.Version = Adapter.HardwareVersions.Max(x => x.Version) + 1;
- CurrentVersion.Name = name;
- CreateTemplate(CurrentVersion);
- _isNew = true;
- InvalidateRelayCommands();
- }
- }
-
- private async void Save()
- {
- if (CurrentVersion != null)
- {
- using (_notification.PushTaskItem("Saving hardware version..."))
+ using (_notification.PushTaskItem("Creating new machine version..."))
{
+ IsFree = false;
+
await Task.Factory.StartNew(() =>
{
- HardwareVersion realVersion = null;
-
- if (_isNew)
- {
- realVersion = CurrentVersion.Clone();
+ SelectedVersion = null;
+ CurrentVersion = new HardwareVersion();
+ CurrentVersion.Version = HardwareVersions.Max(x => x.Version) + 1;
+ CurrentVersion.Name = name;
+ CreateDefaultView();
- realVersion.HardwareMotors.ToList().Where(x => !SelectedMotorTypes.Contains(x.HardwareMotorType)).ToList().ForEach(x => realVersion.HardwareMotors.Remove(x));
- realVersion.HardwareDancers.ToList().Where(x => !SelectedDancerTypes.Contains(x.HardwareDancerType)).ToList().ForEach(x => realVersion.HardwareDancers.Remove(x));
- realVersion.HardwarePidControls.ToList().Where(x => !SelectedPidControlTypes.Contains(x.HardwarePidControlType)).ToList().ForEach(x => realVersion.HardwarePidControls.Remove(x));
- realVersion.HardwareWinders.ToList().Where(x => !SelectedWinderTypes.Contains(x.HardwareWinderType)).ToList().ForEach(x => realVersion.HardwareWinders.Remove(x));
- realVersion.HardwareSpeedSensors.ToList().Where(x => !SelectedSpeedSensorTypes.Contains(x.HardwareSpeedSensorType)).ToList().ForEach(x => realVersion.HardwareSpeedSensors.Remove(x));
- realVersion.HardwareBlowers.ToList().Where(x => !SelectedBlowerTypes.Contains(x.HardwareBlowerType)).ToList().ForEach(x => realVersion.HardwareBlowers.Remove(x));
- realVersion.HardwareBreakSensors.ToList().Where(x => !SelectedBreakSensorTypes.Contains(x.HardwareBreakSensorType)).ToList().ForEach(x => realVersion.HardwareBreakSensors.Remove(x));
- }
- else
- {
- realVersion = Adapter.HardwareVersions.SingleOrDefault(x => x.Guid == SelectedVersion.Guid);
-
- realVersion.Version = CurrentVersion.Version;
- realVersion.Name = CurrentVersion.Name;
-
- realVersion.HardwareDancers.ToList().ForEach(x => x.DefferedDelete(Adapter.Context));
- realVersion.HardwareMotors.ToList().ForEach(x => x.DefferedDelete(Adapter.Context));
- realVersion.HardwarePidControls.ToList().ForEach(x => x.DefferedDelete(Adapter.Context));
- realVersion.HardwareWinders.ToList().ForEach(x => x.DefferedDelete(Adapter.Context));
- realVersion.HardwareSpeedSensors.ToList().ForEach(x => x.DefferedDelete(Adapter.Context));
- realVersion.HardwareBlowers.ToList().ForEach(x => x.DefferedDelete(Adapter.Context));
- realVersion.HardwareBreakSensors.ToList().ForEach(x => x.DefferedDelete(Adapter.Context));
+ _db.HardwareVersions.Add(CurrentVersion);
+ _db.SaveChanges();
- realVersion.HardwareDancers.Clear();
- realVersion.HardwareMotors.Clear();
- realVersion.HardwarePidControls.Clear();
- realVersion.HardwareWinders.Clear();
- realVersion.HardwareSpeedSensors.Clear();
- realVersion.HardwareBlowers.Clear();
- realVersion.HardwareBreakSensors.Clear();
-
- foreach (var type in SelectedDancerTypes)
- {
- var item = CurrentVersion.HardwareDancers.SingleOrDefault(x => x.HardwareDancerType == type);
- if (item != null)
- {
- item.HardwareVersionGuid = realVersion.Guid;
- realVersion.HardwareDancers.Add(item);
- }
- else
- {
- realVersion.HardwareDancers.Add(new HardwareDancer()
- {
- HardwareVersionGuid = realVersion.Guid,
- HardwareDancerType = type
- });
- }
- }
+ RefreshVersions();
- foreach (var type in SelectedMotorTypes)
- {
- var item = CurrentVersion.HardwareMotors.SingleOrDefault(x => x.HardwareMotorType == type);
- if (item != null)
- {
- item.HardwareVersionGuid = realVersion.Guid;
- realVersion.HardwareMotors.Add(item);
- }
- else
- {
- realVersion.HardwareMotors.Add(new HardwareMotor()
- {
- HardwareVersionGuid = realVersion.Guid,
- HardwareMotorType = type
- });
- }
- }
-
- foreach (var type in SelectedPidControlTypes)
- {
- var item = CurrentVersion.HardwarePidControls.SingleOrDefault(x => x.HardwarePidControlType == type);
- if (item != null)
- {
- item.HardwareVersionGuid = realVersion.Guid;
- realVersion.HardwarePidControls.Add(item);
- }
- else
- {
- realVersion.HardwarePidControls.Add(new HardwarePidControl()
- {
- HardwareVersionGuid = realVersion.Guid,
- HardwarePidControlType = type
- });
- }
- }
-
- foreach (var type in SelectedWinderTypes)
- {
- var item = CurrentVersion.HardwareWinders.SingleOrDefault(x => x.HardwareWinderType == type);
- if (item != null)
- {
- item.HardwareVersionGuid = realVersion.Guid;
- realVersion.HardwareWinders.Add(item);
- }
- else
- {
- realVersion.HardwareWinders.Add(new HardwareWinder()
- {
- HardwareVersionGuid = realVersion.Guid,
- HardwareWinderType = type
- });
- }
- }
-
- foreach (var type in SelectedSpeedSensorTypes)
- {
- var item = CurrentVersion.HardwareSpeedSensors.SingleOrDefault(x => x.HardwareSpeedSensorType == type);
- if (item != null)
- {
- item.HardwareVersionGuid = realVersion.Guid;
- realVersion.HardwareSpeedSensors.Add(item);
- }
- else
- {
- realVersion.HardwareSpeedSensors.Add(new HardwareSpeedSensor()
- {
- HardwareVersionGuid = realVersion.Guid,
- HardwareSpeedSensorType = type
- });
- }
- }
+ InvokeUI(() =>
+ {
+ _selectedVersion = HardwareVersions.SingleOrDefault(x => x.Guid == CurrentVersion.Guid);
+ RaisePropertyChanged(nameof(SelectedVersion));
+ });
- foreach (var type in SelectedBlowerTypes)
- {
- var item = CurrentVersion.HardwareBlowers.SingleOrDefault(x => x.HardwareBlowerType == type);
- if (item != null)
- {
- item.HardwareVersionGuid = realVersion.Guid;
- realVersion.HardwareBlowers.Add(item);
- }
- else
- {
- realVersion.HardwareBlowers.Add(new HardwareBlower()
- {
- HardwareVersionGuid = realVersion.Guid,
- HardwareBlowerType = type
- });
- }
- }
+ _isNew = true;
+ InvalidateRelayCommands();
+ });
- foreach (var type in SelectedBreakSensorTypes)
- {
- var item = CurrentVersion.HardwareBreakSensors.SingleOrDefault(x => x.HardwareBreakSensorType == type);
- if (item != null)
- {
- item.HardwareVersionGuid = realVersion.Guid;
- realVersion.HardwareBreakSensors.Add(item);
- }
- else
- {
- realVersion.HardwareBreakSensors.Add(new HardwareBreakSensor()
- {
- HardwareVersionGuid = realVersion.Guid,
- HardwareBreakSensorType = type
- });
- }
- }
- }
+ IsFree = true;
+ }
+ }
+ }
+ private async void Save()
+ {
+ using (_notification.PushTaskItem("Saving hardware version..."))
+ {
+ try
+ {
+ IsFree = false;
+ await Task.Factory.StartNew(() =>
+ {
+ _db.SaveChanges();
+ RefreshVersions();
- if (_isNew)
+ InvokeUI(() =>
{
- Adapter.Context.HardwareVersions.Add(realVersion);
- }
-
- realVersion.Save(Adapter.Context);
-
- SelectedVersion = Adapter.HardwareVersions.SingleOrDefault(x => x.Guid == realVersion.Guid);
+ SelectedVersion = HardwareVersions.SingleOrDefault(x => x.Guid == CurrentVersion.Guid);
+ });
});
}
+ catch (Exception ex)
+ {
+ LogManager.Log(ex, "Could not save hardware version.");
+ _notification.ShowError($"An error occurred while trying to save this hardware version.\n{ex.Message}");
+ }
+ finally
+ {
+ IsFree = true;
+ }
}
}
@@ -615,55 +316,71 @@ namespace Tango.MachineStudio.HardwareDesigner.ViewModels
{
using (_notification.PushTaskItem("Cloning hardware configuration..."))
{
- await Task.Factory.StartNew(() =>
+ try
{
- var realVersion = CurrentVersion.Clone();
- realVersion.Name = name;
- realVersion.Version = 1;
-
- realVersion.HardwareMotors.ToList().Where(x => !SelectedMotorTypes.Contains(x.HardwareMotorType)).ToList().ForEach(x => realVersion.HardwareMotors.Remove(x));
- realVersion.HardwareDancers.ToList().Where(x => !SelectedDancerTypes.Contains(x.HardwareDancerType)).ToList().ForEach(x => realVersion.HardwareDancers.Remove(x));
- realVersion.HardwarePidControls.ToList().Where(x => !SelectedPidControlTypes.Contains(x.HardwarePidControlType)).ToList().ForEach(x => realVersion.HardwarePidControls.Remove(x));
- realVersion.HardwareWinders.ToList().Where(x => !SelectedWinderTypes.Contains(x.HardwareWinderType)).ToList().ForEach(x => realVersion.HardwareWinders.Remove(x));
- realVersion.HardwareSpeedSensors.ToList().Where(x => !SelectedSpeedSensorTypes.Contains(x.HardwareSpeedSensorType)).ToList().ForEach(x => realVersion.HardwareSpeedSensors.Remove(x));
- realVersion.HardwareBlowers.ToList().Where(x => !SelectedBlowerTypes.Contains(x.HardwareBlowerType)).ToList().ForEach(x => realVersion.HardwareBlowers.Remove(x));
- realVersion.HardwareBreakSensors.ToList().Where(x => !SelectedBreakSensorTypes.Contains(x.HardwareBreakSensorType)).ToList().ForEach(x => realVersion.HardwareBreakSensors.Remove(x));
-
- realVersion.HardwareMotors.ToList().ForEach(x => x.HardwareVersionGuid = realVersion.Guid);
- realVersion.HardwareDancers.ToList().ForEach(x => x.HardwareVersionGuid = realVersion.Guid);
- realVersion.HardwarePidControls.ToList().ForEach(x => x.HardwareVersionGuid = realVersion.Guid);
- realVersion.HardwareWinders.ToList().ForEach(x => x.HardwareVersionGuid = realVersion.Guid);
- realVersion.HardwareSpeedSensors.ToList().ForEach(x => x.HardwareVersionGuid = realVersion.Guid);
- realVersion.HardwareBlowers.ToList().ForEach(x => x.HardwareVersionGuid = realVersion.Guid);
- realVersion.HardwareBreakSensors.ToList().ForEach(x => x.HardwareVersionGuid = realVersion.Guid);
+ IsFree = false;
- realVersion.HardwareMotors.ToList().ForEach(x => x.HardwareVersion = realVersion);
- realVersion.HardwareDancers.ToList().ForEach(x => x.HardwareVersion = realVersion);
- realVersion.HardwarePidControls.ToList().ForEach(x => x.HardwareVersion = realVersion);
- realVersion.HardwareWinders.ToList().ForEach(x => x.HardwareVersion = realVersion);
- realVersion.HardwareSpeedSensors.ToList().ForEach(x => x.HardwareVersion = realVersion);
- realVersion.HardwareBlowers.ToList().ForEach(x => x.HardwareVersion = realVersion);
- realVersion.HardwareBreakSensors.ToList().ForEach(x => x.HardwareVersion = realVersion);
-
- Adapter.Context.HardwareVersions.Add(realVersion);
- realVersion.Save(Adapter.Context);
+ await Task.Factory.StartNew(() =>
+ {
+ var cloned = CurrentVersion.Clone();
+ cloned.Name = name;
+ cloned.Version = HardwareVersions.Max(x => x.Version) + 1;
+ _db.HardwareVersions.Add(cloned);
+ _db.SaveChanges();
+ RefreshVersions();
- SelectedVersion = Adapter.HardwareVersions.SingleOrDefault(x => x.Guid == realVersion.Guid);
- });
+ InvokeUI(() =>
+ {
+ SelectedVersion = HardwareVersions.SingleOrDefault(x => x.Guid == cloned.Guid);
+ });
+ });
+ }
+ catch (Exception ex)
+ {
+ LogManager.Log(ex, "Could not clone hardware version.");
+ _notification.ShowError($"An error occurred while trying to clone this hardware version.\n{ex.Message}");
+ }
+ finally
+ {
+ IsFree = true;
+ }
}
}
}
+
}
- private void Delete()
+ private async void Delete()
{
if (_notification.ShowQuestion("Are you sure you want to delete this hardware version?"))
{
using (_notification.PushTaskItem("Deleting hardware version..."))
{
- SelectedVersion.DeleteAsync(Adapter.Context);
- SelectedVersion = null;
- CurrentVersion = null;
+ try
+ {
+ IsFree = false;
+
+ await CurrentVersion.DeleteCascadeAsync(_db);
+
+ await Task.Factory.StartNew(() =>
+ {
+ SelectedVersion = null;
+ RefreshVersions();
+
+ CurrentVersion = new HardwareVersion();
+ CreateDefaultView();
+ InvalidateRelayCommands();
+ });
+ }
+ catch (Exception ex)
+ {
+ LogManager.Log(ex, "Could not delete hardware version.");
+ _notification.ShowError($"An error occurred while trying to delete this hardware version.\n{ex.Message}");
+ }
+ finally
+ {
+ IsFree = true;
+ }
}
}
}
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 86e0da5b5..293b947f0 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,7 +14,7 @@
xmlns:observables="clr-namespace:Tango.BL.Entities;assembly=Tango.BL"
xmlns:global="clr-namespace:Tango.MachineStudio.HardwareDesigner"
mc:Ignorable="d"
- d:DesignHeight="720" d:DesignWidth="1280" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}">
+ 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" />
@@ -57,7 +57,7 @@
<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" />
- <ComboBox ItemsSource="{Binding Adapter.HardwareVersions}" SelectedItem="{Binding SelectedVersion}" Width="300" FontSize="16" FontWeight="Bold" Margin="5 0 0 0" materialDesign:HintAssist.Hint="Hardware Version">
+ <ComboBox IsEnabled="{Binding IsFree}" ItemsSource="{Binding HardwareVersions}" SelectedItem="{Binding SelectedVersion}" Width="300" 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="Gray" FontSize="14">v</Run><Run Foreground="Gray" FontSize="14" Text="{Binding Version}"></Run></TextBlock>
@@ -72,22 +72,22 @@
<Grid Grid.Row="1">
- <ScrollViewer VerticalScrollBarVisibility="Auto" Margin="50 20 0 0">
+ <ScrollViewer VerticalScrollBarVisibility="Auto" Margin="50 20 0 0" IsEnabled="{Binding IsFree}">
<StackPanel>
<StackPanel Orientation="Horizontal">
<Image VerticalAlignment="Center" Source="../Images/engine.png" Width="32"></Image>
<TextBlock Margin="10 0 0 0" VerticalAlignment="Center" FontSize="18" FontWeight="SemiBold">MOTORS</TextBlock>
</StackPanel>
- <ListBox Style="{StaticResource typesList}" HorizontalContentAlignment="Stretch" ItemsSource="{Binding MotorTypes}" Margin="60 15" SelectedItem="{Binding SelectedHardwareObjectType}">
+ <ListBox Style="{StaticResource typesList}" HorizontalContentAlignment="Stretch" ItemsSource="{Binding CurrentVersion.HardwareMotors}" Margin="60 15" SelectedItem="{Binding SelectedHardwareObject}">
<ListBox.ItemTemplate>
- <DataTemplate DataType="{x:Type entities:HardwareMotorType}">
+ <DataTemplate DataType="{x:Type entities:HardwareMotor}">
<DockPanel>
<Button DockPanel.Dock="Right" Cursor="Hand" Foreground="DimGray" Height="20" FontSize="10" ToolTip="Copy this item parameters to the selected item" Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.CopyParametersCommand}" CommandParameter="{Binding}">
<Button.Style>
<Style TargetType="Button" BasedOn="{StaticResource MaterialDesignFlatButton}">
<Setter Property="Visibility" Value="Collapsed"></Setter>
<Style.Triggers>
- <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.SelectedHardwareObjectType.Data.ObjectType.BaseType}" Value="{x:Type entities:HardwareMotorType}">
+ <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.SelectedHardwareObject.ObjectType.BaseType}" Value="{x:Type entities:HardwareMotor}">
<Setter Property="Visibility" Value="Visible"></Setter>
</DataTrigger>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=ListBoxItem},Path=IsSelected}" Value="True">
@@ -104,8 +104,8 @@
</Button.Content>
</Button>
<StackPanel Orientation="Horizontal">
- <CheckBox VerticalAlignment="Center" IsChecked="{Binding IsSelected}"></CheckBox>
- <TextBlock Margin="10 0 0 0" VerticalAlignment="Center" Text="{Binding Data.Description}"></TextBlock>
+ <CheckBox VerticalAlignment="Center" IsChecked="{Binding Active}"></CheckBox>
+ <TextBlock Margin="10 0 0 0" VerticalAlignment="Center" Text="{Binding HardwareMotorType.Description}"></TextBlock>
</StackPanel>
</DockPanel>
</DataTemplate>
@@ -116,16 +116,16 @@
<Image VerticalAlignment="Center" Source="../Images/compass.png" Width="32"></Image>
<TextBlock Margin="10 0 0 0" VerticalAlignment="Center" FontSize="18" FontWeight="SemiBold">DANCERS</TextBlock>
</StackPanel>
- <ListBox Style="{StaticResource typesList}" HorizontalContentAlignment="Stretch" ItemsSource="{Binding DancerTypes}" Margin="60 15" SelectedItem="{Binding SelectedHardwareObjectType}">
+ <ListBox Style="{StaticResource typesList}" HorizontalContentAlignment="Stretch" ItemsSource="{Binding CurrentVersion.HardwareDancers}" Margin="60 15" SelectedItem="{Binding SelectedHardwareObject}">
<ListBox.ItemTemplate>
- <DataTemplate DataType="{x:Type entities:HardwareDancerType}">
+ <DataTemplate DataType="{x:Type entities:HardwareDancer}">
<DockPanel>
<Button DockPanel.Dock="Right" Cursor="Hand" Foreground="DimGray" Height="20" FontSize="10" ToolTip="Copy this item parameters to the selected item" Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.CopyParametersCommand}" CommandParameter="{Binding}">
<Button.Style>
<Style TargetType="Button" BasedOn="{StaticResource MaterialDesignFlatButton}">
<Setter Property="Visibility" Value="Collapsed"></Setter>
<Style.Triggers>
- <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.SelectedHardwareObjectType.Data.ObjectType.BaseType}" Value="{x:Type entities:HardwareDancerType}">
+ <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.SelectedHardwareObject.ObjectType.BaseType}" Value="{x:Type entities:HardwareDancer}">
<Setter Property="Visibility" Value="Visible"></Setter>
</DataTrigger>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=ListBoxItem},Path=IsSelected}" Value="True">
@@ -142,8 +142,8 @@
</Button.Content>
</Button>
<StackPanel Orientation="Horizontal">
- <CheckBox VerticalAlignment="Center" IsChecked="{Binding IsSelected}"></CheckBox>
- <TextBlock Margin="10 0 0 0" VerticalAlignment="Center" Text="{Binding Data.Description}"></TextBlock>
+ <CheckBox VerticalAlignment="Center" IsChecked="{Binding Active}"></CheckBox>
+ <TextBlock Margin="10 0 0 0" VerticalAlignment="Center" Text="{Binding HardwareDancerType.Description}"></TextBlock>
</StackPanel>
</DockPanel>
</DataTemplate>
@@ -154,16 +154,16 @@
<Image VerticalAlignment="Center" Source="../Images/balance.png" Width="32"></Image>
<TextBlock Margin="10 0 0 0" VerticalAlignment="Center" FontSize="18" FontWeight="SemiBold">PID CONTROLS</TextBlock>
</StackPanel>
- <ListBox Style="{StaticResource typesList}" HorizontalContentAlignment="Stretch" ItemsSource="{Binding PidControlTypes}" Margin="60 15" SelectedItem="{Binding SelectedHardwareObjectType}">
+ <ListBox Style="{StaticResource typesList}" HorizontalContentAlignment="Stretch" ItemsSource="{Binding CurrentVersion.HardwarePidControls}" Margin="60 15" SelectedItem="{Binding SelectedHardwareObject}">
<ListBox.ItemTemplate>
- <DataTemplate DataType="{x:Type entities:HardwarePidControlType}">
+ <DataTemplate DataType="{x:Type entities:HardwarePidControl}">
<DockPanel>
<Button DockPanel.Dock="Right" Cursor="Hand" Foreground="DimGray" Height="20" FontSize="10" ToolTip="Copy this item parameters to the selected item" Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.CopyParametersCommand}" CommandParameter="{Binding}">
<Button.Style>
<Style TargetType="Button" BasedOn="{StaticResource MaterialDesignFlatButton}">
<Setter Property="Visibility" Value="Collapsed"></Setter>
<Style.Triggers>
- <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.SelectedHardwareObjectType.Data.ObjectType.BaseType}" Value="{x:Type entities:HardwarePidControlType}">
+ <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.SelectedHardwareObject.ObjectType.BaseType}" Value="{x:Type entities:HardwarePidControl}">
<Setter Property="Visibility" Value="Visible"></Setter>
</DataTrigger>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=ListBoxItem},Path=IsSelected}" Value="True">
@@ -180,8 +180,8 @@
</Button.Content>
</Button>
<StackPanel Orientation="Horizontal">
- <CheckBox VerticalAlignment="Center" IsChecked="{Binding IsSelected}"></CheckBox>
- <TextBlock Margin="10 0 0 0" VerticalAlignment="Center" Text="{Binding Data.Description}"></TextBlock>
+ <CheckBox VerticalAlignment="Center" IsChecked="{Binding Active}"></CheckBox>
+ <TextBlock Margin="10 0 0 0" VerticalAlignment="Center" Text="{Binding HardwarePidControlType.Description}"></TextBlock>
</StackPanel>
</DockPanel>
</DataTemplate>
@@ -192,16 +192,16 @@
<Image VerticalAlignment="Center" Source="../Images/thread.png" Width="32"></Image>
<TextBlock Margin="10 0 0 0" VerticalAlignment="Center" FontSize="18" FontWeight="SemiBold">WINDERS</TextBlock>
</StackPanel>
- <ListBox Style="{StaticResource typesList}" HorizontalContentAlignment="Stretch" ItemsSource="{Binding WinderTypes}" Margin="60 15" SelectedItem="{Binding SelectedHardwareObjectType}">
+ <ListBox Style="{StaticResource typesList}" HorizontalContentAlignment="Stretch" ItemsSource="{Binding CurrentVersion.HardwareWinders}" Margin="60 15" SelectedItem="{Binding SelectedHardwareObject}">
<ListBox.ItemTemplate>
- <DataTemplate DataType="{x:Type entities:HardwareWinderType}">
+ <DataTemplate DataType="{x:Type entities:HardwareWinder}">
<DockPanel>
<Button DockPanel.Dock="Right" Cursor="Hand" Foreground="DimGray" Height="20" FontSize="10" ToolTip="Copy this item parameters to the selected item" Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.CopyParametersCommand}" CommandParameter="{Binding}">
<Button.Style>
<Style TargetType="Button" BasedOn="{StaticResource MaterialDesignFlatButton}">
<Setter Property="Visibility" Value="Collapsed"></Setter>
<Style.Triggers>
- <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.SelectedHardwareObjectType.Data.ObjectType.BaseType}" Value="{x:Type entities:HardwareWinderType}">
+ <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.SelectedHardwareObject.ObjectType.BaseType}" Value="{x:Type entities:HardwareWinder}">
<Setter Property="Visibility" Value="Visible"></Setter>
</DataTrigger>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=ListBoxItem},Path=IsSelected}" Value="True">
@@ -218,8 +218,8 @@
</Button.Content>
</Button>
<StackPanel Orientation="Horizontal">
- <CheckBox VerticalAlignment="Center" IsChecked="{Binding IsSelected}"></CheckBox>
- <TextBlock Margin="10 0 0 0" VerticalAlignment="Center" Text="{Binding Data.Description}"></TextBlock>
+ <CheckBox VerticalAlignment="Center" IsChecked="{Binding Active}"></CheckBox>
+ <TextBlock Margin="10 0 0 0" VerticalAlignment="Center" Text="{Binding HardwareWinderType.Description}"></TextBlock>
</StackPanel>
</DockPanel>
</DataTemplate>
@@ -230,16 +230,16 @@
<Image VerticalAlignment="Center" Source="../Images/speed.png" Width="32"></Image>
<TextBlock Margin="10 0 0 0" VerticalAlignment="Center" FontSize="18" FontWeight="SemiBold">SPEED SENSORS</TextBlock>
</StackPanel>
- <ListBox Style="{StaticResource typesList}" HorizontalContentAlignment="Stretch" ItemsSource="{Binding SpeedSensorTypes}" Margin="60 15" SelectedItem="{Binding SelectedHardwareObjectType}">
+ <ListBox Style="{StaticResource typesList}" HorizontalContentAlignment="Stretch" ItemsSource="{Binding CurrentVersion.HardwareSpeedSensors}" Margin="60 15" SelectedItem="{Binding SelectedHardwareObject}">
<ListBox.ItemTemplate>
- <DataTemplate DataType="{x:Type entities:HardwareSpeedSensorType}">
+ <DataTemplate DataType="{x:Type entities:HardwareSpeedSensor}">
<DockPanel>
<Button DockPanel.Dock="Right" Cursor="Hand" Foreground="DimGray" Height="20" FontSize="10" ToolTip="Copy this item parameters to the selected item" Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.CopyParametersCommand}" CommandParameter="{Binding}">
<Button.Style>
<Style TargetType="Button" BasedOn="{StaticResource MaterialDesignFlatButton}">
<Setter Property="Visibility" Value="Collapsed"></Setter>
<Style.Triggers>
- <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.SelectedHardwareObjectType.Data.ObjectType.BaseType}" Value="{x:Type entities:HardwareSpeedSensorType}">
+ <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.SelectedHardwareObject.ObjectType.BaseType}" Value="{x:Type entities:HardwareSpeedSensor}">
<Setter Property="Visibility" Value="Visible"></Setter>
</DataTrigger>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=ListBoxItem},Path=IsSelected}" Value="True">
@@ -256,8 +256,8 @@
</Button.Content>
</Button>
<StackPanel Orientation="Horizontal">
- <CheckBox VerticalAlignment="Center" IsChecked="{Binding IsSelected}"></CheckBox>
- <TextBlock Margin="10 0 0 0" VerticalAlignment="Center" Text="{Binding Data.Description}"></TextBlock>
+ <CheckBox VerticalAlignment="Center" IsChecked="{Binding Active}"></CheckBox>
+ <TextBlock Margin="10 0 0 0" VerticalAlignment="Center" Text="{Binding HardwareSpeedSensorType.Description}"></TextBlock>
</StackPanel>
</DockPanel>
</DataTemplate>
@@ -268,16 +268,16 @@
<Image VerticalAlignment="Center" Source="../Images/blower.png" Width="32"></Image>
<TextBlock Margin="10 0 0 0" VerticalAlignment="Center" FontSize="18" FontWeight="SemiBold">BLOWERS</TextBlock>
</StackPanel>
- <ListBox Style="{StaticResource typesList}" HorizontalContentAlignment="Stretch" ItemsSource="{Binding BlowerTypes}" Margin="60 15" SelectedItem="{Binding SelectedHardwareObjectType}">
+ <ListBox Style="{StaticResource typesList}" HorizontalContentAlignment="Stretch" ItemsSource="{Binding CurrentVersion.HardwareBlowers}" Margin="60 15" SelectedItem="{Binding SelectedHardwareObject}">
<ListBox.ItemTemplate>
- <DataTemplate DataType="{x:Type entities:HardwareBlowerType}">
+ <DataTemplate DataType="{x:Type entities:HardwareBlower}">
<DockPanel>
<Button DockPanel.Dock="Right" Cursor="Hand" Foreground="DimGray" Height="20" FontSize="10" ToolTip="Copy this item parameters to the selected item" Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.CopyParametersCommand}" CommandParameter="{Binding}">
<Button.Style>
<Style TargetType="Button" BasedOn="{StaticResource MaterialDesignFlatButton}">
<Setter Property="Visibility" Value="Collapsed"></Setter>
<Style.Triggers>
- <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.SelectedHardwareObjectType.Data.ObjectType.BaseType}" Value="{x:Type entities:HardwareBlowerType}">
+ <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.SelectedHardwareObject.ObjectType.BaseType}" Value="{x:Type entities:HardwareBlower}">
<Setter Property="Visibility" Value="Visible"></Setter>
</DataTrigger>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=ListBoxItem},Path=IsSelected}" Value="True">
@@ -294,8 +294,8 @@
</Button.Content>
</Button>
<StackPanel Orientation="Horizontal">
- <CheckBox VerticalAlignment="Center" IsChecked="{Binding IsSelected}"></CheckBox>
- <TextBlock Margin="10 0 0 0" VerticalAlignment="Center" Text="{Binding Data.Description}"></TextBlock>
+ <CheckBox VerticalAlignment="Center" IsChecked="{Binding Active}"></CheckBox>
+ <TextBlock Margin="10 0 0 0" VerticalAlignment="Center" Text="{Binding HardwareBlowerType.Description}"></TextBlock>
</StackPanel>
</DockPanel>
</DataTemplate>
@@ -306,16 +306,16 @@
<Image VerticalAlignment="Center" Source="../Images/break.png" Width="32"></Image>
<TextBlock Margin="10 0 0 0" VerticalAlignment="Center" FontSize="18" FontWeight="SemiBold">BREAK SENSORS</TextBlock>
</StackPanel>
- <ListBox Style="{StaticResource typesList}" HorizontalContentAlignment="Stretch" ItemsSource="{Binding BreakSensorTypes}" Margin="60 15" SelectedItem="{Binding SelectedHardwareObjectType}">
+ <ListBox Style="{StaticResource typesList}" HorizontalContentAlignment="Stretch" ItemsSource="{Binding CurrentVersion.HardwareBreakSensors}" Margin="60 15" SelectedItem="{Binding SelectedHardwareObject}">
<ListBox.ItemTemplate>
- <DataTemplate DataType="{x:Type entities:HardwareBreakSensorType}">
+ <DataTemplate DataType="{x:Type entities:HardwareBreakSensor}">
<DockPanel>
<Button DockPanel.Dock="Right" Cursor="Hand" Foreground="DimGray" Height="20" FontSize="10" ToolTip="Copy this item parameters to the selected item" Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.CopyParametersCommand}" CommandParameter="{Binding}">
<Button.Style>
<Style TargetType="Button" BasedOn="{StaticResource MaterialDesignFlatButton}">
<Setter Property="Visibility" Value="Collapsed"></Setter>
<Style.Triggers>
- <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.SelectedHardwareObjectType.Data.ObjectType.BaseType}" Value="{x:Type entities:HardwareBreakSensorType}">
+ <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.SelectedHardwareObject.ObjectType.BaseType}" Value="{x:Type entities:HardwareBreakSensor}">
<Setter Property="Visibility" Value="Visible"></Setter>
</DataTrigger>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=ListBoxItem},Path=IsSelected}" Value="True">
@@ -332,8 +332,8 @@
</Button.Content>
</Button>
<StackPanel Orientation="Horizontal">
- <CheckBox VerticalAlignment="Center" IsChecked="{Binding IsSelected}"></CheckBox>
- <TextBlock Margin="10 0 0 0" VerticalAlignment="Center" Text="{Binding Data.Description}"></TextBlock>
+ <CheckBox VerticalAlignment="Center" IsChecked="{Binding Active}"></CheckBox>
+ <TextBlock Margin="10 0 0 0" VerticalAlignment="Center" Text="{Binding HardwareBreakSensorType.Description}"></TextBlock>
</StackPanel>
</DockPanel>
</DataTemplate>
@@ -353,7 +353,7 @@
<RowDefinition Height="60"/>
</Grid.RowDefinitions>
- <ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto" Margin="0 90 0 10">
+ <ScrollViewer IsEnabled="{Binding IsFree}" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto" Margin="0 90 0 10">
<Grid>
<StackPanel>
<materialDesign:Card Margin="5,10,5,0" Background="{DynamicResource MaterialDesignBackground}" Padding="20 10">
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/App.config b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/App.config
index 2031d1be1..2031d386f 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/App.config
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/App.config
@@ -56,6 +56,10 @@
<assemblyIdentity name="System.Diagnostics.StackTrace" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
</dependentAssembly>
+ <dependentAssembly>
+ <assemblyIdentity name="System.Xml.ReaderWriter" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" />
+ </dependentAssembly>
</assemblyBinding>
</runtime>
</configuration> \ No newline at end of file
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Properties/AssemblyInfo.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Properties/AssemblyInfo.cs
index 8f69fb919..f0713376c 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Properties/AssemblyInfo.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Properties/AssemblyInfo.cs
@@ -5,7 +5,7 @@ using System.Runtime.InteropServices;
using System.Windows;
[assembly: AssemblyTitle("Tango - Machine Studio Logging Module")]
-[assembly: AssemblyVersion("2.0.15.1633")]
+[assembly: AssemblyVersion("2.0.17.1159")]
[assembly: ComVisible(false)]
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Tango.MachineStudio.Logging.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Tango.MachineStudio.Logging.csproj
index f3318f275..f14bfade4 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Tango.MachineStudio.Logging.csproj
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Tango.MachineStudio.Logging.csproj
@@ -8,7 +8,7 @@
<OutputType>library</OutputType>
<RootNamespace>Tango.MachineStudio.Logging</RootNamespace>
<AssemblyName>Tango.MachineStudio.Logging</AssemblyName>
- <TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
+ <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/EventsViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/EventsViewVM.cs
index 50caced63..68094d91f 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/EventsViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/EventsViewVM.cs
@@ -14,6 +14,7 @@ using Tango.MachineStudio.Common.StudioApplication;
using Tango.MachineStudio.Logging.Navigation;
using Tango.MachineStudio.Logging.Views;
using Tango.SharedUI;
+using System.Data.Entity;
namespace Tango.MachineStudio.Logging.ViewModels
{
@@ -23,15 +24,22 @@ namespace Tango.MachineStudio.Logging.ViewModels
private IStudioApplicationManager _application;
private IEventLogger _eventLogger;
private ObservableCollection<MachinesEvent> _realTimeEvents;
- private Machine _connectedMachine;
private LoggingNavigationManager _navigation;
private bool _dialog_shown;
+ private ObservablesContext _db;
+ private List<MachinesEvent> _history_events;
private Machine _selectedMachine;
public Machine SelectedMachine
{
get { return _selectedMachine; }
- set { _selectedMachine = value; RaisePropertyChangedAuto(); OnSelectedMachineChanged(); }
+ set
+ {
+ if (_selectedMachine != value)
+ {
+ _selectedMachine = value; RaisePropertyChangedAuto(); OnSelectedMachineChanged();
+ }
+ }
}
private ObservableCollection<MachinesEvent> _events;
@@ -76,7 +84,6 @@ namespace Tango.MachineStudio.Logging.ViewModels
set { _maxDate = value; RaisePropertyChangedAuto(); }
}
-
private bool _isRealTime;
public bool IsRealTime
{
@@ -109,25 +116,11 @@ namespace Tango.MachineStudio.Logging.ViewModels
_realTimeEvents = new ObservableCollection<MachinesEvent>();
_eventLogger.NewLog += _eventLogger_NewLog;
- RegisterMessage<MachineConnectionChangedMessage>(OnMachineConnectionChanged);
DisplayTimelineCommand = new RelayCommand<MachinesEvent>(DisplayTimeline);
NavigateToEventsCommand = new RelayCommand(() => _navigation.NavigateTo(LoggingNavigationView.EventsView));
NavigateToHomeCommand = new RelayCommand(() => _navigation.NavigateTo(LoggingNavigationView.HomeView));
}
- private void OnMachineConnectionChanged(MachineConnectionChangedMessage msg)
- {
- if (msg.Machine != null)
- {
- _connectedMachine = ObservablesEntitiesAdapter.Instance.Machines.SingleOrDefault(x => x.SerialNumber == msg.Machine.SerialNumber);
- SelectedMachine = _connectedMachine;
- }
- else
- {
- _connectedMachine = null;
- }
- }
-
private void _eventLogger_NewLog(object sender, MachinesEvent machineEvent)
{
InvokeUI(() =>
@@ -136,29 +129,40 @@ namespace Tango.MachineStudio.Logging.ViewModels
});
}
- private void OnSelectedMachineChanged()
+ private async void OnSelectedMachineChanged()
{
if (SelectedMachine != null)
{
- Dates = new ObservableCollection<DateTime>();
-
- if (SelectedMachine == _connectedMachine)
+ using (_notification.PushTaskItem("Loading machine events..."))
{
- IsRealTime = true;
- }
+ await Task.Factory.StartNew(() =>
+ {
+ _db = ObservablesContext.CreateDefault();
- foreach (var day in SelectedMachine.MachinesEvents.GroupBy(x => x.DateTime.DayOfYear).Select(x => x.First().DateTime).OrderByDescending(x => x))
- {
- Dates.Add(day);
- }
+ _db.EventTypes.Load();
+ _db.EventTypesCategories.Load();
+ _db.EventTypesGroups.Load();
- if (Dates.Count > 0)
- {
- MinDate = Dates.Min();
- MaxDate = Dates.Max();
- }
+ DateTime now = DateTime.UtcNow.AddMonths(-1);
- SelectedDate = Dates.FirstOrDefault();
+ _history_events = _db.MachinesEvents.Where(x => x.MachineGuid == SelectedMachine.Guid && x.DateTime > now).ToList();
+
+ Dates = new ObservableCollection<DateTime>();
+
+ foreach (var day in _history_events.GroupBy(x => x.DateTime.DayOfYear).Select(x => x.First().DateTime).OrderByDescending(x => x))
+ {
+ Dates.Add(day);
+ }
+
+ if (Dates.Count > 0)
+ {
+ MinDate = Dates.Min();
+ MaxDate = Dates.Max();
+ }
+
+ SelectedDate = Dates.FirstOrDefault();
+ });
+ }
}
}
@@ -170,9 +174,9 @@ namespace Tango.MachineStudio.Logging.ViewModels
{
Events = _realTimeEvents;
}
- else
+ else if (_history_events != null)
{
- Events = SelectedMachine.MachinesEvents.Where(x => x.DateTime.DayOfYear == SelectedDate.Date.DayOfYear).OrderByDescending(x => x.DateTime).ToObservableCollection();
+ Events = _history_events.Where(x => x.DateTime.DayOfYear == SelectedDate.Date.DayOfYear).OrderByDescending(x => x.DateTime).ToObservableCollection();
}
}
}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/AutoComplete/MachineVersionsProvider.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/AutoComplete/MachineVersionsProvider.cs
index 18cfca79d..75b4718cd 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/AutoComplete/MachineVersionsProvider.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/AutoComplete/MachineVersionsProvider.cs
@@ -21,7 +21,7 @@ namespace Tango.MachineStudio.MachineDesigner.AutoComplete
public IEnumerable GetSuggestions(string filter)
{
Text = filter;
- return ObservablesEntitiesAdapter.Instance.MachineVersions.Where(x => x.Version.ToString().StartsWith(filter, StringComparison.CurrentCultureIgnoreCase) || x.Name.StartsWith(filter, StringComparison.CurrentCultureIgnoreCase)).ToList();
+ return ObservablesStaticCollections.Instance.MachineVersions.Where(x => x.Version.ToString().StartsWith(filter, StringComparison.CurrentCultureIgnoreCase) || x.Name.StartsWith(filter, StringComparison.CurrentCultureIgnoreCase)).ToList();
}
}
}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/AutoComplete/MachinesProvider.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/AutoComplete/MachinesProvider.cs
deleted file mode 100644
index 01b74e8a6..000000000
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/AutoComplete/MachinesProvider.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using Tango.AutoComplete.Editors;
-using Tango.BL;
-using Tango.BL.Entities;
-
-namespace Tango.MachineStudio.MachineDesigner.AutoComplete
-{
- /// <summary>
- /// Represents an auto-complete <see cref="Machine">Machines</see> provider.
- /// </summary>
- /// <seealso cref="Tango.AutoComplete.Editors.ISuggestionProvider" />
- public class MachinesProvider : ISuggestionProvider
- {
- /// <summary>
- /// Gets the suggestions.
- /// </summary>
- /// <param name="filter">The filter.</param>
- /// <returns></returns>
- public IEnumerable GetSuggestions(string filter)
- {
- return ObservablesEntitiesAdapter.Instance.Machines.Where(x => x.SerialNumber.StartsWith(filter, StringComparison.CurrentCultureIgnoreCase)).ToList();
- }
- }
-}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Properties/AssemblyInfo.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Properties/AssemblyInfo.cs
index 832feca43..a5e99504c 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Properties/AssemblyInfo.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Properties/AssemblyInfo.cs
@@ -5,7 +5,7 @@ using System.Runtime.InteropServices;
using System.Windows;
[assembly: AssemblyTitle("Tango - Machine Studio Machine Designer Module")]
-[assembly: AssemblyVersion("2.0.8.1633")]
+[assembly: AssemblyVersion("2.0.10.1159")]
[assembly: ComVisible(false)]
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 0d6708246..a578d0e54 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
@@ -8,7 +8,7 @@
<OutputType>library</OutputType>
<RootNamespace>Tango.MachineStudio.MachineDesigner</RootNamespace>
<AssemblyName>Tango.MachineStudio.MachineDesigner</AssemblyName>
- <TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
+ <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
@@ -31,6 +31,12 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
+ <Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
+ <HintPath>..\..\..\packages\EntityFramework.6.0.0\lib\net45\EntityFramework.dll</HintPath>
+ </Reference>
+ <Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
+ <HintPath>..\..\..\packages\EntityFramework.6.0.0\lib\net45\EntityFramework.SqlServer.dll</HintPath>
+ </Reference>
<Reference Include="FontAwesome.WPF, Version=4.7.0.37774, Culture=neutral, PublicKeyToken=0758b07a11a4f466, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\FontAwesome.WPF.4.7.0.9\lib\net40\FontAwesome.WPF.dll</HintPath>
</Reference>
@@ -47,6 +53,7 @@
<HintPath>..\..\..\packages\SimpleValidator.0.6.1.0\lib\net40\SimpleValidator.dll</HintPath>
</Reference>
<Reference Include="System" />
+ <Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Data" />
<Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Expression.Blend.Sdk.1.0.2\lib\net45\System.Windows.Interactivity.dll</HintPath>
@@ -68,7 +75,6 @@
<Compile Include="..\..\..\Versioning\GlobalVersionInfo.cs">
<Link>GlobalVersionInfo.cs</Link>
</Compile>
- <Compile Include="AutoComplete\MachinesProvider.cs" />
<Compile Include="AutoComplete\MachineVersionsProvider.cs" />
<Compile Include="ViewModelLocator.cs" />
<Compile Include="ViewModels\MachineVersionDialogVM.cs" />
@@ -114,7 +120,9 @@
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
- <None Include="app.config" />
+ <None Include="app.config">
+ <SubType>Designer</SubType>
+ </None>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
@@ -224,7 +232,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/MachineVersionDialogVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MachineVersionDialogVM.cs
index 40358344d..b332ebc6b 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MachineVersionDialogVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MachineVersionDialogVM.cs
@@ -14,7 +14,7 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
{
public class MachineVersionDialogVM : DialogViewVM
{
- public ObservablesEntitiesAdapter Adapter { get; set; }
+ public ObservablesStaticCollections Adapter { get; set; }
public double Version { get; set; }
@@ -46,7 +46,7 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
public MachineVersionDialogVM()
{
- Adapter = ObservablesEntitiesAdapter.Instance;
+ Adapter = ObservablesStaticCollections.Instance;
AcceptCommand = new RelayCommand(() =>
{
Accept();
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 1f410d49c..de9a8de4a 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
@@ -16,27 +16,39 @@ using SimpleValidator.Extensions;
using Tango.MachineStudio.Common.StudioApplication;
using Tango.MachineStudio.Common;
using Tango.BL;
+using Tango.AutoComplete.Editors;
+using System.Data.Entity;
namespace Tango.MachineStudio.MachineDesigner.ViewModels
{
- public class MainViewVM : StudioViewModel<MachineDesignerModule>
+ public class MainViewVM : StudioViewModel
{
- private bool _isSaving;
private INotificationProvider _notification;
-
+ private ObservablesContext _db;
+ private Configuration _original_configuration;
#region Properties
- private ObservablesEntitiesAdapter _adapter;
+ private ObservablesStaticCollections _adapter;
/// <summary>
- /// Gets or sets the db adapter.
+ /// Gets or sets the db static adapter.
/// </summary>
- public ObservablesEntitiesAdapter Adapter
+ public ObservablesStaticCollections Adapter
{
get { return _adapter; }
set { _adapter = value; RaisePropertyChangedAuto(); }
}
+ private bool _canWork;
+ /// <summary>
+ /// Gets or sets a value indicating whether this instance can work.
+ /// </summary>
+ public bool CanWork
+ {
+ get { return _canWork; }
+ set { _canWork = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); }
+ }
+
private Machine _machine;
/// <summary>
/// Gets or sets the current editable machine.
@@ -54,7 +66,13 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
public Machine SelectedMachine
{
get { return _selectedMachine; }
- set { _selectedMachine = value; RaisePropertyChangedAuto(); OnSelectedMachineChanged(); }
+ set
+ {
+ if (_selectedMachine != value)
+ {
+ _selectedMachine = value; RaisePropertyChangedAuto(); OnSelectedMachineChanged();
+ }
+ }
}
private Configuration _configuration;
@@ -107,6 +125,11 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
set { _filter = value; RaisePropertyChangedAuto(); OnFilterChanged(); }
}
+ /// <summary>
+ /// Gets or sets the machines provider.
+ /// </summary>
+ public ISuggestionProvider MachinesProvider { get; set; }
+
#endregion
#region Commands
@@ -136,6 +159,11 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
/// </summary>
public RelayCommand SetAsDefaultCommand { get; set; }
+ /// <summary>
+ /// Gets or sets the reset command.
+ /// </summary>
+ public RelayCommand ResetCommand { get; set; }
+
#endregion
#region Constructors
@@ -150,23 +178,81 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
/// </summary>
public MainViewVM(INotificationProvider notification)
{
+ CanWork = true;
+
_notification = notification;
- Adapter = ObservablesEntitiesAdapter.Instance;
Configuration = new Configuration();
Configuration.Name = "Untitled";
Machine = new Machine();
Machine.Configuration = Configuration;
- SaveCommand = new RelayCommand(Save, (x) => !_isSaving);
- AddIdsCommand = new RelayCommand(AddIds, (x) => !_isSaving && Configuration.IdsPacks.Count < 8);
- RemoveIdsCommand = new RelayCommand(RemoveIds, (x) => !_isSaving && SelectedIds != null);
- SetVersionConfigurationCommand = new RelayCommand(SetVersionConfiguration, (x) => !_isSaving);
- SetAsDefaultCommand = new RelayCommand(SetAsDefaultConfiguration, (x) => !_isSaving);
+ SaveCommand = new RelayCommand(Save, (x) => CanWork);
+ AddIdsCommand = new RelayCommand(AddIds, (x) => CanWork && Configuration.IdsPacks.Count < 8);
+ RemoveIdsCommand = new RelayCommand(RemoveIds, (x) => CanWork && SelectedIds != null);
+ SetVersionConfigurationCommand = new RelayCommand(SetVersionConfiguration, (x) => CanWork);
+ SetAsDefaultCommand = new RelayCommand(SetAsDefaultConfiguration, (x) => CanWork);
+ ResetCommand = new RelayCommand(Reset, () => CanWork);
+
+ MachinesProvider = new SuggestionProvider((filter) =>
+ {
+ return _db.Machines.Where(x => x.SerialNumber.StartsWith(filter)).ToList();
+ });
+ }
+
+ #endregion
+
+ #region Application Ready
+
+ public async override void OnApplicationReady()
+ {
+ await InitCollections();
}
#endregion
+ private Task InitCollections()
+ {
+ return Task.Factory.StartNew(() =>
+ {
+ CanWork = false;
+
+ _db = ObservablesContext.CreateDefault();
+
+ Adapter = new ObservablesStaticCollections();
+ Adapter.ApplicationDisplayPanelVersions = _db.ApplicationDisplayPanelVersions.ToObservableCollection();
+ Adapter.ApplicationFirmwareVersions = _db.ApplicationFirmwareVersions.ToObservableCollection();
+ Adapter.ApplicationOsVersions = _db.ApplicationOsVersions.ToObservableCollection();
+ Adapter.EmbeddedFirmwareVersions = _db.EmbeddedFirmwareVersions.ToObservableCollection();
+ Adapter.DispenserTypes = _db.DispenserTypes.ToObservableCollection();
+ Adapter.LiquidTypes = _db.LiquidTypes.ToObservableCollection();
+ Adapter.MidTankTypes = _db.MidTankTypes.ToObservableCollection();
+ Adapter.CartridgeTypes = _db.CartridgeTypes.ToObservableCollection();
+ Adapter.IdsPackFormulas = _db.IdsPackFormulas.ToObservableCollection();
+ Adapter.HardwareVersions = _db.HardwareVersions.ToObservableCollection();
+ Adapter.MachineVersions = _db.MachineVersions.ToObservableCollection();
+ Adapter.Organizations = _db.Organizations.ToObservableCollection();
+
+ Adapter.InitCollectionSources();
+
+ CanWork = true;
+ });
+ }
+
+ private void Reset()
+ {
+ using (_notification.PushTaskItem("Resetting designer..."))
+ {
+ SelectedMachine = null;
+ Machine = new Machine();
+ Configuration = new Configuration();
+ History = new ObservableCollection<Configuration>();
+ SelectedHistoryConfiguration = null;
+ Filter = String.Empty;
+ InitCollections();
+ }
+ }
+
#region Virtual Methods
/// <summary>
@@ -176,9 +262,23 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
{
if (SelectedMachine != null)
{
- Machine = SelectedMachine.Clone();
- Configuration = Machine.Configuration.Clone();
- History = SelectedMachine.MachinesConfigurations.Select(x => x.Configuration).ToObservableCollection();
+ CanWork = false;
+
+ using (_notification.PushTaskItem("Loading machine configuration..."))
+ {
+ Task.Factory.StartNew(() =>
+ {
+ InitCollections().Wait();
+ Machine = _db.Machines.Where(x => x.Guid == SelectedMachine.Guid).Include(x => x.Organization).SingleOrDefault(x => x.Guid == SelectedMachine.Guid);
+ Configuration = _db.Adapter.GetConfiguration(x => x.Guid == Machine.ConfigurationGuid);
+
+ SetHistory();
+
+ _original_configuration = Configuration.Clone();
+ });
+ }
+
+ CanWork = true;
}
else
{
@@ -191,9 +291,21 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
/// </summary>
protected virtual void OnHistoryConfigurationSelected()
{
- if (SelectedHistoryConfiguration != null)
+ if (SelectedHistoryConfiguration != null && CanWork)
{
- Configuration = SelectedHistoryConfiguration.Clone();
+ using (_notification.PushTaskItem("Loading Configuration..."))
+ {
+ Task.Factory.StartNew(() =>
+ {
+ CanWork = false;
+
+ SelectedHistoryConfiguration = _db.Adapter.GetConfiguration(x => x.Guid == SelectedHistoryConfiguration.Guid);
+ Configuration = SelectedHistoryConfiguration;
+ Machine.Configuration = Configuration;
+
+ CanWork = true;
+ });
+ }
}
}
@@ -202,8 +314,6 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
/// </summary>
protected virtual void OnFilterChanged()
{
-
-
List<ICollectionView> collections = new List<ICollectionView>();
collections.Add(Adapter.ApplicationFirmwareVersionsViewSource);
collections.Add(Adapter.ApplicationDisplayPanelVersionsViewSource);
@@ -223,7 +333,7 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
{
String value = prop.GetValue(x).ToStringSafe();
- if (value != null)
+ if (value != null && Filter != null)
{
if (value.ToLower().Contains(Filter.ToLower()))
{
@@ -366,7 +476,7 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
/// </summary>
private void RemoveIds()
{
- Configuration.IdsPacks.Remove(SelectedIds);
+ _db.IdsPacks.Remove(SelectedIds);
SelectedIds = null;
}
@@ -375,7 +485,7 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
/// </summary>
private void AddIds()
{
- Configuration.IdsPacks.Add(new IdsPack() { Configuration = Configuration });
+ _db.IdsPacks.Add(new IdsPack() { Configuration = Configuration });
InvalidateRelayCommands();
}
@@ -494,17 +604,17 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
//Validate
- _isSaving = true;
- InvalidateRelayCommands();
-
try
{
+ CanWork = false;
+
using (_notification.PushTaskItem("Saving Machine Configuration..."))
{
- if (!Adapter.Machines.ToList().Exists(x => x.SerialNumber.ToLower() == Machine.SerialNumber.ToLower()))
+ if (!_db.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
@@ -512,53 +622,34 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
Machine.Configuration = Configuration;
Configuration.CreationDate = DateTime.UtcNow;
Machine.ProductionDate = DateTime.UtcNow;
- Machine.MachinesConfigurations.Add(new MachinesConfiguration()
+
+ _db.Machines.Add(Machine);
+ _db.MachinesConfigurations.Add(new MachinesConfiguration()
{
Configuration = Configuration,
Machine = Machine,
});
- await Machine.SaveAsync(Adapter.Context);
-
- Machine = Adapter.Machines.SingleOrDefault(x => x.Guid == Machine.Guid);
- Configuration = Machine.Configuration.Clone();
}
}
else
{
- var machine = Adapter.Machines.Single(x => x.SerialNumber.ToLower() == Machine.SerialNumber.ToLower());
-
- //Set 'Real machine' parameters...
-
- bool add_history = History.Count == 0 || History.First().Name != Configuration.Name;
-
- machine.Name = Machine.Name;
- machine.SerialNumber = Machine.SerialNumber;
- machine.Organization = Machine.Organization;
-
+ bool add_history = History.Count == 0 || _original_configuration.Name != Configuration.Name;
if (add_history)
{
- machine.MachinesConfigurations.Add(new MachinesConfiguration()
+ _db.Configurations.Add(_original_configuration);
+
+ _db.MachinesConfigurations.Add(new MachinesConfiguration()
{
- Configuration = Configuration,
- Machine = machine
+ Configuration = _original_configuration,
+ Machine = Machine
});
}
- else
- {
- machine.Configuration.DefferedDelete(Adapter.Context);
- }
-
- machine.Configuration = Configuration;
-
- await machine.SaveAsync(Adapter.Context);
-
- Machine = Adapter.Machines.SingleOrDefault(x => x.Guid == machine.Guid);
- Configuration = Machine.Configuration.Clone();
}
- SetHistory(Machine);
- Machine = Machine.Clone();
+ await _db.SaveChangesAsync();
+ OnSelectedMachineChanged();
+
}
}
catch (Exception ex)
@@ -567,7 +658,7 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
}
finally
{
- _isSaving = false;
+ CanWork = true;
InvalidateRelayCommands();
}
}
@@ -576,20 +667,33 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
/// Sets the specified machine history.
/// </summary>
/// <param name="machine">The machine.</param>
- private void SetHistory(Machine machine)
+ private void SetHistory()
{
- History = machine.MachinesConfigurations.Select(x => x.Configuration).ToObservableCollection();
- History.Insert(0, machine.Configuration);
+ History = _db.MachinesConfigurations.Where(x => x.MachineGuid == Machine.Guid).Select(x => x.Configuration).ToObservableCollection();
+ //History.Insert(0, Machine.Configuration);
}
/// <summary>
/// Sets the current configuration to the selected machine version default configuration.
/// </summary>
- private void SetVersionConfiguration()
+ private async void SetVersionConfiguration()
{
if (Machine.MachineVersion != null)
{
- Configuration = Machine.MachineVersion.DefaultConfiguration.Clone();
+ using (_notification.PushTaskItem("Applying default configuration..."))
+ {
+ CanWork = false;
+
+ await Task.Factory.StartNew(() =>
+ {
+ var version = _db.MachineVersions.Where(x => x.Guid == Machine.MachineVersion.Guid).Include(x => x.DefaultConfiguration).FirstOrDefault();
+ var version_config = _db.Adapter.GetConfiguration(x => x.Guid == version.DefaultConfiguration.Guid);
+ Configuration = version_config.Clone();
+ Machine.Configuration = Configuration;
+ });
+
+ CanWork = true;
+ }
}
else
{
@@ -604,15 +708,23 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
{
_notification.ShowModalDialog<MachineVersionDialogVM>(async (vm) =>
{
+ CanWork = false;
+
try
{
using (_notification.PushTaskItem("Saving Default Configuration..."))
{
if (vm.SelectedVersion != null)
{
- vm.SelectedVersion.DefaultConfiguration = Configuration.Clone();
- vm.SelectedVersion.DefaultConfigurationGuid = vm.SelectedVersion.DefaultConfiguration.Guid;
- await vm.SelectedVersion.SaveAsync(Adapter.Context);
+ var version = _db.MachineVersions.Where(x => x.Guid == vm.SelectedVersion.Guid).Include(x => x.DefaultConfiguration).SingleOrDefault(x => x.Guid == vm.SelectedVersion.Guid);
+
+ _db.Configurations.Remove(version.DefaultConfiguration);
+
+ var cloned = Configuration.Clone();
+ _db.Configurations.Add(cloned);
+ version.DefaultConfiguration = cloned;
+
+ await _db.SaveChangesAsync();
}
else
{
@@ -620,9 +732,12 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
newVersion.Version = vm.Version;
newVersion.Name = vm.VersionName;
- newVersion.DefaultConfiguration = Configuration.Clone();
- newVersion.DefaultConfigurationGuid = newVersion.DefaultConfiguration.Guid;
- await newVersion.SaveAsync(Adapter.Context);
+ var cloned = Configuration.Clone();
+
+ _db.Configurations.Add(cloned);
+ newVersion.DefaultConfiguration = cloned;
+ _db.MachineVersions.Add(newVersion);
+ await _db.SaveChangesAsync();
}
}
}
@@ -630,6 +745,10 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
{
_notification.ShowError(ex.Message);
}
+ finally
+ {
+ CanWork = true;
+ }
}, () =>
{
@@ -638,14 +757,5 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
}
#endregion
-
- #region IStudioModuleVM
-
- public override void OnModuleRequest(params object[] args)
- {
- SelectedMachine = Adapter.Machines.SingleOrDefault(x => x.Guid == (args[0] as Machine).Guid);
- }
-
- #endregion
}
}
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 4d75651f7..e2dd7c5a9 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
@@ -17,7 +17,6 @@
<UserControl.Resources>
<sharedConverters:ColorToIntegerConverter x:Key="ColorToIntegerConverter" />
- <providers:MachinesProvider x:Key="MachinesProvider"></providers:MachinesProvider>
<Style x:Key="draggableGrid" TargetType="Grid">
<Setter Property="RenderTransform">
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 4e3e31326..e12f85cdf 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
@@ -17,7 +17,6 @@
<UserControl.Resources>
<sharedConverters:ColorToIntegerConverter x:Key="ColorToIntegerConverter" />
- <providers:MachinesProvider x:Key="MachinesProvider"></providers:MachinesProvider>
<Style x:Key="draggableGrid" TargetType="Grid">
<Setter Property="RenderTransform">
@@ -89,7 +88,7 @@
<TextBlock FontSize="30" FontStyle="Italic" VerticalAlignment="Center" Margin="50 10 10 0" Foreground="Silver" FontWeight="Bold">MACHINE DESIGNER</TextBlock>
<StackPanel Orientation="Horizontal" Margin="20 10 0 0" VerticalAlignment="Center">
<materialDesign:PackIcon Kind="BarcodeScan" VerticalAlignment="Bottom" Width="24" Height="24" Foreground="Silver"></materialDesign:PackIcon>
- <autoComplete:AutoCompleteTextBox FontSize="16" FontWeight="Bold" FontStyle="Italic" Width="300" Margin="5 0 0 0" materialDesign:HintAssist.Hint="Enter serial number" DisplayMember="SerialNumber" Provider="{StaticResource ResourceKey=MachinesProvider}" SelectedItem="{Binding SelectedMachine,Mode=TwoWay}">
+ <autoComplete:AutoCompleteTextBox FontSize="16" FontWeight="Bold" FontStyle="Italic" Width="300" Margin="5 0 0 0" materialDesign:HintAssist.Hint="Enter serial number" DisplayMember="SerialNumber" Provider="{Binding MachinesProvider}" SelectedItem="{Binding SelectedMachine,Mode=TwoWay}">
<autoComplete:AutoCompleteTextBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding SerialNumber}"></TextBlock>
@@ -99,6 +98,10 @@
<TextBlock Text="Loading..." Margin="5" FontSize="14" />
</autoComplete:AutoCompleteTextBox.LoadingContent>
</autoComplete:AutoCompleteTextBox>
+
+ <Button Style="{StaticResource MaterialDesignFlatButton}" Margin="10 0 0 0" Padding="0" Foreground="Gray" Width="40" Command="{Binding ResetCommand}" ToolTip="Reset the designer">
+ <materialDesign:PackIcon Kind="Refresh" Width="24" Height="24" />
+ </Button>
</StackPanel>
</StackPanel>
</StackPanel>
@@ -417,7 +420,7 @@
</Grid>
</Grid>
- <Grid Grid.Column="1">
+ <Grid Grid.Column="1" IsEnabled="{Binding CanWork}">
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition Height="60"/>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/app.config b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/app.config
index 5d794b958..0e58ccf54 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/app.config
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/app.config
@@ -1,5 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
+ <configSections>
+ <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
+ <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
+ </configSections>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
@@ -46,6 +50,16 @@
<assemblyIdentity name="System.Diagnostics.StackTrace" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
</dependentAssembly>
+ <dependentAssembly>
+ <assemblyIdentity name="System.Xml.ReaderWriter" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" />
+ </dependentAssembly>
</assemblyBinding>
</runtime>
+ <entityFramework>
+ <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
+ <providers>
+ <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
+ </providers>
+ </entityFramework>
</configuration> \ No newline at end of file
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/packages.config b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/packages.config
index 59e34e36f..8b579e95a 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/packages.config
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/packages.config
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="CommonServiceLocator" version="1.3" targetFramework="net46" />
+ <package id="EntityFramework" version="6.0.0" targetFramework="net472" />
<package id="Expression.Blend.Sdk" version="1.0.2" targetFramework="net46" />
<package id="FontAwesome.WPF" version="4.7.0.9" targetFramework="net46" />
<package id="MahApps.Metro" version="1.5.0" targetFramework="net46" />
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/Properties/AssemblyInfo.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/Properties/AssemblyInfo.cs
index bf0680366..220526a23 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/Properties/AssemblyInfo.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/Properties/AssemblyInfo.cs
@@ -5,7 +5,7 @@ using System.Runtime.InteropServices;
using System.Windows;
[assembly: AssemblyTitle("Tango - Machine Studio Stubs Module")]
-[assembly: AssemblyVersion("2.0.7.1633")]
+[assembly: AssemblyVersion("2.0.9.1159")]
[assembly: ComVisible(false)]
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/Tango.MachineStudio.Stubs.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/Tango.MachineStudio.Stubs.csproj
index 1c9ae5147..402e1642d 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/Tango.MachineStudio.Stubs.csproj
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/Tango.MachineStudio.Stubs.csproj
@@ -8,7 +8,7 @@
<OutputType>library</OutputType>
<RootNamespace>Tango.MachineStudio.Stubs</RootNamespace>
<AssemblyName>Tango.MachineStudio.Stubs</AssemblyName>
- <TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
+ <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
@@ -31,6 +31,12 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
+ <Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
+ <HintPath>..\..\..\packages\EntityFramework.6.0.0\lib\net45\EntityFramework.dll</HintPath>
+ </Reference>
+ <Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
+ <HintPath>..\..\..\packages\EntityFramework.6.0.0\lib\net45\EntityFramework.SqlServer.dll</HintPath>
+ </Reference>
<Reference Include="FontAwesome.WPF, Version=4.7.0.37774, Culture=neutral, PublicKeyToken=0758b07a11a4f466, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\FontAwesome.WPF.4.7.0.9\lib\net40\FontAwesome.WPF.dll</HintPath>
</Reference>
@@ -50,6 +56,7 @@
<HintPath>..\..\..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
+ <Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Data" />
<Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Expression.Blend.Sdk.1.0.2\lib\net45\System.Windows.Interactivity.dll</HintPath>
@@ -166,7 +173,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.Stubs/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/ViewModels/MainViewVM.cs
index fb05a0b94..ca598881a 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/ViewModels/MainViewVM.cs
@@ -27,7 +27,7 @@ namespace Tango.MachineStudio.Stubs.ViewModels
/// Represents the script execution module main view model.
/// </summary>
/// <seealso cref="Tango.SharedUI.ViewModel" />
- public class MainViewVM : StudioViewModel<StubsModule>
+ public class MainViewVM : StudioViewModel
{
private INotificationProvider _notification;
@@ -75,6 +75,11 @@ namespace Tango.MachineStudio.Stubs.ViewModels
StubsViewVM.SaveSettings();
}
+ public override void OnApplicationReady()
+ {
+
+ }
+
#endregion
}
}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/app.config b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/app.config
index 5d794b958..77b7003e2 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/app.config
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/app.config
@@ -1,5 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
+ <configSections>
+ <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
+ <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
+ </configSections>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
@@ -48,4 +52,10 @@
</dependentAssembly>
</assemblyBinding>
</runtime>
+ <entityFramework>
+ <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
+ <providers>
+ <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
+ </providers>
+ </entityFramework>
</configuration> \ No newline at end of file
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/packages.config b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/packages.config
index 06fdfec56..801a18d37 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/packages.config
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/packages.config
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="CommonServiceLocator" version="1.3" targetFramework="net46" />
+ <package id="EntityFramework" version="6.0.0" targetFramework="net472" />
<package id="Expression.Blend.Sdk" version="1.0.2" targetFramework="net46" />
<package id="FontAwesome.WPF" version="4.7.0.9" targetFramework="net46" />
<package id="Google.Protobuf" version="3.4.1" targetFramework="net46" />
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/Tango.MachineStudio.Synchronization.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/Tango.MachineStudio.Synchronization.csproj
index e8df35ba8..e4b1edce4 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/Tango.MachineStudio.Synchronization.csproj
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/Tango.MachineStudio.Synchronization.csproj
@@ -8,7 +8,7 @@
<OutputType>library</OutputType>
<RootNamespace>Tango.MachineStudio.Synchronization</RootNamespace>
<AssemblyName>Tango.MachineStudio.Synchronization</AssemblyName>
- <TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
+ <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/BlowerElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/BlowerElementEditor.xaml
index 675571657..e06d1f559 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/BlowerElementEditor.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/BlowerElementEditor.xaml
@@ -27,7 +27,7 @@
<!--Content-->
- <Grid IsHitTestVisible="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable,Converter={StaticResource BooleanInverseConverter}}">
+ <Grid>
<Image Source="../Images/blower-big.png"></Image>
@@ -38,7 +38,22 @@
<!--Content-->
- <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}" Visibility="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected),Converter={StaticResource BoolToVisibilityConverter}}">
+ <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}">
+ <Border.Style>
+ <Style TargetType="Border">
+ <Setter Property="Visibility" Value="Collapsed"></Setter>
+ <Style.Triggers>
+ <MultiDataTrigger>
+ <MultiDataTrigger.Conditions>
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected)}" Value="True" />
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable}" Value="True" />
+ </MultiDataTrigger.Conditions>
+
+ <Setter Property="Visibility" Value="Visible"></Setter>
+ </MultiDataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Border.Style>
<Grid>
<ContentPresenter Content="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=InnerContent}"></ContentPresenter>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/BreakSensorElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/BreakSensorElementEditor.xaml
index 18c992193..78834aca7 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/BreakSensorElementEditor.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/BreakSensorElementEditor.xaml
@@ -27,7 +27,7 @@
<!--Content-->
- <Grid IsHitTestVisible="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable,Converter={StaticResource BooleanInverseConverter}}">
+ <Grid>
<Image Source="../Images/break-big.png"></Image>
@@ -38,7 +38,22 @@
<!--Content-->
- <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}" Visibility="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected),Converter={StaticResource BoolToVisibilityConverter}}">
+ <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}">
+ <Border.Style>
+ <Style TargetType="Border">
+ <Setter Property="Visibility" Value="Collapsed"></Setter>
+ <Style.Triggers>
+ <MultiDataTrigger>
+ <MultiDataTrigger.Conditions>
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected)}" Value="True" />
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable}" Value="True" />
+ </MultiDataTrigger.Conditions>
+
+ <Setter Property="Visibility" Value="Visible"></Setter>
+ </MultiDataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Border.Style>
<Grid>
<ContentPresenter Content="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=InnerContent}"></ContentPresenter>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ControllerElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ControllerElementEditor.xaml
index 346c0067b..de604625d 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ControllerElementEditor.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ControllerElementEditor.xaml
@@ -28,7 +28,7 @@
<!--Content-->
- <Grid ClipToBounds="False" IsHitTestVisible="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable,Converter={StaticResource BooleanInverseConverter}}">
+ <Grid ClipToBounds="False">
<Border>
<Viewbox>
<Grid>
@@ -99,7 +99,22 @@
<!--Content-->
- <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}" Visibility="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected),Converter={StaticResource BoolToVisibilityConverter}}">
+ <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}">
+ <Border.Style>
+ <Style TargetType="Border">
+ <Setter Property="Visibility" Value="Collapsed"></Setter>
+ <Style.Triggers>
+ <MultiDataTrigger>
+ <MultiDataTrigger.Conditions>
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected)}" Value="True" />
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable}" Value="True" />
+ </MultiDataTrigger.Conditions>
+
+ <Setter Property="Visibility" Value="Visible"></Setter>
+ </MultiDataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Border.Style>
<Grid>
<ContentPresenter Content="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=InnerContent}"></ContentPresenter>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DancerElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DancerElementEditor.xaml
index 3c6ee7d49..2960a8807 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DancerElementEditor.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DancerElementEditor.xaml
@@ -27,7 +27,7 @@
<!--Content-->
- <Grid IsHitTestVisible="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable,Converter={StaticResource BooleanInverseConverter}}">
+ <Grid>
<Image Source="../Images/dancer-big.png"></Image>
@@ -38,7 +38,22 @@
<!--Content-->
- <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}" Visibility="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected),Converter={StaticResource BoolToVisibilityConverter}}">
+ <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}">
+ <Border.Style>
+ <Style TargetType="Border">
+ <Setter Property="Visibility" Value="Collapsed"></Setter>
+ <Style.Triggers>
+ <MultiDataTrigger>
+ <MultiDataTrigger.Conditions>
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected)}" Value="True" />
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable}" Value="True" />
+ </MultiDataTrigger.Conditions>
+
+ <Setter Property="Visibility" Value="Visible"></Setter>
+ </MultiDataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Border.Style>
<Grid>
<ContentPresenter Content="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=InnerContent}"></ContentPresenter>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DigitalInElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DigitalInElementEditor.xaml
index 8c72798d5..5c1cfc3ad 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DigitalInElementEditor.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DigitalInElementEditor.xaml
@@ -27,7 +27,7 @@
<!--Content-->
- <Grid IsHitTestVisible="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable,Converter={StaticResource BooleanInverseConverter}}">
+ <Grid>
<Grid.RowDefinitions>
<RowDefinition Height="221*"/>
<RowDefinition Height="Auto"/>
@@ -51,7 +51,22 @@
<!--Content-->
- <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}" Visibility="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected),Converter={StaticResource BoolToVisibilityConverter}}">
+ <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}">
+ <Border.Style>
+ <Style TargetType="Border">
+ <Setter Property="Visibility" Value="Collapsed"></Setter>
+ <Style.Triggers>
+ <MultiDataTrigger>
+ <MultiDataTrigger.Conditions>
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected)}" Value="True" />
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable}" Value="True" />
+ </MultiDataTrigger.Conditions>
+
+ <Setter Property="Visibility" Value="Visible"></Setter>
+ </MultiDataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Border.Style>
<Grid>
<ContentPresenter Content="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=InnerContent}"></ContentPresenter>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DigitalOutElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DigitalOutElementEditor.xaml
index 5fd92c336..862fa0597 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DigitalOutElementEditor.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DigitalOutElementEditor.xaml
@@ -28,7 +28,7 @@
<!--Content-->
- <Grid IsHitTestVisible="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable,Converter={StaticResource BooleanInverseConverter}}">
+ <Grid>
<Grid.RowDefinitions>
<RowDefinition Height="221*"/>
<RowDefinition Height="Auto"/>
@@ -62,7 +62,22 @@
<!--Content-->
- <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}" Visibility="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected),Converter={StaticResource BoolToVisibilityConverter}}">
+ <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}">
+ <Border.Style>
+ <Style TargetType="Border">
+ <Setter Property="Visibility" Value="Collapsed"></Setter>
+ <Style.Triggers>
+ <MultiDataTrigger>
+ <MultiDataTrigger.Conditions>
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected)}" Value="True" />
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable}" Value="True" />
+ </MultiDataTrigger.Conditions>
+
+ <Setter Property="Visibility" Value="Visible"></Setter>
+ </MultiDataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Border.Style>
<Grid>
<ContentPresenter Content="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=InnerContent}"></ContentPresenter>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DispenserElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DispenserElementEditor.xaml
index 0a088df69..1fa1c6c48 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DispenserElementEditor.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DispenserElementEditor.xaml
@@ -45,7 +45,7 @@
<Grid>
- <Grid Margin="5" IsHitTestVisible="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable,Converter={StaticResource BooleanInverseConverter}}">
+ <Grid Margin="5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="20*"/>
<ColumnDefinition Width="100*"/>
@@ -254,7 +254,22 @@
<!--Content-->
- <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}" Visibility="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected),Converter={StaticResource BoolToVisibilityConverter}}">
+ <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}">
+ <Border.Style>
+ <Style TargetType="Border">
+ <Setter Property="Visibility" Value="Collapsed"></Setter>
+ <Style.Triggers>
+ <MultiDataTrigger>
+ <MultiDataTrigger.Conditions>
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected)}" Value="True" />
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable}" Value="True" />
+ </MultiDataTrigger.Conditions>
+
+ <Setter Property="Visibility" Value="Visible"></Setter>
+ </MultiDataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Border.Style>
<Grid>
<ContentPresenter Content="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=InnerContent}"></ContentPresenter>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/JobRunnerElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/JobRunnerElementEditor.xaml
index c481f1e1b..76a6a16a7 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/JobRunnerElementEditor.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/JobRunnerElementEditor.xaml
@@ -42,7 +42,7 @@
<!--Content-->
- <Grid IsHitTestVisible="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable,Converter={StaticResource BooleanInverseConverter}}">
+ <Grid>
<Border Padding="10" BorderThickness="1" BorderBrush="#202020" Background="#88FFFFFF" CornerRadius="5">
<DockPanel>
<TextBox Foreground="#202020" FontSize="14" DockPanel.Dock="Top" Text="{Binding Job.Name}"></TextBox>
@@ -239,7 +239,22 @@
<!--Content-->
- <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}" Visibility="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected),Converter={StaticResource BoolToVisibilityConverter}}">
+ <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}">
+ <Border.Style>
+ <Style TargetType="Border">
+ <Setter Property="Visibility" Value="Collapsed"></Setter>
+ <Style.Triggers>
+ <MultiDataTrigger>
+ <MultiDataTrigger.Conditions>
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected)}" Value="True" />
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable}" Value="True" />
+ </MultiDataTrigger.Conditions>
+
+ <Setter Property="Visibility" Value="Visible"></Setter>
+ </MultiDataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Border.Style>
<Grid>
<ContentPresenter Content="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=InnerContent}"></ContentPresenter>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MeterElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MeterElementEditor.xaml
index 98ace7816..2631f3a06 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MeterElementEditor.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MeterElementEditor.xaml
@@ -28,7 +28,7 @@
<!--Content-->
- <Grid IsHitTestVisible="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable,Converter={StaticResource BooleanInverseConverter}}">
+ <Grid>
<Grid.RowDefinitions>
<RowDefinition Height="221*"/>
<RowDefinition Height="Auto"/>
@@ -47,7 +47,22 @@
<!--Content-->
- <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}" Visibility="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected),Converter={StaticResource BoolToVisibilityConverter}}">
+ <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}">
+ <Border.Style>
+ <Style TargetType="Border">
+ <Setter Property="Visibility" Value="Collapsed"></Setter>
+ <Style.Triggers>
+ <MultiDataTrigger>
+ <MultiDataTrigger.Conditions>
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected)}" Value="True" />
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable}" Value="True" />
+ </MultiDataTrigger.Conditions>
+
+ <Setter Property="Visibility" Value="Visible"></Setter>
+ </MultiDataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Border.Style>
<Grid>
<ContentPresenter Content="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=InnerContent}"></ContentPresenter>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MonitorElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MonitorElementEditor.xaml
index 8f66adeeb..a39fa975c 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MonitorElementEditor.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MonitorElementEditor.xaml
@@ -27,7 +27,7 @@
<!--Content-->
- <Grid IsHitTestVisible="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable,Converter={StaticResource BooleanInverseConverter}}">
+ <Grid>
<Viewbox Stretch="Fill">
<StackPanel>
<Grid Grid.Column="1" Grid.Row="1" Width="200" Height="120">
@@ -55,7 +55,22 @@
<!--Content-->
- <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}" Visibility="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected),Converter={StaticResource BoolToVisibilityConverter}}">
+ <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}">
+ <Border.Style>
+ <Style TargetType="Border">
+ <Setter Property="Visibility" Value="Collapsed"></Setter>
+ <Style.Triggers>
+ <MultiDataTrigger>
+ <MultiDataTrigger.Conditions>
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected)}" Value="True" />
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable}" Value="True" />
+ </MultiDataTrigger.Conditions>
+
+ <Setter Property="Visibility" Value="Visible"></Setter>
+ </MultiDataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Border.Style>
<Grid>
<ContentPresenter Content="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=InnerContent}"></ContentPresenter>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MotorElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MotorElementEditor.xaml
index 48186fd56..80bfe8f96 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MotorElementEditor.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MotorElementEditor.xaml
@@ -47,7 +47,7 @@
<Grid>
- <Grid Margin="5" IsHitTestVisible="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable,Converter={StaticResource BooleanInverseConverter}}">
+ <Grid Margin="5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="20*"/>
<ColumnDefinition Width="100*"/>
@@ -243,7 +243,22 @@
<!--Content-->
- <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}" Visibility="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected),Converter={StaticResource BoolToVisibilityConverter}}">
+ <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}">
+ <Border.Style>
+ <Style TargetType="Border">
+ <Setter Property="Visibility" Value="Collapsed"></Setter>
+ <Style.Triggers>
+ <MultiDataTrigger>
+ <MultiDataTrigger.Conditions>
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected)}" Value="True" />
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable}" Value="True" />
+ </MultiDataTrigger.Conditions>
+
+ <Setter Property="Visibility" Value="Visible"></Setter>
+ </MultiDataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Border.Style>
<Grid>
<ContentPresenter Content="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=InnerContent}"></ContentPresenter>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MotorGroupElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MotorGroupElementEditor.xaml
index 64ed5bb43..3adee13d6 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MotorGroupElementEditor.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MotorGroupElementEditor.xaml
@@ -47,7 +47,7 @@
<Grid>
- <Grid Margin="5" IsHitTestVisible="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable,Converter={StaticResource BooleanInverseConverter}}">
+ <Grid Margin="5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="20*"/>
<ColumnDefinition Width="100*"/>
@@ -229,7 +229,22 @@
<!--Content-->
- <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}" Visibility="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected),Converter={StaticResource BoolToVisibilityConverter}}">
+ <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}">
+ <Border.Style>
+ <Style TargetType="Border">
+ <Setter Property="Visibility" Value="Collapsed"></Setter>
+ <Style.Triggers>
+ <MultiDataTrigger>
+ <MultiDataTrigger.Conditions>
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected)}" Value="True" />
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable}" Value="True" />
+ </MultiDataTrigger.Conditions>
+
+ <Setter Property="Visibility" Value="Visible"></Setter>
+ </MultiDataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Border.Style>
<Grid>
<ContentPresenter Content="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=InnerContent}"></ContentPresenter>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MultiGraphElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MultiGraphElementEditor.xaml
index 9bc22d0f6..dcba1e77b 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MultiGraphElementEditor.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MultiGraphElementEditor.xaml
@@ -43,7 +43,22 @@
<!--Content-->
- <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}" Visibility="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected),Converter={StaticResource BoolToVisibilityConverter}}">
+ <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}">
+ <Border.Style>
+ <Style TargetType="Border">
+ <Setter Property="Visibility" Value="Collapsed"></Setter>
+ <Style.Triggers>
+ <MultiDataTrigger>
+ <MultiDataTrigger.Conditions>
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected)}" Value="True" />
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable}" Value="True" />
+ </MultiDataTrigger.Conditions>
+
+ <Setter Property="Visibility" Value="Visible"></Setter>
+ </MultiDataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Border.Style>
<Grid>
<ContentPresenter Content="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=InnerContent}"></ContentPresenter>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/PidElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/PidElementEditor.xaml
index 6d4f49ace..197640b14 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/PidElementEditor.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/PidElementEditor.xaml
@@ -27,7 +27,7 @@
<!--Content-->
- <Grid IsHitTestVisible="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable,Converter={StaticResource BooleanInverseConverter}}">
+ <Grid>
<Image Source="../Images/pid.png"></Image>
@@ -38,7 +38,22 @@
<!--Content-->
- <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}" Visibility="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected),Converter={StaticResource BoolToVisibilityConverter}}">
+ <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}">
+ <Border.Style>
+ <Style TargetType="Border">
+ <Setter Property="Visibility" Value="Collapsed"></Setter>
+ <Style.Triggers>
+ <MultiDataTrigger>
+ <MultiDataTrigger.Conditions>
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected)}" Value="True" />
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable}" Value="True" />
+ </MultiDataTrigger.Conditions>
+
+ <Setter Property="Visibility" Value="Visible"></Setter>
+ </MultiDataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Border.Style>
<Grid>
<ContentPresenter Content="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=InnerContent}"></ContentPresenter>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ProcessParametersElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ProcessParametersElementEditor.xaml
index 716ac0a2d..f057521e0 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ProcessParametersElementEditor.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ProcessParametersElementEditor.xaml
@@ -31,7 +31,7 @@
<!--Content-->
- <Grid IsHitTestVisible="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable,Converter={StaticResource BooleanInverseConverter}}">
+ <Grid>
<Grid>
<Border BorderThickness="1" CornerRadius="5" Padding="10">
<Border.BorderBrush>
@@ -73,7 +73,22 @@
<!--Content-->
- <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}" Visibility="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected),Converter={StaticResource BoolToVisibilityConverter}}">
+ <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}">
+ <Border.Style>
+ <Style TargetType="Border">
+ <Setter Property="Visibility" Value="Collapsed"></Setter>
+ <Style.Triggers>
+ <MultiDataTrigger>
+ <MultiDataTrigger.Conditions>
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected)}" Value="True" />
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable}" Value="True" />
+ </MultiDataTrigger.Conditions>
+
+ <Setter Property="Visibility" Value="Visible"></Setter>
+ </MultiDataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Border.Style>
<Grid>
<ContentPresenter Content="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=InnerContent}"></ContentPresenter>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/SingleGraphElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/SingleGraphElementEditor.xaml
index 16f94b251..a9eb9e9f4 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/SingleGraphElementEditor.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/SingleGraphElementEditor.xaml
@@ -43,7 +43,22 @@
<!--Content-->
- <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}" Visibility="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected),Converter={StaticResource BoolToVisibilityConverter}}">
+ <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}">
+ <Border.Style>
+ <Style TargetType="Border">
+ <Setter Property="Visibility" Value="Collapsed"></Setter>
+ <Style.Triggers>
+ <MultiDataTrigger>
+ <MultiDataTrigger.Conditions>
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected)}" Value="True" />
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable}" Value="True" />
+ </MultiDataTrigger.Conditions>
+
+ <Setter Property="Visibility" Value="Visible"></Setter>
+ </MultiDataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Border.Style>
<Grid>
<ContentPresenter Content="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=InnerContent}"></ContentPresenter>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/SpeedSensorElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/SpeedSensorElementEditor.xaml
index b9dce9112..8696a3c53 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/SpeedSensorElementEditor.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/SpeedSensorElementEditor.xaml
@@ -27,7 +27,7 @@
<!--Content-->
- <Grid IsHitTestVisible="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable,Converter={StaticResource BooleanInverseConverter}}">
+ <Grid>
<Image Source="../Images/speed-big.png"></Image>
@@ -38,7 +38,22 @@
<!--Content-->
- <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}" Visibility="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected),Converter={StaticResource BoolToVisibilityConverter}}">
+ <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}">
+ <Border.Style>
+ <Style TargetType="Border">
+ <Setter Property="Visibility" Value="Collapsed"></Setter>
+ <Style.Triggers>
+ <MultiDataTrigger>
+ <MultiDataTrigger.Conditions>
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected)}" Value="True" />
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable}" Value="True" />
+ </MultiDataTrigger.Conditions>
+
+ <Setter Property="Visibility" Value="Visible"></Setter>
+ </MultiDataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Border.Style>
<Grid>
<ContentPresenter Content="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=InnerContent}"></ContentPresenter>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ThreadMotionElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ThreadMotionElementEditor.xaml
index 3bac433ad..6e2315dc8 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ThreadMotionElementEditor.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ThreadMotionElementEditor.xaml
@@ -47,7 +47,7 @@
<Grid>
- <Grid Margin="5" IsHitTestVisible="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable,Converter={StaticResource BooleanInverseConverter}}">
+ <Grid Margin="5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="20*"/>
<ColumnDefinition Width="100*"/>
@@ -158,7 +158,22 @@
<!--Content-->
- <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}" Visibility="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected),Converter={StaticResource BoolToVisibilityConverter}}">
+ <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}">
+ <Border.Style>
+ <Style TargetType="Border">
+ <Setter Property="Visibility" Value="Collapsed"></Setter>
+ <Style.Triggers>
+ <MultiDataTrigger>
+ <MultiDataTrigger.Conditions>
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected)}" Value="True" />
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable}" Value="True" />
+ </MultiDataTrigger.Conditions>
+
+ <Setter Property="Visibility" Value="Visible"></Setter>
+ </MultiDataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Border.Style>
<Grid>
<ContentPresenter Content="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=InnerContent}"></ContentPresenter>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/WinderElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/WinderElementEditor.xaml
index f81597574..2b6ee303d 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/WinderElementEditor.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/WinderElementEditor.xaml
@@ -27,7 +27,7 @@
<!--Content-->
- <Grid IsHitTestVisible="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable,Converter={StaticResource BooleanInverseConverter}}">
+ <Grid>
<Image Source="../Images/winder-big.png"></Image>
@@ -38,7 +38,22 @@
<!--Content-->
- <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}" Visibility="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected),Converter={StaticResource BoolToVisibilityConverter}}">
+ <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}">
+ <Border.Style>
+ <Style TargetType="Border">
+ <Setter Property="Visibility" Value="Collapsed"></Setter>
+ <Style.Triggers>
+ <MultiDataTrigger>
+ <MultiDataTrigger.Conditions>
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected)}" Value="True" />
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable}" Value="True" />
+ </MultiDataTrigger.Conditions>
+
+ <Setter Property="Visibility" Value="Visible"></Setter>
+ </MultiDataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Border.Style>
<Grid>
<ContentPresenter Content="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=InnerContent}"></ContentPresenter>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Properties/AssemblyInfo.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Properties/AssemblyInfo.cs
index 18f0bd7c0..b66227b98 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Properties/AssemblyInfo.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Properties/AssemblyInfo.cs
@@ -5,7 +5,7 @@ using System.Runtime.InteropServices;
using System.Windows;
[assembly: AssemblyTitle("Tango - Machine Studio Technician Module")]
-[assembly: AssemblyVersion("2.0.12.1633")]
+[assembly: AssemblyVersion("2.0.14.1159")]
[assembly: ComVisible(false)]
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/JobRunnerTemplate.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/JobRunnerTemplate.xaml
index 4de0bff14..b6bfefd8c 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/JobRunnerTemplate.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/JobRunnerTemplate.xaml
@@ -29,7 +29,7 @@
<GroupBox Header="JOB RUNNER">
<StackPanel>
<TextBlock FontSize="10">Machine</TextBlock>
- <ComboBox Margin="0 5 0 0" ItemsSource="{Binding Adapter.MachinesViewSource}" SelectedItem="{Binding Machine,Mode=TwoWay}">
+ <ComboBox Margin="0 5 0 0" ItemsSource="{Binding Adapter.Machines}" SelectedItem="{Binding Machine,Mode=TwoWay}">
<ComboBox.ItemTemplate>
<DataTemplate>
<StackPanel Margin="0 5">
@@ -41,7 +41,7 @@
</ComboBox>
<TextBlock FontSize="10" Margin="0 10 0 0" >RML</TextBlock>
- <ComboBox Margin="0 5 0 0" ItemsSource="{Binding Adapter.RmlsViewSource}" SelectedItem="{Binding Rml,Mode=TwoWay}" DisplayMemberPath="Name" />
+ <ComboBox Margin="0 5 0 0" ItemsSource="{Binding Adapter.Rmls}" SelectedItem="{Binding Rml,Mode=TwoWay}" DisplayMemberPath="Name" />
<TextBlock Margin="0 10 0 0" FontSize="10">Process Parameters</TextBlock>
<ComboBox Margin="0 5 0 0" ItemsSource="{x:Static items:ProcessParametersItem.ProcessParametersTables}" SelectedItem="{Binding ProcessParameters,Mode=TwoWay}" DisplayMemberPath="Name" />
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/ProcessParametersTemplate.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/ProcessParametersTemplate.xaml
index 5e5a6d46d..46a6a6340 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/ProcessParametersTemplate.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/ProcessParametersTemplate.xaml
@@ -27,7 +27,7 @@
<GroupBox Header="PROCESS PARAMETERS">
<StackPanel>
<TextBlock FontSize="10">Reset to RML</TextBlock>
- <ComboBox Margin="0 5 0 0" ItemsSource="{Binding Adapter.RmlsViewSource}" SelectedItem="{Binding SelectedResetRML,Mode=TwoWay}" DisplayMemberPath="Name" />
+ <ComboBox Margin="0 5 0 0" ItemsSource="{Binding Adapter.Rmls}" SelectedItem="{Binding SelectedResetRML,Mode=TwoWay}" DisplayMemberPath="Name" />
<Button Margin="0 10 0 0" Command="{Binding ResetToRMLCommand}">RESET</Button>
</StackPanel>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Tango.MachineStudio.Technician.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Tango.MachineStudio.Technician.csproj
index 8490800ad..e187db982 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Tango.MachineStudio.Technician.csproj
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Tango.MachineStudio.Technician.csproj
@@ -8,7 +8,7 @@
<OutputType>library</OutputType>
<RootNamespace>Tango.MachineStudio.Technician</RootNamespace>
<AssemblyName>Tango.MachineStudio.Technician</AssemblyName>
- <TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
+ <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
@@ -31,6 +31,12 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
+ <Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
+ <HintPath>..\..\..\packages\EntityFramework.6.0.0\lib\net45\EntityFramework.dll</HintPath>
+ </Reference>
+ <Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
+ <HintPath>..\..\..\packages\EntityFramework.6.0.0\lib\net45\EntityFramework.SqlServer.dll</HintPath>
+ </Reference>
<Reference Include="FontAwesome.WPF, Version=4.7.0.37774, Culture=neutral, PublicKeyToken=0758b07a11a4f466, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\FontAwesome.WPF.4.7.0.9\lib\net40\FontAwesome.WPF.dll</HintPath>
</Reference>
@@ -47,6 +53,7 @@
<HintPath>..\..\..\packages\MaterialDesignThemes.2.3.1.953\lib\net45\MaterialDesignThemes.Wpf.dll</HintPath>
</Reference>
<Reference Include="System" />
+ <Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Data" />
<Reference Include="System.Reactive.Core, Version=3.0.3000.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\System.Reactive.Core.3.1.1\lib\net46\System.Reactive.Core.dll</HintPath>
@@ -612,7 +619,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.Technician/TechItems/BlowerItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/BlowerItem.cs
index 59a96f107..6b532204e 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/BlowerItem.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/BlowerItem.cs
@@ -5,6 +5,7 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows.Media;
using System.Xml.Serialization;
+using Tango.BL;
using Tango.BL.Entities;
using Tango.SharedUI.Helpers;
@@ -31,7 +32,7 @@ namespace Tango.MachineStudio.Technician.TechItems
{
BlowerConfigurations = new List<HardwareBlower>();
- foreach (var BlowerType in BL.ObservablesEntitiesAdapter.Instance.HardwareBlowerTypes)
+ foreach (var BlowerType in ObservablesStaticCollections.Instance.HardwareBlowerTypes)
{
BlowerConfigurations.Add(new HardwareBlower() { HardwareBlowerType = BlowerType });
}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/BreakSensorItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/BreakSensorItem.cs
index cf1ed682e..4a0d1c9c9 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/BreakSensorItem.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/BreakSensorItem.cs
@@ -5,6 +5,7 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows.Media;
using System.Xml.Serialization;
+using Tango.BL;
using Tango.BL.Entities;
using Tango.SharedUI.Helpers;
@@ -31,7 +32,7 @@ namespace Tango.MachineStudio.Technician.TechItems
{
BreakSensorConfigurations = new List<HardwareBreakSensor>();
- foreach (var BreakSensorType in BL.ObservablesEntitiesAdapter.Instance.HardwareBreakSensorTypes)
+ foreach (var BreakSensorType in ObservablesStaticCollections.Instance.HardwareBreakSensorTypes)
{
BreakSensorConfigurations.Add(new HardwareBreakSensor() { HardwareBreakSensorType = BreakSensorType });
}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/DancerItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/DancerItem.cs
index e5651acce..1115c6dbf 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/DancerItem.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/DancerItem.cs
@@ -33,7 +33,7 @@ namespace Tango.MachineStudio.Technician.TechItems
{
DancerConfigurations = new List<HardwareDancer>();
- foreach (var winderType in BL.ObservablesEntitiesAdapter.Instance.HardwareDancerTypes)
+ foreach (var winderType in BL.ObservablesStaticCollections.Instance.HardwareDancerTypes)
{
DancerConfigurations.Add(new HardwareDancer() { HardwareDancerType = winderType });
}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/DispenserItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/DispenserItem.cs
index f058036d0..7945c5b73 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/DispenserItem.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/DispenserItem.cs
@@ -37,7 +37,7 @@ namespace Tango.MachineStudio.Technician.TechItems
{
DispenserTypes = new List<DispenserType>();
- foreach (var techDispenser in BL.ObservablesEntitiesAdapter.Instance.TechDispensers)
+ foreach (var techDispenser in BL.ObservablesStaticCollections.Instance.TechDispensers)
{
DispenserTypes.Add(new DispenserType() { Code = int.Parse(techDispenser.Name.Replace("Dispenser", "")) - 1 });
}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/JobRunnerItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/JobRunnerItem.cs
index 8d102d6c0..3443c008e 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/JobRunnerItem.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/JobRunnerItem.cs
@@ -160,6 +160,7 @@ namespace Tango.MachineStudio.Technician.TechItems
{
Job.Machine = Machine;
Job.Rml = Rml;
+
BrushStop.SetLiquidVolumes(Machine.Configuration, Rml, ProcessParameters);
}
}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MotorGroupItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MotorGroupItem.cs
index 5cdb8017e..a5288e6bc 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MotorGroupItem.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MotorGroupItem.cs
@@ -59,7 +59,7 @@ namespace Tango.MachineStudio.Technician.TechItems
{
if (TechMotors != null)
{
- SelectedMotors = new SelectedObjectCollection<HardwareMotorType>(ObservablesEntitiesAdapter.Instance.HardwareMotorTypes.ToObservableCollection(), TechMotors);
+ SelectedMotors = new SelectedObjectCollection<HardwareMotorType>(ObservablesStaticCollections.Instance.HardwareMotorTypes.ToObservableCollection(), TechMotors);
}
}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MotorItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MotorItem.cs
index 779919039..c097a0b7b 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MotorItem.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MotorItem.cs
@@ -38,7 +38,7 @@ namespace Tango.MachineStudio.Technician.TechItems
{
MotorConfigurations = new List<HardwareMotor>();
- foreach (var motorType in BL.ObservablesEntitiesAdapter.Instance.HardwareMotorTypes)
+ foreach (var motorType in BL.ObservablesStaticCollections.Instance.HardwareMotorTypes)
{
MotorConfigurations.Add(new HardwareMotor() { HardwareMotorType = motorType });
}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/PidItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/PidItem.cs
index a56c3b0c1..70ecc1a70 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/PidItem.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/PidItem.cs
@@ -33,7 +33,7 @@ namespace Tango.MachineStudio.Technician.TechItems
{
PidConfigurations = new List<HardwarePidControl>();
- foreach (var pidType in BL.ObservablesEntitiesAdapter.Instance.HardwarePidControlTypes)
+ foreach (var pidType in BL.ObservablesStaticCollections.Instance.HardwarePidControlTypes)
{
PidConfigurations.Add(new HardwarePidControl() { HardwarePidControlType = pidType });
}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/ProcessParametersItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/ProcessParametersItem.cs
index 79aea7a0c..4aedf8bc7 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/ProcessParametersItem.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/ProcessParametersItem.cs
@@ -6,6 +6,7 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows.Media;
using System.Xml.Serialization;
+using Tango.BL;
using Tango.BL.Entities;
using Tango.Core.Commands;
using Tango.SharedUI.Helpers;
@@ -93,7 +94,9 @@ namespace Tango.MachineStudio.Technician.TechItems
if (_counter > 1)
{
+ String name = ProcessParameters.Name;
ProcessParametersTables.Add(ProcessParameters);
+ ProcessParameters.Name = name;
}
}
@@ -101,15 +104,18 @@ namespace Tango.MachineStudio.Technician.TechItems
{
if (SelectedResetRML != null)
{
- var group = SelectedResetRML.ProcessParametersTablesGroups.FirstOrDefault(x => x.Active);
-
- if (group != null)
+ using (ObservablesContext db = ObservablesContext.CreateDefault())
{
- var table = group.ProcessParametersTables.OrderBy(x => x.TableIndex).FirstOrDefault();
+ var group = db.Adapter.GetRmlActiveProcessParametersTablesGroup(SelectedResetRML.Guid);
- if (table != null)
+ if (group != null)
{
- ProcessParameters = table.Clone();
+ var table = group.ProcessParametersTables.OrderBy(x => x.TableIndex).FirstOrDefault();
+
+ if (table != null)
+ {
+ table.MapPrimitivesTo(ProcessParameters);
+ }
}
}
}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/SpeedSensorItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/SpeedSensorItem.cs
index a067ec95f..e43a518c1 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/SpeedSensorItem.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/SpeedSensorItem.cs
@@ -33,7 +33,7 @@ namespace Tango.MachineStudio.Technician.TechItems
{
SpeedSensorConfigurations = new List<HardwareSpeedSensor>();
- foreach (var SpeedSensorType in BL.ObservablesEntitiesAdapter.Instance.HardwareSpeedSensorTypes)
+ foreach (var SpeedSensorType in BL.ObservablesStaticCollections.Instance.HardwareSpeedSensorTypes)
{
SpeedSensorConfigurations.Add(new HardwareSpeedSensor() { HardwareSpeedSensorType = SpeedSensorType });
}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/TechItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/TechItem.cs
index 11188c69d..b6ebf2857 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/TechItem.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/TechItem.cs
@@ -47,7 +47,7 @@ namespace Tango.MachineStudio.Technician.TechItems
{
ID = Guid.NewGuid().ToString();
Name = "Untitled";
- Adapter = ObservablesEntitiesAdapter.Instance;
+ Adapter = ObservablesStaticCollections.Instance;
_color = Colors.DodgerBlue;
}
@@ -77,7 +77,7 @@ namespace Tango.MachineStudio.Technician.TechItems
/// Gets or sets the db adapter.
/// </summary>
[XmlIgnore]
- public ObservablesEntitiesAdapter Adapter { get; set; }
+ public ObservablesStaticCollections Adapter { get; set; }
private String _id;
/// <summary>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/WinderItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/WinderItem.cs
index 425baf471..2df2d7ad7 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/WinderItem.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/WinderItem.cs
@@ -33,7 +33,7 @@ namespace Tango.MachineStudio.Technician.TechItems
{
WinderConfigurations = new List<HardwareWinder>();
- foreach (var winderType in BL.ObservablesEntitiesAdapter.Instance.HardwareWinderTypes)
+ foreach (var winderType in BL.ObservablesStaticCollections.Instance.HardwareWinderTypes)
{
WinderConfigurations.Add(new HardwareWinder() { HardwareWinderType = winderType });
}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs
index 333e43187..55235b3c2 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs
@@ -41,7 +41,7 @@ namespace Tango.MachineStudio.Technician.ViewModels
/// </summary>
/// <seealso cref="Tango.SharedUI.ViewModel" />
/// <seealso cref="Tango.MachineStudio.Common.StudioApplication.IShutdownListener" />
- public class MachineTechViewVM : StudioViewModel<TechnicianModule>
+ public class MachineTechViewVM : StudioViewModel
{
private List<PropertyInfo> _diagnoticsMonitorsDataProperties;
private IDiagnosticsFrameProvider _diagnosticsFrameProvider;
@@ -94,7 +94,7 @@ namespace Tango.MachineStudio.Technician.ViewModels
/// <summary>
/// Gets or sets the db adapter.
/// </summary>
- public ObservablesEntitiesAdapter Adapter { get; set; }
+ public ObservablesStaticCollections Adapter { get; set; }
/// <summary>
/// Gets or sets the application manager.
@@ -241,7 +241,7 @@ namespace Tango.MachineStudio.Technician.ViewModels
ApplicationManager = applicationManager;
ApplicationManager.ConnectedMachineChanged += ApplicationManager_ConnectedMachineChanged;
- Adapter = ObservablesEntitiesAdapter.Instance;
+ Adapter = ObservablesStaticCollections.Instance;
Elements = new ObservableCollection<IElementEditor>();
OpenProjectCommand = new RelayCommand(OpenProject);
@@ -1473,7 +1473,7 @@ namespace Tango.MachineStudio.Technician.ViewModels
{
if (item is MotorGroupItem)
{
- (item as MotorGroupItem).TechMotors = ObservablesEntitiesAdapter.Instance.HardwareMotorTypes.Where(x => (item as MotorGroupItem).ItemsGuids.Contains(x.Guid)).ToObservableCollection();
+ (item as MotorGroupItem).TechMotors = ObservablesStaticCollections.Instance.HardwareMotorTypes.Where(x => (item as MotorGroupItem).ItemsGuids.Contains(x.Guid)).ToObservableCollection();
}
AddTechItem(item);
@@ -1572,6 +1572,11 @@ namespace Tango.MachineStudio.Technician.ViewModels
});
}
+ public override void OnApplicationReady()
+ {
+
+ }
+
#endregion
#region Hardware Configuration
@@ -1666,83 +1671,93 @@ namespace Tango.MachineStudio.Technician.ViewModels
{
if (MachineOperator != null)
{
- var hw = ApplicationManager.ConnectedMachine.Machine.Configuration.HardwareVersion.Clone();
-
- foreach (var motorConfig in hw.HardwareMotors)
+ using (_notification.PushTaskItem("Uploading hardware configuration..."))
{
- var itemConfig = MotorItem.MotorConfigurations.SingleOrDefault(x => x.HardwareMotorType.Code == motorConfig.HardwareMotorType.Code);
-
- if (itemConfig != null)
+ try
{
- itemConfig.MapPrimitivesTo(motorConfig);
- }
- }
+ HardwareVersion hw = null;
+ Configuration config = null;
- foreach (var pidConfig in hw.HardwarePidControls)
- {
- var itemConfig = PidItem.PidConfigurations.SingleOrDefault(x => x.HardwarePidControlType.Code == pidConfig.HardwarePidControlType.Code);
+ await Task.Factory.StartNew(() =>
+ {
+ using (ObservablesContext db = ObservablesContext.CreateDefault())
+ {
+ config = db.Adapter.GetConfiguration(x => x.Guid == ApplicationManager.ConnectedMachine.Machine.ConfigurationGuid).Clone();
+ hw = db.Adapter.GetHardwareVersionByMachine(ApplicationManager.ConnectedMachine.Machine.Guid).Clone();
+ }
+ });
- if (itemConfig != null)
- {
- itemConfig.MapPrimitivesTo(pidConfig);
- }
- }
+ foreach (var motorConfig in hw.HardwareMotors)
+ {
+ var itemConfig = MotorItem.MotorConfigurations.SingleOrDefault(x => x.HardwareMotorType.Code == motorConfig.HardwareMotorType.Code);
- foreach (var winderConfig in hw.HardwareWinders)
- {
- var itemConfig = WinderItem.WinderConfigurations.SingleOrDefault(x => x.HardwareWinderType.Code == winderConfig.HardwareWinderType.Code);
+ if (itemConfig != null)
+ {
+ itemConfig.MapPrimitivesTo(motorConfig);
+ }
+ }
- if (itemConfig != null)
- {
- itemConfig.MapPrimitivesTo(winderConfig);
- }
- }
+ foreach (var pidConfig in hw.HardwarePidControls)
+ {
+ var itemConfig = PidItem.PidConfigurations.SingleOrDefault(x => x.HardwarePidControlType.Code == pidConfig.HardwarePidControlType.Code);
- foreach (var dancerConfig in hw.HardwareDancers)
- {
- var itemConfig = DancerItem.DancerConfigurations.SingleOrDefault(x => x.HardwareDancerType.Code == dancerConfig.HardwareDancerType.Code);
+ if (itemConfig != null)
+ {
+ itemConfig.MapPrimitivesTo(pidConfig);
+ }
+ }
- if (itemConfig != null)
- {
- itemConfig.MapPrimitivesTo(dancerConfig);
- }
- }
+ foreach (var winderConfig in hw.HardwareWinders)
+ {
+ var itemConfig = WinderItem.WinderConfigurations.SingleOrDefault(x => x.HardwareWinderType.Code == winderConfig.HardwareWinderType.Code);
- foreach (var speedSensorConfig in hw.HardwareSpeedSensors)
- {
- var itemConfig = SpeedSensorItem.SpeedSensorConfigurations.SingleOrDefault(x => x.HardwareSpeedSensorType.Code == speedSensorConfig.HardwareSpeedSensorType.Code);
+ if (itemConfig != null)
+ {
+ itemConfig.MapPrimitivesTo(winderConfig);
+ }
+ }
- if (itemConfig != null)
- {
- itemConfig.MapPrimitivesTo(speedSensorConfig);
- }
- }
+ foreach (var dancerConfig in hw.HardwareDancers)
+ {
+ var itemConfig = DancerItem.DancerConfigurations.SingleOrDefault(x => x.HardwareDancerType.Code == dancerConfig.HardwareDancerType.Code);
- foreach (var blowerConfig in hw.HardwareBlowers)
- {
- var itemConfig = BlowerItem.BlowerConfigurations.SingleOrDefault(x => x.HardwareBlowerType.Code == blowerConfig.HardwareBlowerType.Code);
+ if (itemConfig != null)
+ {
+ itemConfig.MapPrimitivesTo(dancerConfig);
+ }
+ }
- if (itemConfig != null)
- {
- itemConfig.MapPrimitivesTo(blowerConfig);
- }
- }
+ foreach (var speedSensorConfig in hw.HardwareSpeedSensors)
+ {
+ var itemConfig = SpeedSensorItem.SpeedSensorConfigurations.SingleOrDefault(x => x.HardwareSpeedSensorType.Code == speedSensorConfig.HardwareSpeedSensorType.Code);
- foreach (var breakSensorConfig in hw.HardwareBreakSensors)
- {
- var itemConfig = BreakSensorItem.BreakSensorConfigurations.SingleOrDefault(x => x.HardwareBreakSensorType.Code == breakSensorConfig.HardwareBreakSensorType.Code);
+ if (itemConfig != null)
+ {
+ itemConfig.MapPrimitivesTo(speedSensorConfig);
+ }
+ }
- if (itemConfig != null)
- {
- itemConfig.MapPrimitivesTo(breakSensorConfig);
- }
- }
+ foreach (var blowerConfig in hw.HardwareBlowers)
+ {
+ var itemConfig = BlowerItem.BlowerConfigurations.SingleOrDefault(x => x.HardwareBlowerType.Code == blowerConfig.HardwareBlowerType.Code);
- using (_notification.PushTaskItem("Uploading hardware configuration..."))
- {
- try
- {
- await MachineOperator.UploadHardwareConfiguration(hw, ApplicationManager.ConnectedMachine.Machine.Configuration);
+ if (itemConfig != null)
+ {
+ itemConfig.MapPrimitivesTo(blowerConfig);
+ }
+ }
+
+ foreach (var breakSensorConfig in hw.HardwareBreakSensors)
+ {
+ var itemConfig = BreakSensorItem.BreakSensorConfigurations.SingleOrDefault(x => x.HardwareBreakSensorType.Code == breakSensorConfig.HardwareBreakSensorType.Code);
+
+ if (itemConfig != null)
+ {
+ itemConfig.MapPrimitivesTo(breakSensorConfig);
+ }
+ }
+
+ await MachineOperator.UploadHardwareConfiguration(hw, config);
}
catch (Exception ex)
{
@@ -1753,11 +1768,19 @@ namespace Tango.MachineStudio.Technician.ViewModels
}
}
- private void ResetHardwareConfiguration(bool showMessage = true)
+ private async void ResetHardwareConfiguration(bool showMessage = true)
{
if (MachineOperator != null)
{
- var hw = ApplicationManager.ConnectedMachine.Machine.Configuration.HardwareVersion;
+ ObservablesContext db = ObservablesContext.CreateDefault();
+ ObservablesContextAdapter adapter = new ObservablesContextAdapter(db);
+
+ HardwareVersion hw = null;
+
+ await Task.Factory.StartNew(() =>
+ {
+ hw = adapter.GetHardwareVersionByMachine(ApplicationManager.ConnectedMachine.Machine.Guid);
+ });
foreach (var motorConfig in hw.HardwareMotors)
{
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml.cs
index b60f4d725..977974f8a 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml.cs
@@ -59,7 +59,7 @@ namespace Tango.MachineStudio.Technician.Views
private void OnActionModeClicked(object sender, MouseButtonEventArgs e)
{
- editor.DeselectElements();
+ //editor.DeselectElements();
}
}
}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/app.config b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/app.config
index 5d794b958..77b7003e2 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/app.config
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/app.config
@@ -1,5 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
+ <configSections>
+ <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
+ <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
+ </configSections>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
@@ -48,4 +52,10 @@
</dependentAssembly>
</assemblyBinding>
</runtime>
+ <entityFramework>
+ <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
+ <providers>
+ <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
+ </providers>
+ </entityFramework>
</configuration> \ No newline at end of file
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/packages.config b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/packages.config
index 49b90c865..ea48e62ff 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/packages.config
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/packages.config
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="CommonServiceLocator" version="1.3" targetFramework="net46" />
+ <package id="EntityFramework" version="6.0.0" targetFramework="net472" />
<package id="Expression.Blend.Sdk" version="1.0.2" targetFramework="net46" />
<package id="FontAwesome.WPF" version="4.7.0.9" targetFramework="net46" />
<package id="Google.Protobuf" version="3.4.1" targetFramework="net46" />
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Properties/AssemblyInfo.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Properties/AssemblyInfo.cs
index 45b3ef1ce..b5f0f2d5b 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Properties/AssemblyInfo.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Properties/AssemblyInfo.cs
@@ -5,7 +5,7 @@ using System.Runtime.InteropServices;
using System.Windows;
[assembly: AssemblyTitle("Tango - Machine Studio Users & Roles Module")]
-[assembly: AssemblyVersion("2.0.7.1633")]
+[assembly: AssemblyVersion("2.0.9.1159")]
[assembly: ComVisible(false)]
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Tango.MachineStudio.UsersAndRoles.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Tango.MachineStudio.UsersAndRoles.csproj
index 48fe2b34c..539f10574 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Tango.MachineStudio.UsersAndRoles.csproj
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Tango.MachineStudio.UsersAndRoles.csproj
@@ -8,7 +8,7 @@
<OutputType>library</OutputType>
<RootNamespace>Tango.MachineStudio.UsersAndRoles</RootNamespace>
<AssemblyName>Tango.MachineStudio.UsersAndRoles</AssemblyName>
- <TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
+ <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/ViewModels/MainViewVM.cs
index 7d82cbbbc..db312b78f 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/ViewModels/MainViewVM.cs
@@ -8,14 +8,16 @@ using System.Threading.Tasks;
using Tango.BL;
using Tango.BL.Entities;
using Tango.Core.Commands;
+using Tango.MachineStudio.Common;
using Tango.MachineStudio.Common.Notifications;
using Tango.MachineStudio.UsersAndRoles.Navigation;
using Tango.MachineStudio.UsersAndRoles.Providers;
using Tango.SharedUI;
+using System.Data.Entity;
namespace Tango.MachineStudio.UsersAndRoles.ViewModels
{
- public class MainViewVM : ViewModel
+ public class MainViewVM : StudioViewModel
{
private ObservablesContext _organizationsContext;
private ObservablesContext _manageContext;
@@ -129,8 +131,6 @@ namespace Tango.MachineStudio.UsersAndRoles.ViewModels
_navigation = navigation;
_notification = notification;
- LoadOrganizations();
-
ManageOrganizationCommand = new RelayCommand(LoadSelectedOrganization, () => SelectedOrganization != null);
BackToOrganizationsCommand = new RelayCommand(BackToOrganizations);
ManageUserCommand = new RelayCommand(LoadSelectedUser, () => SelectedUser != null);
@@ -144,6 +144,11 @@ namespace Tango.MachineStudio.UsersAndRoles.ViewModels
RemoveUserCommand = new RelayCommand(RemoveSelectedUser, () => SelectedUser != null);
}
+ public override void OnApplicationReady()
+ {
+ LoadOrganizations();
+ }
+
private async void AddOrganization()
{
String name = _notification.ShowTextInput("Enter organization name", "Name");
@@ -187,19 +192,20 @@ namespace Tango.MachineStudio.UsersAndRoles.ViewModels
}
}
- private void LoadSelectedUser()
+ private async void LoadSelectedUser()
{
using (_notification.PushTaskItem("Loading user details..."))
{
- Task.Factory.StartNew(() =>
+ await Task.Factory.StartNew(() =>
{
_userContext = ObservablesContext.CreateDefault();
+
Roles = _userContext.Roles.ToObservableCollection();
- ManagedUser = _userContext.Users.SingleOrDefault(x => x.Guid == SelectedUser.Guid);
+ ManagedUser = _userContext.Adapter.GetUser(SelectedUser.Guid);
ManagedUserRoles = ManagedUser.Roles.ToObservableCollection();
-
- InvokeUI(() => _navigation.NavigateTo(UsersAndRolesNavigationView.UserManagementView));
});
+
+ _navigation.NavigateTo(UsersAndRolesNavigationView.UserManagementView);
}
}
@@ -242,31 +248,35 @@ namespace Tango.MachineStudio.UsersAndRoles.ViewModels
}
}
- private void LoadSelectedOrganization()
+ private async void LoadSelectedOrganization()
{
using (_notification.PushTaskItem("Loading organization..."))
{
- Task.Factory.StartNew(() =>
+ await Task.Factory.StartNew(() =>
{
_manageContext = ObservablesContext.CreateDefault();
- ManagedOrganization = _manageContext.Organizations.SingleOrDefault(x => x.Guid == SelectedOrganization.Guid);
- InvokeUI(() => _navigation.NavigateTo(UsersAndRolesNavigationView.OrganizationManagementView));
+ ManagedOrganization = _manageContext.Adapter.GetOrganizationAndUsers(SelectedOrganization.Guid);
});
+
+ _navigation.NavigateTo(UsersAndRolesNavigationView.OrganizationManagementView);
}
}
private void LoadOrganizations()
{
- _organizationsContext = ObservablesContext.CreateDefault();
- _organizationsContext.Configuration.LazyLoadingEnabled = false;
-
- _organizationsContext.Users.ToList();
- _organizationsContext.Contacts.ToList();
- _organizationsContext.Addresses.ToList();
- _organizationsContext.Machines.ToList();
+ Task.Factory.StartNew(() =>
+ {
+ _organizationsContext = ObservablesContext.CreateDefault();
- Organizations = _organizationsContext.Organizations.ToObservableCollection();
+ Organizations = _organizationsContext.Organizations
+ .Include(x => x.Machines)
+ .Include(x => x.Users)
+ .Include(x => x.Users.Select(y => y.Contact))
+ .Include(x => x.Users.Select(y => y.Address))
+ .Include(x => x.Address)
+ .ToObservableCollection();
+ });
}
public void OnDropRole(Role role)