StopWatch


Node Information
Creates a StopWatch.
General Information
• This node doesn't have other available options.
Visual
Visual

Ports
Text Type DataType Accepts IsList CustomAcception
Start IN RUN MULTIPLE FALSE FALSE
Stop IN RUN MULTIPLE FALSE FALSE
Reset IN RUN MULTIPLE FALSE FALSE
Elapsed OUT String MULTIPLE FALSE FALSE
Days OUT Double MULTIPLE FALSE FALSE
Hours OUT Double MULTIPLE FALSE FALSE
Minutes OUT Double MULTIPLE FALSE FALSE
Seconds OUT Double MULTIPLE FALSE FALSE
Milliseconds OUT Double MULTIPLE FALSE FALSE

Source
namespace Korduene.KGraph.Nodes.Objects
{
    [IsNode("StopWatch")]
    public class ObjectStopWatch : Node
    {
        Port start = new Port(PortType.IN, typeof(RUN), AcceptsLinks.MULTIPLE, "Start");
        Port stop = new Port(PortType.IN, typeof(RUN), AcceptsLinks.MULTIPLE, "Stop");
        Port reset = new Port(PortType.IN, typeof(RUN), AcceptsLinks.MULTIPLE, "Reset");
        Port elapsed = new Port(PortType.OUT, typeof(string), AcceptsLinks.MULTIPLE, "Elapsed");
        Port days = new Port(PortType.OUT, typeof(double), AcceptsLinks.MULTIPLE, "Days");
        Port hours = new Port(PortType.OUT, typeof(double), AcceptsLinks.MULTIPLE, "Hours");
        Port minutes = new Port(PortType.OUT, typeof(double), AcceptsLinks.MULTIPLE, "Minutes");
        Port seconds = new Port(PortType.OUT, typeof(double), AcceptsLinks.MULTIPLE, "Seconds");
        Port milliseconds = new Port(PortType.OUT, typeof(double), AcceptsLinks.MULTIPLE, "Milliseconds");
        Variable Var1 = new Variable("System.Diagnostics.Stopwatch", "", "new System.Diagnostics.Stopwatch()");
        public ObjectStopWatch()
        {
            this.NodeType = KGraph.NodeType.Method;
            this.Name = "StopWatch";
            AddPort(start);
            AddPort(stop);
            AddPort(reset);
            AddPort(elapsed);
            AddPort(days);
            AddPort(hours);
            AddPort(minutes);
            AddPort(seconds);
            AddPort(milliseconds);
            Var1.Name = stop.ID;
            Variables.Add(Var1);
            Information = "Creates a StopWatch.";
        }
        public override void UpdateResults()
        {
            Var1.Name = stop.ID;
            start.Instructions = Var1.Name + ".Start();";
            stop.Instructions = Var1.Name + ".Stop();";
            reset.Instructions = Var1.Name + ".Reset();";
            elapsed.Instructions = Var1.Name + ".Elapsed.ToString()";
            days.Instructions = Var1.Name + ".Elapsed.TotalDays";
            hours.Instructions = Var1.Name + ".Elapsed.TotalHours";
            minutes.Instructions = Var1.Name + ".Elapsed.TotalMinutes";
            seconds.Instructions = Var1.Name + ".Elapsed.TotalSeconds";
            milliseconds.Instructions = Var1.Name + ".Elapsed.TotalMilliseconds";
        }
    }
}