aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems')
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MotorGroupItem.cs158
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/TechItem.cs1
2 files changed, 159 insertions, 0 deletions
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
new file mode 100644
index 000000000..35aae5cd7
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MotorGroupItem.cs
@@ -0,0 +1,158 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Media;
+using System.Xml.Serialization;
+using Tango.Integration.Observables;
+using Tango.SharedUI.Components;
+using Tango.SharedUI.Helpers;
+
+namespace Tango.MachineStudio.Technician.TechItems
+{
+ public class MotorGroupItem : TechItem
+ {
+ public event EventHandler<MotorActionType> ActionExecuted;
+ public event EventHandler HomingCompleted;
+
+ private SelectedObjectCollection<TechMotor> _selectedMotors;
+ [XmlIgnore]
+ public SelectedObjectCollection<TechMotor> SelectedMotors
+ {
+ get { return _selectedMotors; }
+ set { _selectedMotors = value; RaisePropertyChangedAuto(); }
+ }
+
+ private ObservableCollection<TechMotor> _techMotors;
+ [XmlIgnore]
+ public ObservableCollection<TechMotor> TechMotors
+ {
+ get { return _techMotors; }
+ set { _techMotors = value; RaisePropertyChangedAuto(); SetSelectedMotors(); }
+ }
+
+ private void SetSelectedMotors()
+ {
+ if (TechMotors != null)
+ {
+ SelectedMotors = new SelectedObjectCollection<TechMotor>(ObservablesEntitiesAdapter.Instance.TechMotors.ToObservableCollection(), TechMotors);
+ }
+ }
+
+ public List<String> ItemsGuids { get; set; }
+
+ private String _groupName;
+
+ public String GroupName
+ {
+ get { return _groupName; }
+ set { _groupName = value; RaisePropertyChangedAuto(); TechName = value; }
+ }
+
+
+ private bool _isHoming;
+ [XmlIgnore]
+ public bool IsHoming
+ {
+ get { return _isHoming; }
+ set
+ {
+ _isHoming = value;
+ RaisePropertyChangedAuto();
+ }
+ }
+
+ private bool _isHomingCompleted;
+
+ public bool IsHomingCompleted
+ {
+ get { return _isHomingCompleted; }
+ set
+ {
+ _isHomingCompleted = value;
+ RaisePropertyChangedAuto();
+
+ if (value)
+ {
+ HomingCompleted?.Invoke(this, new EventArgs());
+ }
+ }
+ }
+
+ private double _homingProgress;
+ [XmlIgnore]
+ public double HomingProgress
+ {
+ get { return _homingProgress; }
+ set
+ {
+ _homingProgress = value;
+ RaisePropertyChangedAuto();
+ }
+ }
+
+ private double _homingMaximumProgress;
+ [XmlIgnore]
+ public double HomingMaximumProgress
+ {
+ get { return _homingMaximumProgress; }
+ set { _homingMaximumProgress = value; RaisePropertyChangedAuto(); }
+ }
+
+ private bool _isForwardPressed;
+ [XmlIgnore]
+ public bool IsForwardPressed
+ {
+ get { return _isForwardPressed; }
+ set { _isForwardPressed = value; RaisePropertyChangedAuto(); }
+ }
+
+ private bool _isBackwardPressed;
+ [XmlIgnore]
+ public bool IsBackwardPressed
+ {
+ get { return _isBackwardPressed; }
+ set { _isBackwardPressed = value; RaisePropertyChangedAuto(); }
+ }
+
+ private double _speed;
+ public double Speed
+ {
+ get { return _speed; }
+ set { _speed = value; RaisePropertyChangedAuto(); }
+ }
+
+ public MotorGroupItem() : base()
+ {
+ ItemsGuids = new List<string>();
+ TechMotors = new ObservableCollection<TechMotor>();
+ Name = "Motor Group";
+ Description = "Motor Group Controller";
+ Image = ResourceHelper.GetImageFromResources("Images/motor-group.png");
+ Color = Colors.White;
+ GroupName = "Motor Group";
+ }
+
+ public MotorGroupItem(object dummyConstructor) : this()
+ {
+
+ }
+
+ public override TechItem Clone()
+ {
+ MotorGroupItem cloned = base.Clone() as MotorGroupItem;
+ cloned.TechMotors = new ObservableCollection<TechMotor>(TechMotors);
+ cloned.Speed = Speed;
+ cloned.ItemsGuids = ItemsGuids;
+ cloned.TechMotors = cloned.TechMotors.ToObservableCollection();
+ return cloned;
+ }
+
+ public void RaiseAction(MotorActionType action)
+ {
+ ActionExecuted?.Invoke(this, action);
+ }
+ }
+}
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 8361b6ef7..a7b5ae5b9 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
@@ -21,6 +21,7 @@ namespace Tango.MachineStudio.Technician.TechItems
[XmlInclude(typeof(MultiGraphItem))]
[XmlInclude(typeof(SingleGraphItem))]
[XmlInclude(typeof(ThreadMotionItem))]
+ [XmlInclude(typeof(MotorGroupItem))]
public abstract class TechItem : ExtendedObject
{
public TechItem()