private void Calculate()
        {
            if (ReinforcementsTotal != null && DiamondsTotal != null)
            {
                try
                {
                    _rings.Start = Int32.Parse(Start.Text);
                    _rings.Rings = Int32.Parse(Number.Text);
                    _rings.Space = Int32.Parse(Space.Text);
                    int total     = _rings.TotalCost();
                    int reinforce = Int32.Parse(ReinforceCost.Text);
                    ReinforcementsTotal.Text = (total).ToString();
                    DiamondsTotal.Text       = ((int)Math.Ceiling((double)total / reinforce)).ToString();

                    StartText              = Start.Text;
                    NumberText             = Number.Text;
                    SpaceText              = Space.Text;
                    Total                  = total;
                    Reinforce              = ReinforceCost.Text;
                    ReinforcementTotalText = ReinforcementsTotal.Text;
                    DiamondsTotalText      = DiamondsTotal.Text;

                    ChangeMainWindow();
                }
                catch (Exception e)
                {
                    System.IO.File.WriteAllText("Stack.trace", e.StackTrace);
                    System.Windows.MessageBox.Show("Error has accored! Please submit the file 'Stack.trace' to the issue section of the main Github.");
                }
            }
        }
Exemple #2
0
        public void Calculate()
        {
            if (Layer != null &&
                Head != null &&
                Tail != null &&
                Speed != null &&
                v != null &&
                r != null &&
                !Layer.Text.Equals("") &&
                !Head.Text.Equals("") &&
                !Tail.Text.Equals(""))
            {
                try
                {
                    v.layer = Int32.Parse(Layer.Text);

                    v.x           = Convert.ToInt32(Head.Text);
                    v.y           = Convert.ToInt32(Tail.Text);
                    v.checkDouble = check.IsChecked.Value;

                    Cost.Text   = Convert.ToString(v.Cost() + r.TotalCost());
                    X_Time.Text = Convert.ToString(v.X_time(Int32.Parse(Speed.Text)));
                    Y_Time.Text = Convert.ToString(v.Y_time(Int32.Parse(Speed.Text)));
                    X.Text      = Convert.ToString(v.X_layer());
                    Y.Text      = Convert.ToString(v.Y_layer());
                }
                catch (Exception e)
                {
                    System.IO.File.WriteAllText("Stack.trace", e.StackTrace);
                    System.Windows.MessageBox.Show("Error has accored! Please submit the file 'Stack.trace' to the issue section of the main Github.");
                }
            }
        }