Пример #1
0
 private void BtnClick(object sender, RoutedEventArgs e)
 {
     if (Convert.ToString((sender as Button).Content) != "Rensa")
     {
         if (!int.TryParse(InputOne.Text, out int i) || !int.TryParse(InputTwo.Text, out int k))
         {
             MessageBox.Show("Använd bara siffror tack.");
             InputOne.Clear();
             InputTwo.Clear();
             TotalSum.Clear();
         }
         else
         {
             string a, b;
             int    c;
             a             = InputOne.Text;
             b             = InputTwo.Text;
             c             = Convert.ToInt32(a) + Convert.ToInt32(b);
             TotalSum.Text = Convert.ToString(c);
         }
     }
     else
     {
         InputOne.Clear();
         InputTwo.Clear();
         TotalSum.Clear();
     }
 }
Пример #2
0
    public StepResult GetResult(Process process, string databaseName)
    {
        _process      = process;
        _databaseName = databaseName;

        var rows   = new List <Row>();
        var result = new StepResult();

        var result1 = InputOne.GetResult(process, databaseName);
        var result2 = InputTwo.GetResult(process, databaseName);

        if (Boolean.Equals("AND"))
        {
            // return rows where the condition is true for both parts
            rows = result1.Rows.Intersect(result2.Rows).ToList();
        }

        if (Boolean.Equals("OR"))
        {
            // union returns both rows, removing duplicates
            rows = result1.Rows.Union(result2.Rows).ToList();
        }

        result.Rows    = rows;
        result.IsValid = true;
        return(result);
    }
Пример #3
0
        void _brick_BrickChanged(object sender, BrickChangedEventArgs e)
        {
            MotorA.Update(_brick);
            MotorB.Update(_brick);
            MotorC.Update(_brick);
            MotorD.Update(_brick);

            InputOne.Update(_brick);
            InputTwo.Update(_brick);
            InputThree.Update(_brick);
            InputFour.Update(_brick);
        }
Пример #4
0
    public void GetResultText()
    {
        Console.WriteLine("Executing BoolStep:");
        Console.WriteLine($"BoolStep Id: {Id.ToString()}");

        Console.WriteLine($"BoolStep Executing Input 1:");
        InputOne.GetResultText();
        Console.WriteLine($"BoolStep Executing Input 2:");
        InputTwo.GetResultText();

        Console.WriteLine($"Combining Results with {Boolean}");
    }
Пример #5
0
    public string GetResultText()
    {
        var item = string.Empty;

        item += "Executing BoolStep:" + Environment.NewLine;

        item += $"BoolStep Id: {Id.ToString()}" + Environment.NewLine;

        item += $"BoolStep Executing Input 1:" + Environment.NewLine;
        item += InputOne.GetResultText() + Environment.NewLine;
        item += $"BoolStep Executing Input 2:" + Environment.NewLine;
        item += InputTwo.GetResultText() + Environment.NewLine;

        item += $"Combining Results with {Boolean}" + Environment.NewLine;

        return(item);
    }
Пример #6
0
        public void Execute()
        {
            if (InputOne != null && InputTwo != null)
            {
                //int and BigInt may be compared, but first the int has to be converted to big int:
                if ((InputOne.GetType().FullName == "System.Int32" ||
                     InputOne.GetType().FullName == "System.Int64") &&
                    InputTwo.GetType().FullName == "System.Numerics.BigInteger")
                {
                    this.InputOne = new BigInteger((int)InputOne);
                }
                if ((InputTwo.GetType().FullName == "System.Int32" ||
                     InputTwo.GetType().FullName == "System.Int64") &&
                    InputOne.GetType().FullName == "System.Numerics.BigInteger")
                {
                    this.InputTwo = new BigInteger((int)InputTwo);
                }

                try
                {
                    switch (this.settings.Comparator)
                    {
                    // if operator is =
                    case 0:
                    {
                        Output = InputOne.CompareTo(InputTwo) == 0;
                        ProgressChanged(100, 100);
                        break;
                    }

                    // if operator is !=
                    case 1:
                    {
                        Output = InputOne.CompareTo(InputTwo) != 0;
                        ProgressChanged(100, 100);
                        break;
                    }

                    //if operator is <
                    case 2:
                    {
                        Output = InputOne.CompareTo(InputTwo) < 0;
                        ProgressChanged(100, 100);
                        break;
                    }

                    //if operator is >
                    case 3:
                    {
                        Output = InputOne.CompareTo(InputTwo) > 0;
                        ProgressChanged(100, 100);
                        break;
                    }

                    //if operator is <=
                    case 4:
                    {
                        Output = InputOne.CompareTo(InputTwo) <= 0;
                        ProgressChanged(100, 100);
                        break;
                    }

                    //if operator is >=
                    case 5:
                    {
                        Output = InputOne.CompareTo(InputTwo) >= 0;
                        ProgressChanged(100, 100);
                        break;
                    }
                    }
                }
                catch (Exception e)
                {
                    GuiLogMessage("The given Inputs are not comparable: " + e.Message, NotificationLevel.Error);
                }
            }
        }
Пример #7
0
 private void ClearAllForm()
 {
     InputOne.Clear();
     InputTwo.Clear();
     SumTotal.Clear();
 }