From a009e4db12c49028bd7414bdbfd645dc6b7f52cd Mon Sep 17 00:00:00 2001 From: Victoria Plitt Date: Mon, 7 Oct 2019 10:10:10 +0300 Subject: Refactoring code - added comments --- .../Models/HardwareCollection.cs | 2 +- .../Models/HardwareComponent.cs | 6 +- .../Models/HardwareParameter.cs | 90 ++++++++++++++-------- .../Models/IHasDifference.cs | 13 ++++ .../Tango.MachineStudio.MachineDesigner.csproj | 3 +- .../ViewModels/HardwareConfigurationViewVM.cs | 2 +- .../Views/HardwareConfigurationView.xaml | 6 +- .../Tango.BrushPicker/Themes/Generic.xaml | 5 +- 8 files changed, 87 insertions(+), 40 deletions(-) create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Models/IHasDifference.cs (limited to 'Software/Visual_Studio') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Models/HardwareCollection.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Models/HardwareCollection.cs index 765bc9dfd..7c774e65f 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Models/HardwareCollection.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Models/HardwareCollection.cs @@ -7,7 +7,7 @@ using Tango.Core; namespace Tango.MachineStudio.MachineDesigner.Models { - public class HardwareCollection : ExtendedObject + public class HardwareCollection : ExtendedObject, IHasDifference { public String CollectionName { get; set; } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Models/HardwareComponent.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Models/HardwareComponent.cs index d03428ce5..c0610dd5f 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Models/HardwareComponent.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Models/HardwareComponent.cs @@ -7,7 +7,7 @@ using Tango.Core; namespace Tango.MachineStudio.MachineDesigner.Models { - public class HardwareComponent : ExtendedObject + public class HardwareComponent : ExtendedObject, IHasDifference { public String ComponentName { get; set; } public String Description { get; set; } @@ -16,12 +16,14 @@ namespace Tango.MachineStudio.MachineDesigner.Models { get { - return Properties.Any(item => item.IsDifferent); + return Properties.Any(item => item.HasDifferences); } } + public HardwareComponent() { Properties = new SynchronizedObservableCollection(); } + } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Models/HardwareParameter.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Models/HardwareParameter.cs index 33dbcad71..9e30874e9 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Models/HardwareParameter.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Models/HardwareParameter.cs @@ -8,16 +8,23 @@ using Tango.Core.Commands; namespace Tango.MachineStudio.MachineDesigner.Models { - public class HardwareParameter : ExtendedObject + /// + /// The HardwareParameter class. + /// Contains default/editable/actual value and data type of each hardware parameter reflected in . + /// + /// + /// This class provides data state changes. + /// + public class HardwareParameter : ExtendedObject, IHasDifference { - public event EventHandler Selected; - + #region properties public HardwareComponent Component { get; set; } - public RelayCommand DeleteCommand { get; set; } - public String PropertyName { get; set; } + /// + /// The default value contains data from database + /// private Object _defaultValue; public Object DefaultValue { @@ -27,12 +34,18 @@ namespace Tango.MachineStudio.MachineDesigner.Models _defaultValue = value; } } - + /// + /// The type of hardware parameter is used for display correct ui element. + /// Can be boolean, int32, or Double + /// public Type Type { get { return DefaultValue.GetType(); } } - // updated after editing + + /// + /// The value contains modified data, saved in database or immediately after editing in this session + /// private Object _actualValue = null; public Object ActualValue { @@ -41,12 +54,15 @@ namespace Tango.MachineStudio.MachineDesigner.Models { _actualValue = value; RaisePropertyChangedAuto(); - RaisePropertyChanged(nameof(IsDifferent)); + RaisePropertyChanged(nameof(HasDifferences)); RaisePropertyChanged(nameof(IsValuesMatched)); } } - // displayed during editing + /// + /// The editable value contains value displayed in edit box in UI. + /// Initialization the value occurs by clicking in UI and the value will be equal actual value if it exists or default value. + /// private Object _editableValue = null; public Object EditableValue { @@ -75,8 +91,34 @@ namespace Tango.MachineStudio.MachineDesigner.Models } } } + /// + /// Used in UI to display modified value + /// + public bool HasDifferences + { + get + { + return (ActualValue != null); + } + } + /// + /// Used to display warning explanation icon in case actual value equals default value + /// + public bool IsValuesMatched + { + get + { + return ActualValue != null && ActualValue.ToString() == DefaultValue.ToString(); + } + } + #endregion properties - + #region events + /// + /// Occurs when start select mode. + /// Used to set in all others Parameter IsSelected to false except this. + /// + public event EventHandler Selected; private void OnIsSelectedChanged() { if (IsSelected) @@ -91,32 +133,20 @@ namespace Tango.MachineStudio.MachineDesigner.Models } } } - - public bool IsDifferent - { - get - { - return (ActualValue != null); - } - } - - public bool IsValuesMatched + #endregion + #region constructors + public HardwareParameter() { - get - { - return ActualValue != null && ActualValue.ToString() == DefaultValue.ToString(); - } + DeleteCommand = new RelayCommand(DeleteValue); } - + #endregion + #region commands + public RelayCommand DeleteCommand { get; set; } public void DeleteValue() { ActualValue = null; EditableValue = null; } - - public HardwareParameter() - { - DeleteCommand = new RelayCommand(DeleteValue); - } + #endregion } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Models/IHasDifference.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Models/IHasDifference.cs new file mode 100644 index 000000000..bd4851867 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Models/IHasDifference.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.MachineStudio.MachineDesigner.Models +{ + interface IHasDifference + { + bool HasDifferences { get;} + } +} 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 855b0d196..0e6cca479 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 @@ -81,6 +81,7 @@ + @@ -303,7 +304,7 @@ - + \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/HardwareConfigurationViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/HardwareConfigurationViewVM.cs index 415a8ab72..f7ae88f68 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/HardwareConfigurationViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/HardwareConfigurationViewVM.cs @@ -316,7 +316,7 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels { HardwareConfiguration hwConfig = new HardwareConfiguration(); - foreach (var parameter in Collections.SelectMany(x => x.Components).SelectMany(x => x.Properties).Where(x => x.IsDifferent)) + foreach (var parameter in Collections.SelectMany(x => x.Components).SelectMany(x => x.Properties).Where(x => x.HasDifferences)) { hwConfig.Parameters.Add(new HardwareConfiguration.HardwareConfigurationParameter() { diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/HardwareConfigurationView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/HardwareConfigurationView.xaml index ca9ea99b4..f63fbf28c 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/HardwareConfigurationView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/HardwareConfigurationView.xaml @@ -80,7 +80,7 @@ : - + @@ -188,7 +188,7 @@ - @@ -198,7 +198,7 @@ - + diff --git a/Software/Visual_Studio/Tango.BrushPicker/Themes/Generic.xaml b/Software/Visual_Studio/Tango.BrushPicker/Themes/Generic.xaml index b496be57b..79de31f10 100644 --- a/Software/Visual_Studio/Tango.BrushPicker/Themes/Generic.xaml +++ b/Software/Visual_Studio/Tango.BrushPicker/Themes/Generic.xaml @@ -583,8 +583,9 @@ --> - + + - + + diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml.cs index d0eec65e2..915deb484 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml.cs @@ -105,19 +105,24 @@ namespace Tango.MachineStudio.UI switch (ratio) { case 16d / 9d: - grid.Height = 1000; + grid.Height = 1145; + grid.Width = 2000; break; case 16d / 10d: grid.Height = 1145; + grid.Width = 1920; break; case 4d / 3d: grid.Height = 1280; + grid.Width = 1920; break; case 1366d / 768d: grid.Height = 1100; + grid.Width = 1920; break; default: grid.Height = 1145; + grid.Width = 1920; break; } } diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/SystemViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/SystemViewVM.cs index e01003c0b..444c1d09e 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/SystemViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/SystemViewVM.cs @@ -3,6 +3,8 @@ using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Management; +using System.Net; +using System.Net.Sockets; using System.Text; using System.Threading.Tasks; using System.Timers; @@ -40,6 +42,20 @@ namespace Tango.PPC.Technician.ViewModels set { _temperature = value; RaisePropertyChangedAuto(); } } + private TimeSpan _upTime; + public TimeSpan UpTime + { + get { return _upTime; } + set { _upTime = value; RaisePropertyChangedAuto(); } + } + + private String _ipAddress; + public String IPAddress + { + get { return _ipAddress; } + set { _ipAddress = value; RaisePropertyChangedAuto(); } + } + public RelayCommand ResetDeviceCommand { get; set; } public RelayCommand RestartCommand { get; set; } @@ -132,6 +148,12 @@ namespace Tango.PPC.Technician.ViewModels _statsTimer.Start(); } + public override void OnApplicationReady() + { + base.OnApplicationReady(); + IPAddress = GetIpv4Address(); + } + private void _statsTimer_Elapsed(object sender, ElapsedEventArgs e) { if (IsVisible) @@ -139,6 +161,7 @@ namespace Tango.PPC.Technician.ViewModels CPU = GetAppCPU(); RAM = GetAppRam(); //Temperature = GetTemperature(); + UpTime = DateTime.Now - ApplicationManager.StartUpDate; } } @@ -201,5 +224,25 @@ namespace Tango.PPC.Technician.ViewModels return 0; } } + + public String GetIpv4Address() + { + try + { + var host = Dns.GetHostEntry(Dns.GetHostName()); + foreach (var ip in host.AddressList) + { + if (ip.AddressFamily == AddressFamily.InterNetwork) + { + return ip.ToString(); + } + } + return "N/A"; + } + catch (Exception ex) + { + return "N/A"; + } + } } } diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/SystemView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/SystemView.xaml index f6e6370c1..f2bfcdf7d 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/SystemView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/SystemView.xaml @@ -49,19 +49,34 @@ - - - - - - - Restart Device - Shutdown Device - Factory Reset - Exit To Shell - + + + + + UP TIME: + + + + + IP ADDRESS: + + + + + + + + + + + Restart Device + Shutdown Device + Factory Reset + Exit To Shell + + diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Application/IPPCApplicationManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Application/IPPCApplicationManager.cs index 5f58be48b..7c67ac1a3 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Application/IPPCApplicationManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Application/IPPCApplicationManager.cs @@ -95,6 +95,11 @@ namespace Tango.PPC.Common.Application /// String BuildDate { get; } + /// + /// Gets the application startup date. + /// + DateTime StartUpDate { get; } + /// /// Gets or sets a value indicating whether the screen is currently locked. /// diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs index 6a9e42ce5..c7351aa4a 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs @@ -120,6 +120,11 @@ namespace Tango.PPC.UI.PPCApplication } } + /// + /// Gets the application startup date. + /// + public DateTime StartUpDate { get; private set; } + private bool _isScreenLocked; /// /// Gets or sets a value indicating whether the screen is currently locked. @@ -171,6 +176,8 @@ namespace Tango.PPC.UI.PPCApplication bool initialized = false; bool isAfterSetup = false; + StartUpDate = DateTime.Now; + await Task.Factory.StartNew(() => { try diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs index db8540db7..a572fe23e 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs @@ -8,4 +8,4 @@ using System.Windows; // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Tango PPC Application")] -[assembly: AssemblyVersion("1.0.47.0")] +[assembly: AssemblyVersion("1.0.48.0")] diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml index 5accd8ff3..0ee8058c0 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml @@ -63,7 +63,18 @@ - + + + + + diff --git a/Software/Visual_Studio/Tango.BL/Entities/Rml.cs b/Software/Visual_Studio/Tango.BL/Entities/Rml.cs index 63c0a9dbe..b9224a6d6 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/Rml.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/Rml.cs @@ -5,6 +5,8 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Media; +using Tango.BL.Builders; +using Tango.BL.Serialization; namespace Tango.BL.Entities { @@ -57,5 +59,48 @@ namespace Tango.BL.Entities { return ProcessParametersTablesGroups.FirstOrDefault(x => x.Active); } + + public Task ToRmlFile(ObservablesContext context) + { + return Task.Factory.StartNew(() => + { + var rml = new RmlBuilder(context).Set(Guid).WithActiveParametersGroup().WithCCT().WithLiquidFactors().Build(); + + String result = rml.ToJson(new EntitySerializationStrategy() + .Include(() => rml.Cct) + .Include(() => rml.LiquidTypesRmls) + .Include(() => rml.ProcessParametersTablesGroups) + .Include(typeof(ProcessParametersTablesGroup).GetProperty(nameof(ProcessParametersTablesGroup.ProcessParametersTables))), + EntitySerializationFlags.IgnoreCollections | EntitySerializationFlags.IgnoreReferenceTypes | EntitySerializationFlags.Indented); + + return result; + }); + } + + public static Task FromRmlFile(ObservablesContext context, String json) + { + return Task.Factory.StartNew(() => + { + Rml rml = Rml.FromJson(json,new EntitySerializationStrategy(),EntitySerializationFlags.Indented); + + if (context.Rmls.Any(x => x.Guid == rml.Guid || x.Name == rml.Name)) + { + throw new InvalidOperationException($"Thread {rml.Name} already exist."); + } + + if (rml.Cct != null) + { + if (context.Ccts.Any(x => x.Guid == rml.Cct.Guid)) + { + rml.Cct = null; + } + } + + rml.LastUpdated = DateTime.UtcNow; + rml.Code = context.Rmls.Max(x => x.Code) + 1; + + return rml; + }); + } } } diff --git a/Software/Visual_Studio/Tango.Transport/TransporterBase.cs b/Software/Visual_Studio/Tango.Transport/TransporterBase.cs index 443f5f7cb..2824ed26a 100644 --- a/Software/Visual_Studio/Tango.Transport/TransporterBase.cs +++ b/Software/Visual_Studio/Tango.Transport/TransporterBase.cs @@ -1191,7 +1191,7 @@ namespace Tango.Transport } catch (Exception ex) when (ex is TimeoutException || ex is AggregateException) { - if (State != TransportComponentState.Connected || aborted || Adapter.State == TransportComponentState.Failed) return; + if (State != TransportComponentState.Connected || aborted || (Adapter.State == TransportComponentState.Failed && FailsWithAdapter)) return; if (UseKeepAlive) { -- cgit v1.3.1 From 45d005de26630b6c39867ba3a03f252628f4b090 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Mon, 7 Oct 2019 15:33:06 +0300 Subject: Machine Studio v4.0.29 PPC 1.0.48 --- .../Machine Studio Installer.aip | 100 +++++++++++++++++++-- .../Properties/AssemblyInfo.cs | 2 +- 2 files changed, 94 insertions(+), 8 deletions(-) (limited to 'Software/Visual_Studio') diff --git a/Software/Visual_Studio/Advanced Installer Projects/Machine Studio Installer.aip b/Software/Visual_Studio/Advanced Installer Projects/Machine Studio Installer.aip index 0ada18302..a1d7a5e2b 100644 --- a/Software/Visual_Studio/Advanced Installer Projects/Machine Studio Installer.aip +++ b/Software/Visual_Studio/Advanced Installer Projects/Machine Studio Installer.aip @@ -15,10 +15,10 @@ - + - + @@ -73,9 +73,17 @@ + + + + + + + + @@ -105,6 +113,7 @@ + @@ -119,7 +128,9 @@ + + @@ -128,6 +139,7 @@ + @@ -135,8 +147,11 @@ + + + @@ -148,13 +163,18 @@ + + + + + @@ -181,6 +201,7 @@ + @@ -197,15 +218,23 @@ + + + + + + + + @@ -213,19 +242,25 @@ + + + + + + @@ -288,12 +323,16 @@ + + + + @@ -331,14 +370,14 @@ - + - + @@ -375,9 +414,18 @@ + + + + + + + + + @@ -404,11 +452,13 @@ + + @@ -426,7 +476,9 @@ + + @@ -435,6 +487,7 @@ + @@ -443,8 +496,11 @@ + + + @@ -456,13 +512,18 @@ + + + + + @@ -490,6 +551,7 @@ + @@ -506,15 +568,23 @@ + + + + + + + + @@ -522,19 +592,25 @@ + + + + + + @@ -554,7 +630,7 @@ - + @@ -690,6 +766,8 @@ + + @@ -697,6 +775,12 @@ + + + + + + @@ -738,6 +822,9 @@ + + + @@ -756,7 +843,7 @@ - + @@ -832,7 +919,6 @@ - diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs index 1fb4da669..91792e0f3 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs @@ -4,5 +4,5 @@ using System.Runtime.InteropServices; [assembly: System.Windows.ThemeInfo(System.Windows.ResourceDictionaryLocation.None, System.Windows.ResourceDictionaryLocation.SourceAssembly)] [assembly: AssemblyTitle("Tango - Machine Studio")] -[assembly: AssemblyVersion("4.0.28.0")] +[assembly: AssemblyVersion("4.0.29.0")] [assembly: ComVisible(false)] \ No newline at end of file -- cgit v1.3.1 From 583d3716e37a9be80c8bb248215f343ed4fcd2d1 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Mon, 7 Oct 2019 15:51:21 +0300 Subject: Redundant. --- .../Models/HardwareCollection.cs | 19 +++++++++++ .../Models/HardwareParameter.cs | 39 +++++++++++++++------- .../Models/IHasDifference.cs | 3 ++ 3 files changed, 49 insertions(+), 12 deletions(-) (limited to 'Software/Visual_Studio') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Models/HardwareCollection.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Models/HardwareCollection.cs index 7c774e65f..79c7fc946 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Models/HardwareCollection.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Models/HardwareCollection.cs @@ -7,11 +7,26 @@ using Tango.Core; namespace Tango.MachineStudio.MachineDesigner.Models { + /// + /// Represents a hardware version collection. + /// + /// + /// public class HardwareCollection : ExtendedObject, IHasDifference { + /// + /// Gets or sets the name of the collection. + /// public String CollectionName { get; set; } + /// + /// Gets or sets the components. + /// public SynchronizedObservableCollection Components { get; set; } + + /// + /// Gets a value indicating whether this instance has differences. + /// public bool HasDifferences { get @@ -19,6 +34,10 @@ namespace Tango.MachineStudio.MachineDesigner.Models return Components.Any(item => item.HasDifferences); } } + + /// + /// Initializes a new instance of the class. + /// public HardwareCollection() { Components = new SynchronizedObservableCollection(); diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Models/HardwareParameter.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Models/HardwareParameter.cs index 9e30874e9..5bddfb02e 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Models/HardwareParameter.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Models/HardwareParameter.cs @@ -12,20 +12,19 @@ namespace Tango.MachineStudio.MachineDesigner.Models /// The HardwareParameter class. /// Contains default/editable/actual value and data type of each hardware parameter reflected in . /// - /// - /// This class provides data state changes. - /// public class HardwareParameter : ExtendedObject, IHasDifference { - #region properties + #region Properties + public HardwareComponent Component { get; set; } public String PropertyName { get; set; } + + private Object _defaultValue; /// /// The default value contains data from database /// - private Object _defaultValue; public Object DefaultValue { get { return _defaultValue; } @@ -34,6 +33,7 @@ namespace Tango.MachineStudio.MachineDesigner.Models _defaultValue = value; } } + /// /// The type of hardware parameter is used for display correct ui element. /// Can be boolean, int32, or Double @@ -43,10 +43,11 @@ namespace Tango.MachineStudio.MachineDesigner.Models get { return DefaultValue.GetType(); } } + + private Object _actualValue = null; /// - /// The value contains modified data, saved in database or immediately after editing in this session + /// The value contains modified data, saved in database or immediately after editing in this session. /// - private Object _actualValue = null; public Object ActualValue { get { return _actualValue; } @@ -59,11 +60,12 @@ namespace Tango.MachineStudio.MachineDesigner.Models } } + + private Object _editableValue = null; /// - /// The editable value contains value displayed in edit box in UI. + /// The editable value contains value displayed in edit box in UI. /// Initialization the value occurs by clicking in UI and the value will be equal actual value if it exists or default value. /// - private Object _editableValue = null; public Object EditableValue { get { return _editableValue; } @@ -91,6 +93,7 @@ namespace Tango.MachineStudio.MachineDesigner.Models } } } + /// /// Used in UI to display modified value /// @@ -101,6 +104,7 @@ namespace Tango.MachineStudio.MachineDesigner.Models return (ActualValue != null); } } + /// /// Used to display warning explanation icon in case actual value equals default value /// @@ -111,14 +115,17 @@ namespace Tango.MachineStudio.MachineDesigner.Models return ActualValue != null && ActualValue.ToString() == DefaultValue.ToString(); } } - #endregion properties + + #endregion #region events + /// /// Occurs when start select mode. /// Used to set in all others Parameter IsSelected to false except this. /// public event EventHandler Selected; + private void OnIsSelectedChanged() { if (IsSelected) @@ -133,20 +140,28 @@ namespace Tango.MachineStudio.MachineDesigner.Models } } } + #endregion - #region constructors + + #region Constructors + public HardwareParameter() { DeleteCommand = new RelayCommand(DeleteValue); } + #endregion - #region commands + + #region Commands + public RelayCommand DeleteCommand { get; set; } + public void DeleteValue() { ActualValue = null; EditableValue = null; } + #endregion } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Models/IHasDifference.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Models/IHasDifference.cs index bd4851867..759f69ce4 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Models/IHasDifference.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Models/IHasDifference.cs @@ -8,6 +8,9 @@ namespace Tango.MachineStudio.MachineDesigner.Models { interface IHasDifference { + /// + /// Gets a value indicating whether this instance has differences. + /// bool HasDifferences { get;} } } -- cgit v1.3.1