diff options
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Models/HardwareParameter.cs')
| -rw-r--r-- | Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Models/HardwareParameter.cs | 90 |
1 files changed, 60 insertions, 30 deletions
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 + /// <summary> + /// The HardwareParameter class. + /// Contains default/editable/actual value and data type of each hardware parameter reflected in . + /// </summary> + /// <remarks> + /// This class provides data state changes. + /// </remarks> + 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; } + /// <summary> + /// The default value contains data from database + /// </summary> private Object _defaultValue; public Object DefaultValue { @@ -27,12 +34,18 @@ namespace Tango.MachineStudio.MachineDesigner.Models _defaultValue = value; } } - + /// <summary> + /// The type of hardware parameter is used for display correct ui element. + /// Can be boolean, int32, or Double + /// </summary> public Type Type { get { return DefaultValue.GetType(); } } - // updated after editing + + /// <summary> + /// The value contains modified data, saved in database or immediately after editing in this session + /// </summary> 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 + /// <summary> + /// 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. + /// </summary> private Object _editableValue = null; public Object EditableValue { @@ -75,8 +91,34 @@ namespace Tango.MachineStudio.MachineDesigner.Models } } } + /// <summary> + /// Used in UI to display modified value + /// </summary> + public bool HasDifferences + { + get + { + return (ActualValue != null); + } + } + /// <summary> + /// Used to display warning explanation icon in case actual value equals default value + /// </summary> + public bool IsValuesMatched + { + get + { + return ActualValue != null && ActualValue.ToString() == DefaultValue.ToString(); + } + } + #endregion properties - + #region events + /// <summary> + /// Occurs when start select mode. + /// Used to set in all others Parameter IsSelected to false except this. + /// </summary> + 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 } } |
