aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/ThreadMotionItem.cs
blob: a5789377f66bb3350c7302cf28d1a81f94377bfa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Media;
using System.Xml.Serialization;
using Tango.SharedUI.Helpers;

namespace Tango.MachineStudio.Technician.TechItems
{
    /// <summary>
    /// Represents a thread motion controller item.
    /// </summary>
    /// <seealso cref="Tango.MachineStudio.Technician.TechItems.TechItem" />
    [TechItem(9)]
    public class ThreadMotionItem : TechItem
    {
        /// <summary>
        /// Occurs when the user has pressed/released on of the item actions.
        /// </summary>
        public event EventHandler<MotorActionType> ActionExecuted;

        private double _speed;
        /// <summary>
        /// Gets or sets the motor speed.
        /// </summary>
        public double Speed
        {
            get { return _speed; }
            set { _speed = value; RaisePropertyChangedAuto(); }
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="ThreadMotionItem"/> class.
        /// </summary>
        public ThreadMotionItem() : base()
        {
            Name = "Thread Motion";
            Description = "Thread Motion Controller";
            Image = ResourceHelper.GetImageFromResources("Images/thread.png");
            TechName = Name;
            Color = Colors.White;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="ThreadMotionItem"/> class.
        /// </summary>
        /// <param name="dummyConstructor">Does not matter.</param>
        public ThreadMotionItem(object dummyConstructor) : this()
        {

        }

        /// <summary>
        /// Clones this instance.
        /// </summary>
        /// <returns></returns>
        public override TechItem Clone()
        {
            ThreadMotionItem cloned = base.Clone() as ThreadMotionItem;
            cloned.Speed = Speed;
            return cloned;
        }

        /// <summary>
        /// Raises the <see cref="ActionExecuted"/> event with the specified action.
        /// </summary>
        /// <param name="action">The action.</param>
        public void RaiseAction(MotorActionType action)
        {
            ActionExecuted?.Invoke(this, action);
        }
    }
}
pan> Descriptor { get { return descriptor; } } private static pbr::FileDescriptor descriptor; static DispenserRunningDataReflection() { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( "ChpEaXNwZW5zZXJSdW5uaW5nRGF0YS5wcm90bxIcVGFuZ28uUE1SLkVtYmVk", "ZGVkUGFyYW1ldGVycyKzAQoURGlzcGVuc2VyUnVubmluZ0RhdGESFwoPTnVt", "YmVyT2ZSZWZpbGxzGAEgASgNEiEKGVRvdGFsQ29uc3VtZWRJbk5hbm9MaXR0", "ZXIYAiABKAESHAoUQ29uc3VtZWRJbk5hbm9MaXR0ZXIYAyABKAESGgoSTmFu", "b0xpdHRlclBlclB1bHNlGAQgASgBEhIKCk1pY3JvU3RlcHMYBSABKA0SEQoJ", "RGlyZWN0aW9uGAYgASgIQigKJmNvbS50d2luZS50YW5nby5wbXIuZW1iZWRk", "ZWRwYXJhbWV0ZXJzYgZwcm90bzM=")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.EmbeddedParameters.DispenserRunningData), global::Tango.PMR.EmbeddedParameters.DispenserRunningData.Parser, new[]{ "NumberOfRefills", "TotalConsumedInNanoLitter", "ConsumedInNanoLitter", "NanoLitterPerPulse", "MicroSteps", "Direction" }, null, null, null) })); } #endregion } #region Messages public sealed partial class DispenserRunningData : pb::IMessage<DispenserRunningData> { private static readonly pb::MessageParser<DispenserRunningData> _parser = new pb::MessageParser<DispenserRunningData>(() => new DispenserRunningData()); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser<DispenserRunningData> Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Tango.PMR.EmbeddedParameters.DispenserRunningDataReflection.Descriptor.MessageTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public DispenserRunningData() { OnConstruction(); } partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public DispenserRunningData(DispenserRunningData other) : this() { numberOfRefills_ = other.numberOfRefills_; totalConsumedInNanoLitter_ = other.totalConsumedInNanoLitter_; consumedInNanoLitter_ = other.consumedInNanoLitter_; nanoLitterPerPulse_ = other.nanoLitterPerPulse_; microSteps_ = other.microSteps_; direction_ = other.direction_; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public DispenserRunningData Clone() { return new DispenserRunningData(this); } /// <summary>Field number for the "NumberOfRefills" field.</summary> public const int NumberOfRefillsFieldNumber = 1; private uint numberOfRefills_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public uint NumberOfRefills { get { return numberOfRefills_; } set { numberOfRefills_ = value; } } /// <summary>Field number for the "TotalConsumedInNanoLitter" field.</summary> public const int TotalConsumedInNanoLitterFieldNumber = 2; private double totalConsumedInNanoLitter_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public double TotalConsumedInNanoLitter { get { return totalConsumedInNanoLitter_; } set { totalConsumedInNanoLitter_ = value; } } /// <summary>Field number for the "ConsumedInNanoLitter" field.</summary> public const int ConsumedInNanoLitterFieldNumber = 3; private double consumedInNanoLitter_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public double ConsumedInNanoLitter { get { return consumedInNanoLitter_; } set { consumedInNanoLitter_ = value; } } /// <summary>Field number for the "NanoLitterPerPulse" field.</summary> public const int NanoLitterPerPulseFieldNumber = 4; private double nanoLitterPerPulse_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public double NanoLitterPerPulse { get { return nanoLitterPerPulse_; } set { nanoLitterPerPulse_ = value; } } /// <summary>Field number for the "MicroSteps" field.</summary> public const int MicroStepsFieldNumber = 5; private uint microSteps_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public uint MicroSteps { get { return microSteps_; } set { microSteps_ = value; } } /// <summary>Field number for the "Direction" field.</summary> public const int DirectionFieldNumber = 6; private bool direction_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Direction { get { return direction_; } set { direction_ = value; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as DispenserRunningData); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(DispenserRunningData other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } if (NumberOfRefills != other.NumberOfRefills) return false; if (TotalConsumedInNanoLitter != other.TotalConsumedInNanoLitter) return false; if (ConsumedInNanoLitter != other.ConsumedInNanoLitter) return false; if (NanoLitterPerPulse != other.NanoLitterPerPulse) return false; if (MicroSteps != other.MicroSteps) return false; if (Direction != other.Direction) return false; return true; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (NumberOfRefills != 0) hash ^= NumberOfRefills.GetHashCode(); if (TotalConsumedInNanoLitter != 0D) hash ^= TotalConsumedInNanoLitter.GetHashCode(); if (ConsumedInNanoLitter != 0D) hash ^= ConsumedInNanoLitter.GetHashCode(); if (NanoLitterPerPulse != 0D) hash ^= NanoLitterPerPulse.GetHashCode(); if (MicroSteps != 0) hash ^= MicroSteps.GetHashCode(); if (Direction != false) hash ^= Direction.GetHashCode(); return hash; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { if (NumberOfRefills != 0) { output.WriteRawTag(8); output.WriteUInt32(NumberOfRefills); } if (TotalConsumedInNanoLitter != 0D) { output.WriteRawTag(17); output.WriteDouble(TotalConsumedInNanoLitter); } if (ConsumedInNanoLitter != 0D) { output.WriteRawTag(25); output.WriteDouble(ConsumedInNanoLitter); } if (NanoLitterPerPulse != 0D) { output.WriteRawTag(33); output.WriteDouble(NanoLitterPerPulse); } if (MicroSteps != 0) { output.WriteRawTag(40); output.WriteUInt32(MicroSteps); } if (Direction != false) { output.WriteRawTag(48); output.WriteBool(Direction); } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (NumberOfRefills != 0) { size += 1 + pb::CodedOutputStream.ComputeUInt32Size(NumberOfRefills); } if (TotalConsumedInNanoLitter != 0D) { size += 1 + 8; } if (ConsumedInNanoLitter != 0D) { size += 1 + 8; } if (NanoLitterPerPulse != 0D) { size += 1 + 8; } if (MicroSteps != 0) { size += 1 + pb::CodedOutputStream.ComputeUInt32Size(MicroSteps); } if (Direction != false) { size += 1 + 1; } return size; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(DispenserRunningData other) { if (other == null) { return; } if (other.NumberOfRefills != 0) { NumberOfRefills = other.NumberOfRefills; } if (other.TotalConsumedInNanoLitter != 0D) { TotalConsumedInNanoLitter = other.TotalConsumedInNanoLitter; } if (other.ConsumedInNanoLitter != 0D) { ConsumedInNanoLitter = other.ConsumedInNanoLitter; } if (other.NanoLitterPerPulse != 0D) { NanoLitterPerPulse = other.NanoLitterPerPulse; } if (other.MicroSteps != 0) { MicroSteps = other.MicroSteps; } if (other.Direction != false) { Direction = other.Direction; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { default: input.SkipLastField(); break; case 8: { NumberOfRefills = input.ReadUInt32(); break; } case 17: { TotalConsumedInNanoLitter = input.ReadDouble(); break; } case 25: { ConsumedInNanoLitter = input.ReadDouble(); break; } case 33: { NanoLitterPerPulse = input.ReadDouble(); break; } case 40: { MicroSteps = input.ReadUInt32(); break; } case 48: { Direction = input.ReadBool(); break; } } } } } #endregion } #endregion Designer generated code