Animatroller.Simulator.SimulatorForm.AddMotor C# (CSharp) Method

AddMotor() public method

public AddMotor ( MotorWithFeedback logicalDevice ) : Animatroller.Framework.PhysicalDevice.MotorWithFeedback
logicalDevice MotorWithFeedback
return Animatroller.Framework.PhysicalDevice.MotorWithFeedback
        public Animatroller.Framework.PhysicalDevice.MotorWithFeedback AddMotor(MotorWithFeedback logicalDevice)
        {
            var moduleControl = new Control.ModuleControl();
            moduleControl.Text = logicalDevice.Name;
            moduleControl.Size = new System.Drawing.Size(160, 80);

            var control = new Control.Motor();
            moduleControl.ChildControl = control;

            flowLayoutPanelLights.Controls.Add(moduleControl);

            var device = new Animatroller.Framework.PhysicalDevice.MotorWithFeedback((target, speed, timeout) =>
            {
                control.Target = target;
                control.Speed = speed;
                control.Timeout = timeout;
            });

            control.Trigger = device.Trigger;

            device.Connect(logicalDevice);

            return device;
        }