示例#1
0
        protected override void SaveSettings()
        {
            int line = 0;

            if (this.rbLine1.Checked)
            {
                line = 1;
            }
            else if (this.rbLine2.Checked)
            {
                line = 2;
            }
            else if (this.rbLine3.Checked)
            {
                line = 3;
            }
            else if (this.rbLine4.Checked)
            {
                line = 4;
            }
            else if (this.rbLine5.Checked)
            {
                line = 5;
            }
            ComparativeOp operation = (ComparativeOp)Enum.ToObject(typeof(ComparativeOp), this.cbOperator.SelectedIndex);
            IoValue       lineValue = IoValue.On;

            if (this.cbLineValue.SelectedIndex == 1)
            {
                lineValue = IoValue.Off;
            }
            this.action.UpdateSettings(line, operation, lineValue);
        }
示例#2
0
        public CheckInAction(string key, XmlElement properties)
        {
            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 "line":
                    this.line = System.Convert.ToInt32(property.InnerText);
                    break;

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

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

                default:
                    throw new ProjectException("Error el crear la acción");
                }
            }
        }
        public CompareBrightnessAction(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 "operation":
                    this.operation = (ComparativeOp)Enum.Parse(typeof(ComparativeOp), property.InnerText);
                    break;

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

                case "compareValue":
                    this.compareValue = System.Convert.ToInt32(property.InnerText);
                    break;

                default:
                    throw new ProjectException("Error el crear la acción");
                }
            }
        }
 public void UpdateSettings(ObstacleSensor obstacleSensor, ComparativeOp operation, Variable compareVariable, int compareValue)
 {
     this.obstacleSensor  = obstacleSensor;
     this.operation       = operation;
     this.compareVariable = compareVariable;
     this.compareValue    = compareValue;
 }
示例#5
0
 public CheckInAction(string key, int line, ComparativeOp operation, IoValue lineValue)
 {
     this.key       = key;
     this.line      = line;
     this.operation = operation;
     this.lineValue = lineValue;
 }
 public void UpdateSettings(AccelerometerAxis axis, ComparativeOp operation, Variable compareVariable, decimal compareValue)
 {
     this.axis            = axis;
     this.operation       = operation;
     this.compareVariable = compareVariable;
     this.compareValue    = compareValue;
 }
示例#7
0
 public void UpdateSettings(Variable variable, ComparativeOp operation, Variable compareVariable, int compareValue)
 {
     this.variable        = variable;
     this.operation       = operation;
     this.compareVariable = compareVariable;
     this.compareValue    = compareValue;
 }
 public CompareTimeAction(string key, ComparativeOp operation, Variable compareVariable, decimal compareValue)
 {
     this.key             = key;
     this.operation       = operation;
     this.compareVariable = compareVariable;
     this.compareValue    = compareValue;
 }
示例#9
0
 public void UpdateSettings(Side wheel, ComparativeOp operation, Variable compareVariable, int compareValue)
 {
     this.wheel           = wheel;
     this.operation       = operation;
     this.compareVariable = compareVariable;
     this.compareValue    = compareValue;
 }
示例#10
0
        protected override void SaveSettings()
        {
            ObstacleSensor sensor = ObstacleSensor.Right;

            if (this.rbUpperRightSensor.Checked)
            {
                sensor = ObstacleSensor.UpperRight;
            }
            else if (this.rbLeftSensor.Checked)
            {
                sensor = ObstacleSensor.Left;
            }
            else if (this.rbUpperLeftSensor.Checked)
            {
                sensor = ObstacleSensor.UpperLeft;
            }
            ComparativeOp operation = (ComparativeOp)Enum.ToObject(typeof(ComparativeOp), this.cbOperator.SelectedIndex);
            Variable      variable  = null;
            int           value     = 0;

            if (this.cbCompareVariable.SelectedIndex != 0)
            {
                variable = GraphManager.GetVariable(this.cbCompareVariable.SelectedItem.ToString());
            }
            else
            {
                value = (int)this.nudCompareValue.Value;
            }
            this.action.UpdateSettings(sensor, operation, variable, value);
        }
 public void UpdateSettings(Side lineSensor, ComparativeOp operation, Variable compareVariable, int compareValue)
 {
     this.lineSensor      = lineSensor;
     this.operation       = operation;
     this.compareVariable = compareVariable;
     this.compareValue    = compareValue;
 }
 public CompareBrightnessAction(string key, ComparativeOp operation, Variable compareVariable, int compareValue)
 {
     this.key             = key;
     this.operation       = operation;
     this.compareVariable = compareVariable;
     this.compareValue    = compareValue;
 }
示例#13
0
        protected override void SaveSettings()
        {
            AccelerometerAxis axis = AccelerometerAxis.X;

            if (this.rbYAxis.Checked)
            {
                axis = AccelerometerAxis.Y;
            }
            else if (this.rbZAxis.Checked)
            {
                axis = AccelerometerAxis.Z;
            }
            ComparativeOp operation = (ComparativeOp)Enum.ToObject(typeof(ComparativeOp), this.cbOperator.SelectedIndex);
            Variable      variable  = null;
            decimal       value     = 0;

            if (this.cbCompareVariable.SelectedIndex != 0)
            {
                variable = GraphManager.GetVariable(this.cbCompareVariable.SelectedItem.ToString());
            }
            else
            {
                value = this.nudCompareValue.Value;
            }
            this.action.UpdateSettings(axis, operation, variable, value);
        }
示例#14
0
 public CompareVariableAction(string key, Variable variable, ComparativeOp operation, Variable compareVariable, int compareValue)
 {
     this.key             = key;
     this.variable        = variable;
     this.operation       = operation;
     this.compareVariable = compareVariable;
     this.compareValue    = compareValue;
 }
示例#15
0
 public CompareSpeedAction(string key, Side wheel, ComparativeOp operation, Variable compareVariable, int compareValue)
 {
     this.key             = key;
     this.wheel           = wheel;
     this.operation       = operation;
     this.compareVariable = compareVariable;
     this.compareValue    = compareValue;
 }
 public CompareLineAction(string key, Side lineSensor, ComparativeOp operation, Variable compareVariable, int compareValue)
 {
     this.key             = key;
     this.lineSensor      = lineSensor;
     this.operation       = operation;
     this.compareVariable = compareVariable;
     this.compareValue    = compareValue;
 }
 public CompareObstacleAction(string key, ObstacleSensor obstacleSensor, ComparativeOp operation, Variable compareVariable, int compareValue)
 {
     this.key             = key;
     this.obstacleSensor  = ObstacleSensor;
     this.operation       = operation;
     this.compareVariable = compareVariable;
     this.compareValue    = compareValue;
 }
 public CompareAccelerometerAction(string key, AccelerometerAxis axis, ComparativeOp operation, Variable compareVariable, decimal compareValue)
 {
     this.key             = key;
     this.axis            = axis;
     this.operation       = operation;
     this.compareVariable = compareVariable;
     this.compareValue    = compareValue;
 }
 protected override void SaveSettings()
 {
     Side sensor = Side.Right;
     if (this.rbLeftSensor.Checked)
         sensor = Side.Left;
     ComparativeOp operation = (ComparativeOp)Enum.ToObject(typeof(ComparativeOp), this.cbOperator.SelectedIndex);
     Variable variable = null;
     int value = 0;
     if (this.cbCompareVariable.SelectedIndex != 0)
         variable = GraphManager.GetVariable(this.cbCompareVariable.SelectedItem.ToString());
     else
         value = (int)this.nudCompareValue.Value;
     this.action.UpdateSettings(sensor, operation, variable, value);
 }
        protected override void SaveSettings()
        {
            ComparativeOp operation = (ComparativeOp)Enum.ToObject(typeof(ComparativeOp), this.cbOperator.SelectedIndex);
            Variable      variable  = null;
            int           value     = 0;

            if (this.cbCompareVariable.SelectedIndex != 0)
            {
                variable = GraphManager.GetVariable(this.cbCompareVariable.SelectedItem.ToString());
            }
            else
            {
                value = (int)this.nudCompareValue.Value;
            }
            this.action.UpdateSettings(operation, variable, value);
        }
        public CompareAccelerometerAction(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 "axis":
                    this.axis = (AccelerometerAxis)Enum.Parse(typeof(AccelerometerAxis), property.InnerText);
                    break;

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

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

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

                default:
                    throw new ProjectException("Error el crear la acción");
                }
            }
        }
 public void UpdateSettings(ComparativeOp operation, Variable compareVariable, decimal compareValue)
 {
     this.operation       = operation;
     this.compareVariable = compareVariable;
     this.compareValue    = compareValue;
 }
示例#23
0
 public void UpdateSettings(int line, ComparativeOp operation, IoValue lineValue)
 {
     this.line      = line;
     this.operation = operation;
     this.lineValue = lineValue;
 }