aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Models
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Models')
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Models/HardwareCollection.cs21
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Models/HardwareComponent.cs6
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Models/HardwareParameter.cs91
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Models/IHasDifference.cs16
4 files changed, 108 insertions, 26 deletions
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..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
{
- public class HardwareCollection : ExtendedObject
+ /// <summary>
+ /// Represents a hardware version collection.
+ /// </summary>
+ /// <seealso cref="Tango.Core.ExtendedObject" />
+ /// <seealso cref="Tango.MachineStudio.MachineDesigner.Models.IHasDifference" />
+ public class HardwareCollection : ExtendedObject, IHasDifference
{
+ /// <summary>
+ /// Gets or sets the name of the collection.
+ /// </summary>
public String CollectionName { get; set; }
+ /// <summary>
+ /// Gets or sets the components.
+ /// </summary>
public SynchronizedObservableCollection<HardwareComponent> Components { get; set; }
+
+ /// <summary>
+ /// Gets a value indicating whether this instance has differences.
+ /// </summary>
public bool HasDifferences
{
get
@@ -19,6 +34,10 @@ namespace Tango.MachineStudio.MachineDesigner.Models
return Components.Any(item => item.HasDifferences);
}
}
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="HardwareCollection"/> class.
+ /// </summary>
public HardwareCollection()
{
Components = new SynchronizedObservableCollection<HardwareComponent>();
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<HardwareParameter>();
}
+
}
}
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..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
@@ -8,17 +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>
+ 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; }
+
private Object _defaultValue;
+ /// <summary>
+ /// The default value contains data from database
+ /// </summary>
public Object DefaultValue
{
get { return _defaultValue; }
@@ -28,12 +34,20 @@ namespace Tango.MachineStudio.MachineDesigner.Models
}
}
+ /// <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
+
+
private Object _actualValue = null;
+ /// <summary>
+ /// The value contains modified data, saved in database or immediately after editing in this session.
+ /// </summary>
public Object ActualValue
{
get { return _actualValue; }
@@ -41,13 +55,17 @@ namespace Tango.MachineStudio.MachineDesigner.Models
{
_actualValue = value;
RaisePropertyChangedAuto();
- RaisePropertyChanged(nameof(IsDifferent));
+ RaisePropertyChanged(nameof(HasDifferences));
RaisePropertyChanged(nameof(IsValuesMatched));
}
}
- // displayed during editing
+
private Object _editableValue = null;
+ /// <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>
public Object EditableValue
{
get { return _editableValue; }
@@ -76,6 +94,37 @@ 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
+
+ #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()
{
@@ -92,31 +141,27 @@ namespace Tango.MachineStudio.MachineDesigner.Models
}
}
- public bool IsDifferent
- {
- get
- {
- return (ActualValue != null);
- }
- }
+ #endregion
- public bool IsValuesMatched
+ #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..759f69ce4
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Models/IHasDifference.cs
@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.MachineStudio.MachineDesigner.Models
+{
+ interface IHasDifference
+ {
+ /// <summary>
+ /// Gets a value indicating whether this instance has differences.
+ /// </summary>
+ bool HasDifferences { get;}
+ }
+}