aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner
diff options
context:
space:
mode:
authorShlomo Hecht <shlomo@twine-s.com>2019-09-16 17:48:16 +0300
committerShlomo Hecht <shlomo@twine-s.com>2019-09-16 17:48:16 +0300
commit161fe6f6d2b29ba3deb641cdc049ad0d8f58004e (patch)
tree20318bb7ea4a243b8c2e9757e4635e8d5f5cb728 /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner
parent30fcfa4100a9d00e887c6e17e32e427b05296ce7 (diff)
parentb674a2e7751daa80c0d74207968bf8e3d18d7faf (diff)
downloadTango-161fe6f6d2b29ba3deb641cdc049ad0d8f58004e.tar.gz
Tango-161fe6f6d2b29ba3deb641cdc049ad0d8f58004e.zip
Merge branch 'master' of https://twinetfs.visualstudio.com/Tango/_git/Tango
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner')
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Comparison/HardwareCompareResult.cs26
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Comparison/HardwareComponentCollectionCompareResult.cs29
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Comparison/HardwareComponentCompareResult.cs33
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Comparison/HardwareComponentPropertyResult.cs20
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Report/ReportModel.cs17
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Tango.MachineStudio.HardwareDesigner.csproj18
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/ViewModels/ComparisonWizardViewVM.cs403
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/ViewModels/MainViewVM.cs14
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Views/ComparisonWizardView.xaml330
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Views/ComparisonWizardView.xaml.cs28
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Views/MainView.xaml43
11 files changed, 942 insertions, 19 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Comparison/HardwareCompareResult.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Comparison/HardwareCompareResult.cs
new file mode 100644
index 000000000..6021f309e
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Comparison/HardwareCompareResult.cs
@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.Core;
+
+namespace Tango.MachineStudio.HardwareDesigner.Comparison
+{
+ public class HardwareCompareResult
+ {
+ public SynchronizedObservableCollection<HardwareComponentCollectionCompareResult> Collections { get; set; }
+ public bool HasDifferences
+ {
+ get
+ {
+ return Collections.Any(item => item.HasDifferences);
+ }
+ }
+
+ public HardwareCompareResult()
+ {
+ Collections = new SynchronizedObservableCollection<HardwareComponentCollectionCompareResult>();
+ }
+ }
+}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Comparison/HardwareComponentCollectionCompareResult.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Comparison/HardwareComponentCollectionCompareResult.cs
new file mode 100644
index 000000000..c3c370f7a
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Comparison/HardwareComponentCollectionCompareResult.cs
@@ -0,0 +1,29 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.Core;
+
+namespace Tango.MachineStudio.HardwareDesigner.Comparison
+{
+ public class HardwareComponentCollectionCompareResult
+ {
+ public String CollectionName { get; set; }
+
+ public SynchronizedObservableCollection<HardwareComponentCompareResult> Components { get; set; }
+
+ public bool HasDifferences
+ {
+ get
+ {
+ return Components.Any(item => item.HasDifferences);
+ }
+ }
+
+ public HardwareComponentCollectionCompareResult()
+ {
+ Components = new SynchronizedObservableCollection<HardwareComponentCompareResult>();
+ }
+ }
+}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Comparison/HardwareComponentCompareResult.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Comparison/HardwareComponentCompareResult.cs
new file mode 100644
index 000000000..447984a5f
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Comparison/HardwareComponentCompareResult.cs
@@ -0,0 +1,33 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.Core;
+
+namespace Tango.MachineStudio.HardwareDesigner.Comparison
+{
+ public class HardwareComponentCompareResult
+ {
+ public String ComponentName { get; set; }
+
+ public bool HasComponent1 { get; set; }
+
+ public bool HasComponent2 { get; set; }
+
+ public SynchronizedObservableCollection<HardwareComponentPropertyResult> Properties { get; set; }
+
+ public bool HasDifferences
+ {
+ get
+ {
+ return Properties.Any(item => item.IsDifferent);
+ }
+ }
+
+ public HardwareComponentCompareResult()
+ {
+ Properties = new SynchronizedObservableCollection<HardwareComponentPropertyResult>();
+ }
+ }
+}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Comparison/HardwareComponentPropertyResult.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Comparison/HardwareComponentPropertyResult.cs
new file mode 100644
index 000000000..d57413af1
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Comparison/HardwareComponentPropertyResult.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.MachineStudio.HardwareDesigner.Comparison
+{
+ public class HardwareComponentPropertyResult
+ {
+ public String PropertyName { get; set; }
+ public String Value1 { get; set; }
+ public String Value2 { get; set; }
+
+ public bool IsDifferent
+ {
+ get { return Value1 != Value2; }
+ }
+ }
+}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Report/ReportModel.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Report/ReportModel.cs
new file mode 100644
index 000000000..8f644ceee
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Report/ReportModel.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.MachineStudio.HardwareDesigner.Report
+{
+ public class ReportModel
+ {
+ public String Collection { get; set; }
+ public String Component { get; set; }
+ public String Property { get; set; }
+ public String HW_1 { get; set; }
+ public String HW_2 { get; set; }
+ }
+}
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 09c8c5880..0e7663abc 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
@@ -69,12 +69,25 @@
<Compile Include="..\..\..\Versioning\GlobalVersionInfo.cs">
<Link>GlobalVersionInfo.cs</Link>
</Compile>
+ <Compile Include="Comparison\HardwareCompareResult.cs" />
+ <Compile Include="Comparison\HardwareComponentCollectionCompareResult.cs" />
+ <Compile Include="Comparison\HardwareComponentCompareResult.cs" />
+ <Compile Include="Comparison\HardwareComponentPropertyResult.cs" />
+ <Compile Include="Report\ReportModel.cs" />
<Compile Include="ViewModelLocator.cs" />
+ <Compile Include="ViewModels\ComparisonWizardViewVM.cs" />
+ <Compile Include="Views\ComparisonWizardView.xaml.cs">
+ <DependentUpon>ComparisonWizardView.xaml</DependentUpon>
+ </Compile>
<Compile Include="ViewModels\MainViewVM.cs" />
<Compile Include="Views\MainView.xaml.cs">
<DependentUpon>MainView.xaml</DependentUpon>
</Compile>
<Compile Include="HardwareDesignerModule.cs" />
+ <Page Include="Views\ComparisonWizardView.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ </Page>
<Page Include="Views\MainView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@@ -114,6 +127,10 @@
<Project>{a34ee0f0-649d-41c8-8489-b6f1cc6924ee}</Project>
<Name>Tango.Core</Name>
</ProjectReference>
+ <ProjectReference Include="..\..\..\Tango.CSV\Tango.CSV.csproj">
+ <Project>{58e8825f-0c96-449c-b320-1e82b0aa876b}</Project>
+ <Name>Tango.CSV</Name>
+ </ProjectReference>
<ProjectReference Include="..\..\..\Tango.DragAndDrop\Tango.DragAndDrop.csproj">
<Project>{b112d89a-a106-41ae-a0c1-4abc84c477f5}</Project>
<Name>Tango.DragAndDrop</Name>
@@ -172,6 +189,7 @@
<ItemGroup>
<Resource Include="Images\blower.png" />
</ItemGroup>
+ <ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<ProjectExtensions>
<VisualStudio>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/ViewModels/ComparisonWizardViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/ViewModels/ComparisonWizardViewVM.cs
new file mode 100644
index 000000000..628613fea
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/ViewModels/ComparisonWizardViewVM.cs
@@ -0,0 +1,403 @@
+using Microsoft.Win32;
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.BL;
+using Tango.BL.Builders;
+using Tango.BL.Entities;
+using Tango.BL.Enumerations;
+using Tango.Core.Commands;
+using Tango.CSV;
+using Tango.MachineStudio.Common.Notifications;
+using Tango.MachineStudio.HardwareDesigner.Comparison;
+using Tango.MachineStudio.HardwareDesigner.Report;
+using Tango.SharedUI;
+
+namespace Tango.MachineStudio.HardwareDesigner.ViewModels
+{
+ public class ComparisonWizardViewVM : DialogViewVM
+ {
+ private INotificationProvider _notification;
+ #region Properties
+
+ private ObservableCollection<HardwareVersion> _hardwareVersions;
+ public ObservableCollection<HardwareVersion> HardwareVersions
+ {
+ get { return _hardwareVersions; }
+ set { _hardwareVersions = value; RaisePropertyChangedAuto(); }
+ }
+
+ private HardwareVersion _selectedVersion1;
+ public HardwareVersion SelectedVersion1
+ {
+ get { return _selectedVersion1; }
+ set
+ {
+ if (value != null && (_selectedVersion1 == null || _selectedVersion1.Guid != value.Guid))
+ {
+ _selectedVersion1 = value;
+ RaisePropertyChangedAuto();
+ OnSelectedVersionChanged();
+ }
+ }
+ }
+
+ private HardwareVersion _selectedVersion2;
+ public HardwareVersion SelectedVersion2
+ {
+ get { return _selectedVersion2; }
+ set
+ {
+ if (value != null && (_selectedVersion2 == null || _selectedVersion2.Guid != value.Guid))
+ {
+ _selectedVersion2 = value;
+ RaisePropertyChangedAuto();
+ OnSelectedVersionChanged();
+ }
+
+ }
+ }
+
+ private bool _isShowDifference;
+ public bool IsShowDifference
+ {
+ get { return _isShowDifference; }
+ set
+ {
+ _isShowDifference = value;
+ RaisePropertyChangedAuto();
+ }
+ }
+
+ private HardwareCompareResult _result;
+ public HardwareCompareResult Result
+ {
+ get
+ {
+ return _result;
+ }
+ set
+ {
+ _result = value;
+ RaisePropertyChangedAuto();
+ InvalidateRelayCommands();
+ }
+ }
+
+ private bool _isRunning;
+ public bool IsRunning
+ {
+ get { return _isRunning; }
+ set { _isRunning = value; RaisePropertyChangedAuto(); }
+ }
+
+ #endregion properties
+
+ #region Command
+
+ public RelayCommand GenerateReportCommand { get; set; }
+
+ #endregion
+
+
+ #region Constructors
+
+ public ComparisonWizardViewVM(IEnumerable<HardwareVersion> availableVersions, HardwareVersion selectedVersion, INotificationProvider notification)
+ {
+ HardwareVersions = new ObservableCollection<HardwareVersion>(availableVersions);
+ _selectedVersion1 = selectedVersion;
+
+ _isShowDifference = false;
+ IsRunning = false;
+ IsShowDifference = true;
+ _notification = notification;
+
+ GenerateReportCommand = new RelayCommand(GenerateReport, () => Result != null);
+ }
+
+ #endregion
+
+ #region Report
+
+ private void GenerateReport()
+ {
+ _notification.ShowError($"Error generating HW version comparison report.\n");
+
+ SaveFileDialog dlg = new SaveFileDialog();
+ dlg.Title = "Save Report";
+ dlg.Filter = "CSV Files|*.csv";
+ dlg.FileName = $"hw_compare_report__{SelectedVersion1.Name}__vs__{SelectedVersion2.Name}";
+ dlg.DefaultExt = ".csv";
+ if (dlg.ShowDialog().Value)
+ {
+ try
+ {
+ CsvFile<ReportModel> csvFile = new CsvFile<ReportModel>(new CsvDestination(dlg.FileName), new CsvDefinition()
+ {
+ Columns = new List<String>()
+ {
+ "Collection",
+ "Component",
+ "Property",
+ SelectedVersion1.Name,
+ SelectedVersion2.Name,
+ },
+ });
+
+ foreach (var collection in Result.Collections.Where(x => x.HasDifferences || !IsShowDifference))
+ {
+ ReportModel model_collection = new ReportModel();
+ model_collection.Collection = collection.CollectionName;
+ csvFile.Append(model_collection);
+ foreach (var component in collection.Components.Where(x => x.HasDifferences || !IsShowDifference))
+ {
+ ReportModel model_component = new ReportModel();
+
+ model_component.Component = component.ComponentName;
+ csvFile.Append(model_component);
+ foreach (var prop in component.Properties.Where(x => x.IsDifferent || !IsShowDifference))
+ {
+ ReportModel model = new ReportModel();
+ model.Property = prop.PropertyName;
+ model.HW_1 = prop.Value1;
+ model.HW_2 = prop.Value2;
+ csvFile.Append(model);
+ }
+ }
+ }
+
+ csvFile.Dispose();
+ _notification.ShowInfo("Report generated successfully.");
+ }
+ catch (Exception ex)
+ {
+ LogManager.Log(ex, "Error generating HW version comparison report.");
+ _notification.ShowError($"Error generating HW version comparison report.\n{ex.Message}");
+ }
+ }
+ }
+
+ #endregion
+
+ private async void OnSelectedVersionChanged()
+ {
+ if (SelectedVersion1 != null && SelectedVersion2 != null)
+ {
+ IsRunning = true;
+ using (ObservablesContext db = ObservablesContext.CreateDefault())
+ {
+ var h1 = await new HardwareVersionBuilder(db).Set(SelectedVersion1.Guid).WithHardwareComponents().BuildAsync();
+ var h2 = await new HardwareVersionBuilder(db).Set(SelectedVersion2.Guid).WithHardwareComponents().BuildAsync();
+
+ await Task.Factory.StartNew(() =>
+ {
+ Result = CompareHardwareVersions(h1, h2);
+ IsRunning = false;
+ });
+ }
+ }
+ }
+
+ #region Compare Versions
+
+ private HardwareCompareResult CompareHardwareVersions(HardwareVersion h1, HardwareVersion h2)
+ {
+ _result = new HardwareCompareResult();
+ _result.Collections.Add(CompareMotorsCollection(h1, h2));
+ _result.Collections.Add(CompareDancerCollection(h1, h2));
+ _result.Collections.Add(ComparePidControlsCollection(h1, h2));
+ _result.Collections.Add(CompareWindersCollection(h1, h2));
+ _result.Collections.Add(CompareSpeedSensorsCollection(h1, h2));
+ _result.Collections.Add(CompareBlowersCollection(h1, h2));
+ _result.Collections.Add(CompareBreakSensorCollection(h1, h2));
+
+
+ return _result;
+ }
+ private HardwareComponentCollectionCompareResult CompareMotorsCollection(HardwareVersion h1, HardwareVersion h2)
+ {
+ HardwareComponentCollectionCompareResult collection = new HardwareComponentCollectionCompareResult()
+ {
+ CollectionName = "MOTORS"
+ };
+ foreach (var motorTypeCode in Enum.GetValues(typeof(HardwareMotorTypes)).Cast<HardwareMotorTypes>())
+ {
+ var motor1 = h1.HardwareMotors.SingleOrDefault(x => x.HardwareMotorType.Code == motorTypeCode.ToInt32());
+ var motor2 = h2.HardwareMotors.SingleOrDefault(x => x.HardwareMotorType.Code == motorTypeCode.ToInt32());
+
+ var componentResult = CompareComponents(
+ motorTypeCode.ToDescription(),
+ GetComponentProperties(typeof(HardwareMotorBase)),
+ motor1,
+ motor2);
+
+ collection.Components.Add(componentResult);
+ }
+ return collection;
+ }
+ private HardwareComponentCollectionCompareResult CompareDancerCollection(HardwareVersion h1, HardwareVersion h2)
+ {
+ HardwareComponentCollectionCompareResult collection = new HardwareComponentCollectionCompareResult()
+ {
+ CollectionName = "DANCERS"
+ };
+ foreach (var dancerTypeCode in Enum.GetValues(typeof(HardwareDancerTypes)).Cast<HardwareDancerTypes>())
+ {
+ var motor1 = h1.HardwareDancers.SingleOrDefault(x => x.HardwareDancerType.Code == dancerTypeCode.ToInt32());
+ var motor2 = h2.HardwareDancers.SingleOrDefault(x => x.HardwareDancerType.Code == dancerTypeCode.ToInt32());
+
+ var componentResult = CompareComponents(
+ dancerTypeCode.ToDescription(),
+ GetComponentProperties(typeof(HardwareDancerBase)),
+ motor1,
+ motor2);
+
+ collection.Components.Add(componentResult);
+ }
+ return collection;
+ }
+ private HardwareComponentCollectionCompareResult ComparePidControlsCollection(HardwareVersion h1, HardwareVersion h2)
+ {
+ HardwareComponentCollectionCompareResult collection = new HardwareComponentCollectionCompareResult()
+ {
+ CollectionName = "PID CONTROLS"
+ };
+ foreach (var pidControlsTypeCode in Enum.GetValues(typeof(HardwarePidControlTypes)).Cast<HardwarePidControlTypes>())
+ {
+ var motor1 = h1.HardwarePidControls.SingleOrDefault(x => x.HardwarePidControlType.Code == pidControlsTypeCode.ToInt32());
+ var motor2 = h2.HardwarePidControls.SingleOrDefault(x => x.HardwarePidControlType.Code == pidControlsTypeCode.ToInt32());
+
+ var componentResult = CompareComponents(
+ pidControlsTypeCode.ToDescription(),
+ GetComponentProperties(typeof(HardwarePidControlBase)),
+ motor1,
+ motor2);
+
+ collection.Components.Add(componentResult);
+ }
+ return collection;
+ }
+ private HardwareComponentCollectionCompareResult CompareWindersCollection(HardwareVersion h1, HardwareVersion h2)
+ {
+ HardwareComponentCollectionCompareResult collection = new HardwareComponentCollectionCompareResult()
+ {
+ CollectionName = "WINDERS"
+ };
+ foreach (var WinderTypeCode in Enum.GetValues(typeof(HardwareWinderTypes)).Cast<HardwareWinderTypes>())
+ {
+ var motor1 = h1.HardwareWinders.SingleOrDefault(x => x.HardwareWinderType.Code == WinderTypeCode.ToInt32());
+ var motor2 = h2.HardwareWinders.SingleOrDefault(x => x.HardwareWinderType.Code == WinderTypeCode.ToInt32());
+
+ var componentResult = CompareComponents(
+ WinderTypeCode.ToDescription(),
+ GetComponentProperties(typeof(HardwareWinderBase)),
+ motor1,
+ motor2);
+
+ collection.Components.Add(componentResult);
+ }
+ return collection;
+ }
+ private HardwareComponentCollectionCompareResult CompareSpeedSensorsCollection(HardwareVersion h1, HardwareVersion h2)
+ {
+ HardwareComponentCollectionCompareResult collection = new HardwareComponentCollectionCompareResult()
+ {
+ CollectionName = "SPEED SENSORS"
+ };
+ foreach (var speedSewnsorsTypeCode in Enum.GetValues(typeof(HardwareSpeedSensorTypes)).Cast<HardwareSpeedSensorTypes>())
+ {
+ var motor1 = h1.HardwareSpeedSensors.SingleOrDefault(x => x.HardwareSpeedSensorType.Code == speedSewnsorsTypeCode.ToInt32());
+ var motor2 = h2.HardwareSpeedSensors.SingleOrDefault(x => x.HardwareSpeedSensorType.Code == speedSewnsorsTypeCode.ToInt32());
+
+ var componentResult = CompareComponents(
+ speedSewnsorsTypeCode.ToDescription(),
+ GetComponentProperties(typeof(HardwareSpeedSensorBase)),
+ motor1,
+ motor2);
+
+ collection.Components.Add(componentResult);
+ }
+ return collection;
+ }
+ private HardwareComponentCollectionCompareResult CompareBlowersCollection(HardwareVersion h1, HardwareVersion h2)
+ {
+ HardwareComponentCollectionCompareResult collection = new HardwareComponentCollectionCompareResult()
+ {
+ CollectionName = "BLOWERS"
+ };
+ foreach (var blowersTypeCode in Enum.GetValues(typeof(HardwareBlowerTypes)).Cast<HardwareBlowerTypes>())
+ {
+ var motor1 = h1.HardwareBlowers.SingleOrDefault(x => x.HardwareBlowerType.Code == blowersTypeCode.ToInt32());
+ var motor2 = h2.HardwareBlowers.SingleOrDefault(x => x.HardwareBlowerType.Code == blowersTypeCode.ToInt32());
+
+ var componentResult = CompareComponents(
+ blowersTypeCode.ToDescription(),
+ GetComponentProperties(typeof(HardwareBlowerBase)),
+ motor1,
+ motor2);
+
+ collection.Components.Add(componentResult);
+ }
+ return collection;
+ }
+ private HardwareComponentCollectionCompareResult CompareBreakSensorCollection(HardwareVersion h1, HardwareVersion h2)
+ {
+ HardwareComponentCollectionCompareResult collection = new HardwareComponentCollectionCompareResult()
+ {
+ CollectionName = "BREAK SENSOR"
+ };
+ foreach (var breakSewnsorsTypeCode in Enum.GetValues(typeof(HardwareBreakSensorTypes)).Cast<HardwareBreakSensorTypes>())
+ {
+ var motor1 = h1.HardwareBreakSensors.SingleOrDefault(x => x.HardwareBreakSensorType.Code == breakSewnsorsTypeCode.ToInt32());
+ var motor2 = h2.HardwareBreakSensors.SingleOrDefault(x => x.HardwareBreakSensorType.Code == breakSewnsorsTypeCode.ToInt32());
+
+ var componentResult = CompareComponents(
+ breakSewnsorsTypeCode.ToDescription(),
+ GetComponentProperties(typeof(HardwareBreakSensorBase)),
+ motor1,
+ motor2);
+
+ collection.Components.Add(componentResult);
+ }
+ return collection;
+ }
+
+ private HardwareComponentCompareResult CompareComponents(String name, List<PropertyInfo> properties, Object component1, Object component2)
+ {
+ HardwareComponentCompareResult result = new HardwareComponentCompareResult();
+ result.ComponentName = name;
+ result.HasComponent1 = component1 != null;
+ result.HasComponent2 = component2 != null;
+
+ foreach (var prop in properties)
+ {
+ var hProp = new HardwareComponentPropertyResult();
+ hProp.PropertyName = prop.Name;
+ hProp.Value1 = component1 != null ? (prop.GetValue(component1) == null ? "" : prop.GetValue(component1).ToString()) : null;
+ hProp.Value2 = component2 != null ? (prop.GetValue(component2) == null ? "" : prop.GetValue(component2).ToString()) : null;
+
+ result.Properties.Add(hProp);
+ }
+
+ return result;
+ }
+ private List<PropertyInfo> GetComponentProperties(Type componentType)
+ {
+ List<String> exclude = new List<string>()
+ {
+ "Guid",
+ "ID",
+ "LastUpdated",
+ "Parameters",
+ };
+
+ return componentType.GetProperties(BindingFlags.Instance | BindingFlags.DeclaredOnly | BindingFlags.Public).Where(x => !x.PropertyType.IsClass && !exclude.Contains(x.Name)).ToList();
+ }
+
+ #endregion
+ }
+}
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 73ba02435..918eb02d4 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
@@ -12,6 +12,8 @@ using Tango.BL;
using Tango.SharedUI.Components;
using System.Runtime.CompilerServices;
using Tango.MachineStudio.Common;
+using Tango.Core.ExtensionMethods;
+using Tango.MachineStudio.HardwareDesigner.Views;
namespace Tango.MachineStudio.HardwareDesigner.ViewModels
{
@@ -85,7 +87,7 @@ namespace Tango.MachineStudio.HardwareDesigner.ViewModels
return name;
}
}
-
+
private ObservableCollection<HardwareVersion> _hardwareVersions;
public ObservableCollection<HardwareVersion> HardwareVersions
{
@@ -103,6 +105,8 @@ namespace Tango.MachineStudio.HardwareDesigner.ViewModels
public RelayCommand CopyParametersCommand { get; set; }
+ public RelayCommand OpenComparisonWizardCommand { get; set; }
+
public MainViewVM(INotificationProvider notification)
{
_notification = notification;
@@ -117,6 +121,8 @@ namespace Tango.MachineStudio.HardwareDesigner.ViewModels
CopyParametersCommand = new RelayCommand(CopyParameters, (x) => SelectedVersion != null && IsFree);
CloneCommand = new RelayCommand(CloneCurrentVersion, () => SelectedVersion != null && IsFree);
+
+ OpenComparisonWizardCommand = new RelayCommand(OpenComparisonWizard);
}
public override void OnApplicationReady()
@@ -427,6 +433,12 @@ namespace Tango.MachineStudio.HardwareDesigner.ViewModels
}
}
+ private void OpenComparisonWizard()
+ {
+ ComparisonWizardViewVM vm = new ComparisonWizardViewVM(HardwareVersions, SelectedVersion, _notification);
+ _notification.ShowModalDialog<ComparisonWizardViewVM, ComparisonWizardView>(vm, (x) => { }, () => { });
+ }
+
protected override void RaisePropertyChangedAuto([CallerMemberName] string caller = null)
{
base.RaisePropertyChangedAuto(caller);
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Views/ComparisonWizardView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Views/ComparisonWizardView.xaml
new file mode 100644
index 000000000..d8a125e02
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Views/ComparisonWizardView.xaml
@@ -0,0 +1,330 @@
+<UserControl x:Class="Tango.MachineStudio.HardwareDesigner.Views.ComparisonWizardView"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
+ xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls"
+ xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI"
+ xmlns:local="clr-namespace:Tango.MachineStudio.HardwareDesigner.ViewModels"
+ mc:Ignorable="d"
+ d:DesignHeight="800" d:DesignWidth="800" Height="700" Width="1100" Foreground="{StaticResource Dialog.Foreground}" Background="{StaticResource Dialog.Background}">
+ <UserControl.Resources>
+ <converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
+ <converters:BooleanToVisibilityInverseConverter x:Key="BooleanToVisibilityInverseConverter" />
+ <Style TargetType="TextBlock" x:Key="DifferenceTextBoxStyle">
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding IsDifferent}" Value="True" >
+ <Setter Property="Foreground" Value="{StaticResource RedBrush100}"/>
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ <Style TargetType="TextBlock" x:Key="CollectionHasDifferenceTextBox">
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding HasDifferences}" Value="True" >
+ <Setter Property="Foreground" Value="{StaticResource RedBrush100}"/>
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ <Style TargetType="ItemsControl" >
+ <Setter Property="FontSize" Value="14"></Setter>
+ <Setter Property="FontWeight" Value="Normal"></Setter>
+ </Style>
+ </UserControl.Resources>
+ <Grid>
+ <Grid Margin="10">
+ <Grid.RowDefinitions>
+ <RowDefinition Height="40"></RowDefinition>
+ <RowDefinition Height="40"></RowDefinition>
+ <RowDefinition Height="*" MinHeight="200"></RowDefinition>
+ <RowDefinition Height="Auto"></RowDefinition>
+ </Grid.RowDefinitions>
+ <UniformGrid Columns="3" Grid.Row="0" >
+ <ComboBox Margin="10 0 0 0" HorizontalAlignment="Left" IsEnabled="{Binding IsFree}" ItemsSource="{Binding HardwareVersions}" SelectedItem="{Binding SelectedVersion1}" Width="300" FontSize="16" FontWeight="Bold" materialDesign:HintAssist.Hint="Hardware Version 1">
+ <ComboBox.ItemTemplate>
+ <DataTemplate>
+ <TextBlock><Run Text="{Binding Name}"></Run> <Run></Run> <Run Foreground="{StaticResource Dialog.Foreground}" FontSize="14">v</Run><Run Foreground="{StaticResource Dialog.Foreground}" FontSize="14" Text="{Binding Version}"></Run></TextBlock>
+ </DataTemplate>
+ </ComboBox.ItemTemplate>
+ </ComboBox>
+
+ <TextBlock Text="Comparison Wizard" Foreground="{StaticResource LightGrayBrush}" FontStyle="Italic" FontWeight="Bold" FontSize="28" HorizontalAlignment="Center" VerticalAlignment="Center" ></TextBlock>
+
+ <ComboBox IsEnabled="{Binding IsFree}" ItemsSource="{Binding HardwareVersions}" SelectedItem="{Binding SelectedVersion2}" Width="300" FontSize="16" FontWeight="Bold" materialDesign:HintAssist.Hint="Hardware Version 2">
+ <ComboBox.ItemTemplate>
+ <DataTemplate>
+ <TextBlock><Run Text="{Binding Name}"></Run> <Run></Run> <Run Foreground="{StaticResource Dialog.Foreground}" FontSize="14">v</Run><Run Foreground="{StaticResource Dialog.Foreground}" FontSize="14" Text="{Binding Version}"></Run></TextBlock>
+ </DataTemplate>
+ </ComboBox.ItemTemplate>
+ </ComboBox>
+ </UniformGrid>
+ <StackPanel Orientation="Horizontal" Grid.Row="1" VerticalAlignment="Center" Margin="10 0 0 0" HorizontalAlignment="Left">
+ <CheckBox Name="cbShowOnlyDifference" IsChecked="{Binding IsShowDifference}" VerticalAlignment="Center"></CheckBox>
+ <TextBlock Margin="10 0 0 0" VerticalAlignment="Center" Text="Show Only Differences" FontSize="16" FontWeight="Normal"></TextBlock>
+ </StackPanel>
+ <Grid Grid.Row="2">
+ <ScrollViewer VerticalScrollBarVisibility="Auto" Margin="0 0 0 0" >
+ <Grid >
+ <ItemsControl Margin="0, 0, 0, 0" Name="lvDataBinding" ItemsSource="{Binding Result.Collections}" HorizontalContentAlignment="Stretch"
+ VerticalContentAlignment="Top" >
+ <ItemsControl.ItemTemplate>
+ <DataTemplate>
+ <StackPanel Orientation="Vertical">
+ <TextBlock Margin="0,10,0,5" Text="{Binding CollectionName}" FontSize="22" FontWeight="SemiBold" HorizontalAlignment="Center" VerticalAlignment="Center" Style="{StaticResource CollectionHasDifferenceTextBox}"/>
+ <Grid>
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="500*"/>
+ <ColumnDefinition Width="500*"/>
+ </Grid.ColumnDefinitions>
+ <Border Name="LeftB" Grid.Column="0" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
+ <materialDesign:Card Margin="5,10,5,0" Padding="20 10">
+ <StackPanel Orientation="Vertical">
+ <ItemsControl Margin="10,0,0,0" Name="ComponentListLeft" ItemsSource="{Binding Components}" HorizontalContentAlignment="Stretch">
+ <ItemsControl.ItemTemplate>
+ <DataTemplate>
+ <StackPanel Orientation="Vertical">
+ <TextBlock Margin="0,5,0,5" Text="{Binding ComponentName}" FontWeight="SemiBold" FontSize="18" Style="{StaticResource CollectionHasDifferenceTextBox}"/>
+ <Grid>
+ <ItemsControl Grid.Row="1" Margin="10" Name="PropertyListL" ItemsSource="{Binding Properties}" HorizontalContentAlignment="Stretch">
+ <ItemsControl.ItemTemplate>
+ <DataTemplate>
+ <Grid>
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="8*" />
+ <ColumnDefinition Width="2*"/>
+ </Grid.ColumnDefinitions>
+ <TextBlock Text="{Binding PropertyName}" FontWeight="Normal" Grid.Column="0" Style="{StaticResource DifferenceTextBoxStyle}"/>
+ <TextBlock Text="{Binding Value1}" Grid.Column="1" Style="{StaticResource DifferenceTextBoxStyle}"/>
+ </Grid>
+ <DataTemplate.Triggers>
+ <MultiDataTrigger>
+ <MultiDataTrigger.Conditions>
+ <Condition Binding="{Binding ElementName=cbShowOnlyDifference, Path=IsChecked}" Value="True" />
+ <Condition Binding="{Binding IsDifferent}" Value="False" />
+ </MultiDataTrigger.Conditions>
+ <MultiDataTrigger.Setters>
+ <Setter Property="Visibility" Value="Collapsed" />
+ </MultiDataTrigger.Setters>
+ </MultiDataTrigger>
+ </DataTemplate.Triggers>
+ </DataTemplate>
+ </ItemsControl.ItemTemplate>
+ <ItemsControl.Style>
+ <Style TargetType="ItemsControl">
+ <Setter Property="Visibility" Value="Visible" />
+ <Style.Triggers>
+ <MultiDataTrigger>
+ <MultiDataTrigger.Conditions>
+ <Condition Binding="{Binding HasComponent1}" Value="False" />
+ <Condition Binding="{Binding HasComponent2}" Value="True" />
+ </MultiDataTrigger.Conditions>
+ <MultiDataTrigger.Setters>
+ <Setter Property="Visibility" Value="Hidden" />
+ </MultiDataTrigger.Setters>
+ </MultiDataTrigger>
+ </Style.Triggers>
+ </Style>
+ </ItemsControl.Style>
+ </ItemsControl>
+ <Border HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="Transparent" Height="{Binding ActualHeight, ElementName=PropertyListL}">
+ <Border.Style>
+ <Style TargetType="Border">
+ <Setter Property="Visibility" Value="Collapsed" />
+ <Style.Triggers>
+ <MultiDataTrigger>
+ <MultiDataTrigger.Conditions>
+ <Condition Binding="{Binding HasComponent1}" Value="False" />
+ <Condition Binding="{Binding HasComponent2}" Value="True" />
+ </MultiDataTrigger.Conditions>
+ <MultiDataTrigger.Setters>
+ <Setter Property="Visibility" Value="Visible" />
+ </MultiDataTrigger.Setters>
+ </MultiDataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Border.Style>
+ <TextBlock Text="None" Foreground="{StaticResource RedBrush100}" FontWeight="SemiBold" HorizontalAlignment="Center" FontSize="16" VerticalAlignment="Center"/>
+ </Border>
+ </Grid>
+ </StackPanel>
+ <DataTemplate.Triggers>
+ <MultiDataTrigger>
+ <MultiDataTrigger.Conditions>
+ <Condition Binding="{Binding HasComponent1}" Value="False" />
+ <Condition Binding="{Binding HasComponent2}" Value="False" />
+ </MultiDataTrigger.Conditions>
+ <MultiDataTrigger.Setters>
+ <Setter Property="Visibility" Value="Collapsed" />
+ </MultiDataTrigger.Setters>
+ </MultiDataTrigger>
+ <MultiDataTrigger>
+ <MultiDataTrigger.Conditions>
+ <Condition Binding="{Binding ElementName=cbShowOnlyDifference, Path=IsChecked}" Value="True" />
+ <Condition Binding="{Binding HasDifferences}" Value="False" />
+ </MultiDataTrigger.Conditions>
+ <MultiDataTrigger.Setters>
+ <Setter Property="Visibility" Value="Collapsed" />
+ </MultiDataTrigger.Setters>
+ </MultiDataTrigger>
+ </DataTemplate.Triggers>
+ </DataTemplate>
+ </ItemsControl.ItemTemplate>
+ </ItemsControl>
+ </StackPanel>
+ </materialDesign:Card>
+ </Border>
+ <Border Name="RightB" Grid.Column="1" Margin="10,0,0,0">
+ <materialDesign:Card Margin="5,10,5,0" Padding="20 10">
+ <StackPanel Orientation="Vertical">
+ <ItemsControl Margin="10,0,0,0" Name="ComponentListRight" ItemsSource="{Binding Components}" HorizontalContentAlignment="Stretch">
+ <ItemsControl.ItemTemplate>
+ <DataTemplate>
+ <StackPanel Orientation="Vertical">
+ <TextBlock Margin="0,5,0,5" FontSize="18" Text="{Binding ComponentName}" FontWeight="SemiBold" Style="{StaticResource CollectionHasDifferenceTextBox}"/>
+ <Grid>
+ <ItemsControl Grid.Row="1" Margin="10" Name="PropertyListR" ItemsSource="{Binding Properties}" HorizontalContentAlignment="Stretch">
+ <ItemsControl.ItemTemplate>
+ <DataTemplate>
+ <Grid>
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="8*" />
+ <ColumnDefinition Width="2*"/>
+ </Grid.ColumnDefinitions>
+ <TextBlock Text="{Binding PropertyName}" FontWeight="Normal" Grid.Column="0" Style="{StaticResource DifferenceTextBoxStyle}"/>
+ <TextBlock Text="{Binding Value2}" Grid.Column="1" Style="{StaticResource DifferenceTextBoxStyle}"/>
+ </Grid>
+ <DataTemplate.Triggers>
+ <MultiDataTrigger>
+ <MultiDataTrigger.Conditions>
+ <Condition Binding="{Binding ElementName=cbShowOnlyDifference, Path=IsChecked}" Value="True" />
+ <Condition Binding="{Binding IsDifferent}" Value="False" />
+ </MultiDataTrigger.Conditions>
+ <MultiDataTrigger.Setters>
+ <Setter Property="Visibility" Value="Collapsed" />
+ </MultiDataTrigger.Setters>
+ </MultiDataTrigger>
+ </DataTemplate.Triggers>
+ </DataTemplate>
+ </ItemsControl.ItemTemplate>
+ <ItemsControl.Style>
+ <Style TargetType="ItemsControl">
+ <Setter Property="Visibility" Value="Visible" />
+ <Style.Triggers>
+ <MultiDataTrigger>
+ <MultiDataTrigger.Conditions>
+ <Condition Binding="{Binding HasComponent2}" Value="False" />
+ <Condition Binding="{Binding HasComponent1}" Value="True" />
+ </MultiDataTrigger.Conditions>
+ <MultiDataTrigger.Setters>
+ <Setter Property="Visibility" Value="Hidden" />
+ </MultiDataTrigger.Setters>
+ </MultiDataTrigger>
+ </Style.Triggers>
+ </Style>
+ </ItemsControl.Style>
+ </ItemsControl>
+ <Border HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="Transparent" Height="{Binding ActualHeight, ElementName=PropertyListR}">
+ <Border.Style>
+ <Style TargetType="Border">
+ <Setter Property="Visibility" Value="Collapsed" />
+ <Style.Triggers>
+ <MultiDataTrigger>
+ <MultiDataTrigger.Conditions>
+ <Condition Binding="{Binding HasComponent2}" Value="False" />
+ <Condition Binding="{Binding HasComponent1}" Value="True" />
+ </MultiDataTrigger.Conditions>
+ <MultiDataTrigger.Setters>
+ <Setter Property="Visibility" Value="Visible" />
+ </MultiDataTrigger.Setters>
+ </MultiDataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Border.Style>
+ <TextBlock Text="None" FontWeight="SemiBold" HorizontalAlignment="Center" FontSize="16" VerticalAlignment="Center" Foreground="{StaticResource RedBrush100}"/>
+ </Border>
+ </Grid>
+ </StackPanel>
+ <DataTemplate.Triggers>
+ <MultiDataTrigger>
+ <MultiDataTrigger.Conditions>
+ <Condition Binding="{Binding HasComponent1}" Value="False" />
+ <Condition Binding="{Binding HasComponent2}" Value="False" />
+ </MultiDataTrigger.Conditions>
+ <MultiDataTrigger.Setters>
+ <Setter Property="Visibility" Value="Collapsed" />
+ </MultiDataTrigger.Setters>
+ </MultiDataTrigger>
+ <MultiDataTrigger>
+ <MultiDataTrigger.Conditions>
+ <Condition Binding="{Binding ElementName=cbShowOnlyDifference, Path=IsChecked}" Value="True" />
+ <Condition Binding="{Binding HasDifferences}" Value="False" />
+ </MultiDataTrigger.Conditions>
+ <MultiDataTrigger.Setters>
+ <Setter Property="Visibility" Value="Collapsed" />
+ </MultiDataTrigger.Setters>
+ </MultiDataTrigger>
+ </DataTemplate.Triggers>
+ </DataTemplate>
+ </ItemsControl.ItemTemplate>
+ </ItemsControl>
+ </StackPanel>
+ </materialDesign:Card>
+ </Border>
+ </Grid>
+ </StackPanel>
+ <DataTemplate.Triggers>
+ <MultiDataTrigger>
+ <MultiDataTrigger.Conditions>
+ <Condition Binding="{Binding ElementName=cbShowOnlyDifference, Path=IsChecked}" Value="True" />
+ <Condition Binding="{Binding HasDifferences}" Value="False" />
+ </MultiDataTrigger.Conditions>
+ <MultiDataTrigger.Setters>
+ <Setter Property="Visibility" Value="Collapsed" />
+ </MultiDataTrigger.Setters>
+ </MultiDataTrigger>
+ </DataTemplate.Triggers>
+ </DataTemplate>
+ </ItemsControl.ItemTemplate>
+ </ItemsControl>
+ </Grid>
+ </ScrollViewer>
+
+ </Grid>
+ <Grid Grid.Row="3" Margin="0,30,0,0">
+ <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
+
+ <Button Height="40" Command="{Binding GenerateReportCommand}" Margin="0,0,20,0">
+ <StackPanel Orientation="Horizontal">
+ <materialDesign:PackIcon Kind="FileExcel" Width="24" Height="24" />
+ <TextBlock Margin="10 0 0 0" VerticalAlignment="Center">GENERATE REPORT</TextBlock>
+ </StackPanel>
+ </Button>
+
+ <Button Width="140" Height="40" Command="{Binding OKCommand}">CLOSE</Button>
+ </StackPanel>
+ </Grid>
+
+ </Grid>
+ <Border CornerRadius="5" HorizontalAlignment="Center" VerticalAlignment="Center" Background="{StaticResource Transparent200}" Width="700" Height="350">
+ <Border.Style>
+ <Style TargetType="Border">
+ <Setter Property="Visibility" Value="Hidden"></Setter>
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding Result}" Value="{x:Null}">
+ <Setter Property="Visibility" Value="Visible"></Setter>
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Border.Style>
+
+ <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="16" Foreground="Gray">Select two hardware versions to display a comparison report</TextBlock>
+ </Border>
+ <Grid HorizontalAlignment="Stretch" Margin="10" VerticalAlignment="Stretch" Visibility="{Binding IsRunning,Converter={StaticResource BooleanToVisibilityConverter}}"
+ Background="{StaticResource TransparentBackgroundBrush500}">
+ <StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
+ <mahapps:ProgressRing Foreground="#007ACC" Width="80" Height="80"></mahapps:ProgressRing>
+ <TextBlock Text="Loading..." FontStyle="Italic" Margin="10 0 0 0" FontSize="30" VerticalAlignment="Center" Foreground="{StaticResource HomePageForeground}"></TextBlock>
+ </StackPanel>
+ </Grid>
+ </Grid>
+</UserControl>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Views/ComparisonWizardView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Views/ComparisonWizardView.xaml.cs
new file mode 100644
index 000000000..f3cc7519a
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Views/ComparisonWizardView.xaml.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace Tango.MachineStudio.HardwareDesigner.Views
+{
+ /// <summary>
+ /// Interaction logic for ComparisonWizardView.xaml
+ /// </summary>
+ public partial class ComparisonWizardView : UserControl
+ {
+ public ComparisonWizardView()
+ {
+ InitializeComponent();
+ }
+ }
+}
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 121e6e45c..86cc089e5 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
@@ -60,11 +60,18 @@
<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>
+ <TextBlock><Run Text="{Binding Name}"></Run> <Run></Run> <Run Foreground="{StaticResource MainWindow.Foreground}" FontSize="14">v</Run><Run Foreground="{StaticResource MainWindow.Foreground}" FontSize="14" Text="{Binding Version}"></Run></TextBlock>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
+
</StackPanel>
+ <Button Margin="100,10,0,0" Cursor="Hand" Height="40" FontSize="12" ToolTip="Open Comparison Wizard" Command="{Binding OpenComparisonWizardCommand}">
+ <StackPanel Orientation="Horizontal">
+ <materialDesign:PackIcon Width="24" Height="24" Kind="Compare"/>
+ <TextBlock Margin="10 0 0 0" VerticalAlignment="Center" FontSize="16">Comparison Wizard</TextBlock>
+ </StackPanel>
+ </Button>
</StackPanel>
</Grid>
@@ -356,28 +363,28 @@
<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">
- <StackPanel>
- <TextBlock Text="HARDWARE VERSION" Foreground="Gray" FontWeight="Bold" FontStyle="Italic" FontSize="16"></TextBlock>
+ <materialDesign:Card Margin="5,10,5,0" Background="{DynamicResource WhiteBackgroundBrush}" Padding="20 10">
+ <StackPanel >
+ <TextBlock Text="HARDWARE VERSION" Foreground="{StaticResource GrayBrush}" FontWeight="Bold" FontStyle="Italic" FontSize="16"></TextBlock>
- <TextBlock Margin="0 10 0 0" FontSize="10" Foreground="Gray">Name</TextBlock>
+ <TextBlock Margin="0 10 0 0" FontSize="10" Foreground="{StaticResource GrayBrush}">Name</TextBlock>
<TextBox Text="{Binding CurrentVersion.Name,UpdateSourceTrigger=PropertyChanged}"></TextBox>
- <TextBlock Margin="0 20 0 0" FontSize="10" Foreground="Gray">Version</TextBlock>
- <mahApps:NumericUpDown Minimum="0" BorderThickness="0 0 0 1" HorizontalContentAlignment="Left" Maximum="1000" HasDecimals="True" Value="{Binding CurrentVersion.Version}" />
+ <TextBlock Margin="0 20 0 0" FontSize="10" Foreground="{StaticResource GrayBrush}">Version</TextBlock>
+ <mahApps:NumericUpDown Minimum="0" BorderThickness="0 0 0 1" HorizontalContentAlignment="Left" Maximum="1000" HasDecimals="True" Value="{Binding CurrentVersion.Version}" Foreground="{StaticResource GrayBrush}"/>
</StackPanel>
</materialDesign:Card>
- <materialDesign:Card Margin="5,10,5,0" Background="{DynamicResource MaterialDesignBackground}">
- <StackPanel>
+ <materialDesign:Card Margin="5,10,5,0" Background="{DynamicResource WhiteBackgroundBrush}">
+ <StackPanel >
<Grid>
- <Expander HorizontalAlignment="Stretch" IsExpanded="True">
+ <Expander HorizontalAlignment="Stretch" IsExpanded="True" Background="{DynamicResource Card.Background}">
<Expander.Header>
- <TextBlock FontSize="18" Foreground="#595959" FontWeight="Bold" FontStyle="Italic">
+ <TextBlock FontSize="18" Foreground="{StaticResource MainWindow.Foreground}" FontWeight="Bold" FontStyle="Italic">
<Run Text="{Binding SelectedHardwareObjectTypeName,Mode=OneWay}"></Run>
</TextBlock>
</Expander.Header>
- <StackPanel>
+ <StackPanel >
<editors:ParameterizedEditor ParameterizedObject="{Binding SelectedHardwareObject}" Padding="10">
<editors:ParameterizedEditor.ItemsPanel>
<ItemsPanelTemplate>
@@ -388,7 +395,7 @@
<DataTemplate>
<DockPanel>
<mahApps:NumericUpDown DockPanel.Dock="Right" Background="Transparent" BorderThickness="0 0 0 0" Value="{Binding Value,UpdateSourceTrigger=PropertyChanged}" HasDecimals="True" HorizontalContentAlignment="Center" Width="100" />
- <TextBlock Text="{Binding Name}" VerticalAlignment="Center"></TextBlock>
+ <TextBlock Text="{Binding Name}" VerticalAlignment="Center" Foreground="{StaticResource MainWindow.Foreground}"></TextBlock>
</DockPanel>
</DataTemplate>
</editors:ParameterizedEditor.DoubleTemplate>
@@ -396,15 +403,15 @@
<DataTemplate>
<DockPanel>
<mahApps:NumericUpDown DockPanel.Dock="Right" Background="Transparent" BorderThickness="0 0 0 0" Value="{Binding Value,Converter={StaticResource DoubleToIntConverter},UpdateSourceTrigger=PropertyChanged}" HasDecimals="False" HorizontalContentAlignment="Center" Width="100" />
- <TextBlock Text="{Binding Name}" VerticalAlignment="Center"></TextBlock>
+ <TextBlock Text="{Binding Name}" VerticalAlignment="Center" Foreground="{StaticResource MainWindow.Foreground}"></TextBlock>
</DockPanel>
</DataTemplate>
</editors:ParameterizedEditor.Int32Template>
<editors:ParameterizedEditor.BooleanTemplate>
<DataTemplate>
<DockPanel Margin="0 5 0 0">
- <ToggleButton DockPanel.Dock="Right" Width="100" IsChecked="{Binding Value}" HorizontalAlignment="Right" />
- <TextBlock Text="{Binding Name}" VerticalAlignment="Center"></TextBlock>
+ <ToggleButton DockPanel.Dock="Right" Width="100" IsChecked="{Binding Value}" HorizontalAlignment="Right" Foreground="{StaticResource MainWindow.Foreground}"/>
+ <TextBlock Text="{Binding Name}" VerticalAlignment="Center" Foreground="{StaticResource MainWindow.Foreground}"></TextBlock>
</DockPanel>
</DataTemplate>
</editors:ParameterizedEditor.BooleanTemplate>
@@ -420,7 +427,7 @@
<Grid Grid.Row="1" Margin="10 0 10 10">
<UniformGrid Rows="1">
- <Button Height="Auto" Grid.Column="1" Command="{Binding DeleteCommand}" Margin="2" Background="#FF8A8A" BorderBrush="#FF8A8A">
+ <Button Height="Auto" Grid.Column="1" Command="{Binding DeleteCommand}" Margin="2" Background="{StaticResource RedBrush400}" BorderBrush="{StaticResource RedBrush400}">
<StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Width="20" Height="20" VerticalAlignment="Center" Kind="Delete"></materialDesign:PackIcon>
<TextBlock FontSize="14" Margin="10 0 0 0" VerticalAlignment="Center">DEL</TextBlock>
@@ -432,7 +439,7 @@
<TextBlock FontSize="14" Margin="10 0 0 0" VerticalAlignment="Center">NEW</TextBlock>
</StackPanel>
</Button>
- <Button Height="Auto" Grid.Column="1" Command="{Binding CloneCommand}" Margin="2" Background="#FF9A6A" BorderBrush="#FF9A6A">
+ <Button Height="Auto" Grid.Column="1" Command="{Binding CloneCommand}" Margin="2" Background="{StaticResource OrangeBrush300}" BorderBrush="{StaticResource OrangeBrush300}">
<StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Width="20" Height="20" VerticalAlignment="Center" Kind="ContentCopy"></materialDesign:PackIcon>
<TextBlock FontSize="14" Margin="10 0 0 0" VerticalAlignment="Center">CLONE</TextBlock>