예제 #1
0
        protected override void SaveSettings()
        {
            Variable frequencyVariable = null;
            decimal  frequencyValue    = 244.14M;

            if (this.cbFrequency.SelectedIndex != 0)
            {
                frequencyVariable = GraphManager.GetVariable(this.cbFrequency.SelectedItem.ToString());
            }
            else
            {
                frequencyValue = this.nudFrequency.Value;
            }

            FlowchartControl flowchartControl = FlowchartControl.Continuously;
            Variable         timeVariable     = null;
            Decimal          timeValue        = 0.1M;
            bool             waitFinish       = false;

            if (this.rbTime.Checked)
            {
                flowchartControl = FlowchartControl.FinishTime;
                if (this.cbTime.SelectedIndex != 0)
                {
                    timeVariable = GraphManager.GetVariable(this.cbTime.SelectedItem.ToString());
                }
                else
                {
                    timeValue = this.nudTime.Value;
                }
            }
            waitFinish = this.cbFinishCommands.Checked;

            this.action.UpdateSettings(frequencyVariable, frequencyValue, flowchartControl, timeVariable, timeValue, waitFinish);
        }
 public void UpdateSettings(Variable frequencyVariable, decimal frecuencyValue, FlowchartControl flowchartControl, Variable timeVariable, decimal timeValue, bool waitFinish)
 {
     this.frequencyVariable = frequencyVariable;
     this.frecuencyValue    = frecuencyValue;
     this.flowchartControl  = flowchartControl;
     this.timeVariable      = timeVariable;
     this.timeValue         = timeValue;
     this.waitFinish        = waitFinish;
 }
 public PlaySoundAction(string key, Variable frequencyVariable, decimal frecuencyValue, FlowchartControl flowchartControl, Variable timeVariable, decimal timeValue, bool waitFinish)
 {
     this.key = key;
     this.frequencyVariable = frequencyVariable;
     this.frecuencyValue    = frecuencyValue;
     this.flowchartControl  = flowchartControl;
     this.timeVariable      = timeVariable;
     this.timeValue         = timeValue;
     this.waitFinish        = waitFinish;
 }
예제 #4
0
        protected override void SaveSettings()
        {
            Variable  speedVariable = null;
            int       speedValue    = 50;
            Direction direction     = Direction.Forward;

            if (this.cbSpeed.SelectedIndex != 0)
            {
                speedVariable = GraphManager.GetVariable(this.cbSpeed.SelectedItem.ToString());
            }
            else
            {
                speedValue = (int)this.nudSpeed.Value;
            }
            if (this.rbBackward.Checked)
            {
                direction = Direction.Backward;
            }

            FlowchartControl flowchartControl = FlowchartControl.Continuously;
            Variable         timeVariable     = null;
            Decimal          timeValue        = 0.1M;
            Variable         distanceVariable = null;
            Decimal          distanceValue    = 0.17M;

            if (this.rbTime.Checked)
            {
                flowchartControl = FlowchartControl.FinishTime;
                if (this.cbTime.SelectedIndex != 0)
                {
                    timeVariable = GraphManager.GetVariable(this.cbTime.SelectedItem.ToString());
                }
                else
                {
                    timeValue = this.nudTime.Value;
                }
            }
            else if (this.rbDistance.Checked)
            {
                flowchartControl = FlowchartControl.FinishDistance;
                if (this.cbDistance.SelectedIndex != 0)
                {
                    distanceVariable = GraphManager.GetVariable(this.cbDistance.SelectedItem.ToString());
                }
                else
                {
                    distanceValue = this.nudDistance.Value;
                }
            }
            bool waitFinish = this.cbFinishCommands.Checked;

            this.action.UpdateSettings(speedVariable, speedValue, direction, flowchartControl, timeVariable, timeValue, distanceVariable, distanceValue, waitFinish);
        }
예제 #5
0
 public void UpdateSettings(Variable speedVariable, int speedValue, Direction direction, FlowchartControl flowchartControl, Variable timeVariable, decimal timeValue, Variable distanceVariable, decimal distanceValue, bool waitFinish)
 {
     this.speedVariable    = speedVariable;
     this.speedValue       = speedValue;
     this.direction        = direction;
     this.flowchartControl = flowchartControl;
     this.timeVariable     = timeVariable;
     this.timeValue        = timeValue;
     this.distanceVariable = distanceVariable;
     this.distanceValue    = distanceValue;
     this.waitFinish       = waitFinish;
 }
예제 #6
0
 public StraightAction(string key, Variable speedVariable, int speedValue, Direction direction, FlowchartControl flowchartControl, Variable timeVariable, decimal timeValue, Variable distanceVariable, decimal distanceValue, bool waitFinish)
 {
     this.key              = key;
     this.speedVariable    = speedVariable;
     this.speedValue       = speedValue;
     this.direction        = direction;
     this.flowchartControl = flowchartControl;
     this.timeVariable     = timeVariable;
     this.timeValue        = timeValue;
     this.distanceVariable = distanceVariable;
     this.distanceValue    = distanceValue;
     this.waitFinish       = waitFinish;
 }
        public PlaySoundAction(string key, XmlElement properties, System.Collections.Generic.SortedList <string, Variable> variables)
        {
            this.key = key;
            if (properties.Name != "properties")
            {
                throw new ActionException("Can't create the action");
            }
            foreach (XmlElement property in properties.ChildNodes)
            {
                switch (property.Name)
                {
                case "version":
                    break;

                case "frequencyVariable":
                    if (property.InnerText != "none")
                    {
                        this.frequencyVariable = variables[property.InnerText];
                    }
                    break;

                case "frecuencyValue":
                    this.frecuencyValue = System.Convert.ToDecimal(property.InnerText.Replace(',', '.'), new System.Globalization.CultureInfo("en-GB"));
                    break;

                case "flowchartControl":
                    this.flowchartControl = (FlowchartControl)Enum.Parse(typeof(FlowchartControl), property.InnerText);
                    break;

                case "timeVariable":
                    if (property.InnerText != "none")
                    {
                        this.timeVariable = variables[property.InnerText];
                    }
                    break;

                case "timeValue":
                    this.timeValue = System.Convert.ToDecimal(property.InnerText.Replace(',', '.'), new System.Globalization.CultureInfo("en-GB"));
                    break;

                case "waitFinish":
                    this.waitFinish = System.Convert.ToBoolean(property.InnerText);
                    break;

                default:
                    throw new ProjectException("Error el crear la acción");
                }
            }
        }
예제 #8
0
 public void UpdateProperties(Variable rotateVariable, int rotateValue, RotateMode rotateMode, Side rotateSide, Side rotateWheel, Direction rotateDirection, FlowchartControl flowchartControl, Variable timeVariable, decimal timeValue, Variable angleVariable, decimal angleValue, bool waitFinish)
 {
     this.rotateVariable   = rotateVariable;
     this.rotateValue      = rotateValue;
     this.rotateMode       = rotateMode;
     this.rotateWheel      = rotateWheel;
     this.rotateSide       = rotateSide;
     this.rotateDirection  = rotateDirection;
     this.flowchartControl = flowchartControl;
     this.timeVariable     = timeVariable;
     this.timeValue        = timeValue;
     this.angleVariable    = angleVariable;
     this.angleValue       = angleValue;
     this.waitFinish       = waitFinish;
 }
예제 #9
0
 public void UpdateProperties(Variable leftSpeedVariable, int leftSpeedValue, Direction leftDirection, Variable rightSpeedVariable, int rightSpeedValue, Direction rightDirection, FlowchartControl flowchartControl, Variable timeVariable, decimal timeValue, Variable distanceVariable, decimal distanceValue, bool waitFinish)
 {
     this.leftVariable     = leftSpeedVariable;
     this.leftSpeedValue   = leftSpeedValue;
     this.leftDirection    = leftDirection;
     this.rightVariable    = rightSpeedVariable;
     this.rightSpeedValue  = rightSpeedValue;
     this.rightDirection   = rightDirection;
     this.flowchartControl = flowchartControl;
     this.timeVariable     = timeVariable;
     this.timeValue        = timeValue;
     this.distanceVariable = distanceVariable;
     this.distanceValue    = distanceValue;
     this.waitFinish       = waitFinish;
 }
예제 #10
0
 public TurnAction(string key, Variable speedVariable, int speedValue, Direction direction, Variable radiusVariable, decimal radiusValue, Side turnSide, FlowchartControl flowchartControl, Variable timeVariable, decimal timeValue, Variable distanceVariable, decimal distanceValue, bool waitFinish)
 {
     this.key              = key;
     this.speedVariable    = speedVariable;
     this.speedValue       = speedValue;
     this.direction        = direction;
     this.radiusVariable   = radiusVariable;
     this.radiusValue      = radiusValue;
     this.turnSide         = turnSide;
     this.flowchartControl = flowchartControl;
     this.timeVariable     = timeVariable;
     this.timeValue        = timeValue;
     this.distanceVariable = distanceVariable;
     this.distanceValue    = distanceValue;
     this.waitFinish       = waitFinish;
 }
예제 #11
0
 public RotateAction(string key, Variable rotateVariable, int rotateValue, RotateMode rotateMode, Side rotateSide, Side rotateWheel, Direction rotateDirection, FlowchartControl flowchartControl, Variable timeVariable, decimal timeValue, Variable angleVariable, decimal angleValue, bool waitFinish)
 {
     this.key              = key;
     this.rotateVariable   = rotateVariable;
     this.rotateValue      = rotateValue;
     this.rotateMode       = rotateMode;
     this.rotateWheel      = rotateWheel;
     this.rotateSide       = rotateSide;
     this.rotateDirection  = rotateDirection;
     this.flowchartControl = flowchartControl;
     this.timeVariable     = timeVariable;
     this.timeValue        = timeValue;
     this.angleVariable    = angleVariable;
     this.angleValue       = angleValue;
     this.waitFinish       = waitFinish;
 }
예제 #12
0
 public FreeAction(string key, Variable leftSpeedVariable, int leftSpeedValue, Direction leftDirection, Variable rightSpeedVariable, int rightSpeedValue, Direction rightDirection, FlowchartControl flowchartControl, Variable timeVariable, decimal timeValue, Variable distanceVariable, decimal distanceValue, bool waitFinish)
 {
     this.key = key;
     this.leftSpeedVariable  = leftSpeedVariable;
     this.leftSpeedValue     = leftSpeedValue;
     this.leftDirection      = leftDirection;
     this.rightSpeedVariable = rightSpeedVariable;
     this.rightSpeedValue    = rightSpeedValue;
     this.rightDirection     = rightDirection;
     this.flowchartControl   = flowchartControl;
     this.timeVariable       = timeVariable;
     this.timeValue          = timeValue;
     this.distanceVariable   = distanceVariable;
     this.distanceValue      = distanceValue;
     this.waitFinish         = waitFinish;
 }
예제 #13
0
        protected override void SaveSettings()
        {
            Variable speedVariable = null;
            int      speedValue    = 50;

            if (this.cbSpeed.SelectedIndex != 0)
            {
                speedVariable = GraphManager.GetVariable(this.cbSpeed.SelectedItem.ToString());
            }
            else
            {
                speedValue = (int)this.nudSpeed.Value;
            }
            RotateMode mode = RotateMode.Center;

            if (this.rbRotateWheel.Checked)
            {
                mode = RotateMode.Wheel;
            }
            Side rotateSide = Side.Right;

            if (this.cbRotateCenter.SelectedIndex == 1)
            {
                rotateSide = Side.Left;
            }
            Side rotateWheel = Side.Right;

            if (this.cbRotateWheel.SelectedIndex >= 2)
            {
                rotateWheel = Side.Left;
            }
            Direction rotateDirection = Direction.Forward;

            if (this.cbRotateWheel.SelectedIndex % 2 == 1)
            {
                rotateDirection = Direction.Backward;
            }

            FlowchartControl flowchartControl = FlowchartControl.Continuously;
            Variable         timeVariable     = null;
            Decimal          timeValue        = 0.1M;
            Variable         distanceVariable = null;
            Decimal          distanceValue    = 3.6M;

            if (this.rbTime.Checked)
            {
                flowchartControl = FlowchartControl.FinishTime;
                if (this.cbTime.SelectedIndex != 0)
                {
                    timeVariable = GraphManager.GetVariable(this.cbTime.SelectedItem.ToString());
                }
                else
                {
                    timeValue = this.nudTime.Value;
                }
            }
            else if (this.rbAngle.Checked)
            {
                flowchartControl = FlowchartControl.FinishAngle;
                if (this.cbAngle.SelectedIndex != 0)
                {
                    distanceVariable = GraphManager.GetVariable(this.cbAngle.SelectedItem.ToString());
                }
                else
                {
                    distanceValue = this.nudAngle.Value;
                }
            }
            bool waitFinish = this.cbFinishCommands.Checked;

            this.action.UpdateSettings(speedVariable, speedValue, mode, rotateSide, rotateWheel, rotateDirection, flowchartControl, timeVariable, timeValue, distanceVariable, distanceValue, waitFinish);
        }