コード例 #1
0
 /// <summary>
 /// Method for changing the colour of the text box depending on the gear score of the piece of armour
 /// </summary>
 /// <param name="counter"></param>
 /// <param name="hel"></param>
 /// <param name="arms"></param>
 /// <param name="chest"></param>
 /// <param name="Class"></param>
 /// <param name="Legs"></param>
 /// <param name="Prim"></param>
 /// <param name="secondary"></param>
 /// <param name="Power"></param>
 /// <param name="_base"></param>
 /// <param name="mainpower"></param>
 private void colourchanger(int counter, double hel, double arms, double chest, double Class, double Legs, double Prim, double secondary, double Power, double _base, double mainpower)
 {
     try
     {
         double basedown = Math.Floor(_base);
         Destiny2Logic.isItemLessThan(hel, basedown, counter, Helment_tb);
         Destiny2Logic.isItemLessThan(arms, basedown, counter, Arms_tb);
         Destiny2Logic.isItemLessThan(chest, basedown, counter, Chest_tb);
         Destiny2Logic.isItemLessThan(Legs, basedown, counter, Legs_tb);
         Destiny2Logic.isItemLessThan(Class, basedown, counter, Class_tb);
         Destiny2Logic.isItemLessThan(Prim, basedown, counter, Prim_tb);
         Destiny2Logic.isItemLessThan(secondary, basedown, counter, Sec_tb);
         Destiny2Logic.isItemLessThan(Power, basedown, counter, Power_tb);
         Destiny2Logic.SuggestedUpgrade(mainpower, counter, SuggestedRoute);
     }
     catch (Exception exe)
     {
         if (isAdmin == true)
         {
             MessageBox.Show("Error with Colour Changer with the error message off {0}", exe.ToString());
         }
         else
         {
             MessageBox.Show("Please Enter Valid Gear Scores Within the Provided Boxes");
         }
     }
 }
コード例 #2
0
        //Button event which calculates the users power level and displays it to a label
        private void Calculate_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                //Storing The Levels From the input into appropriate variables
                Armour newset = new Armour();
                newset.Helmet    = double.Parse(Helment_tb.Text);
                newset.Arms      = double.Parse(Arms_tb.Text);
                newset.Chest     = double.Parse(Chest_tb.Text);
                newset.Legs      = double.Parse(Legs_tb.Text);
                newset.Class     = double.Parse(Class_tb.Text);
                newset.Primary   = double.Parse(Prim_tb.Text);
                newset.Secondary = double.Parse(Sec_tb.Text);
                newset.Power     = double.Parse(Power_tb.Text);

                //Calculation to Find out the average Power Level of The User
                double cal     = newset.cal();
                double PlValue = cal / 8;

                //Rounding up the Power Level, Rounding Down the PowerLevel
                double plRoundUp   = Math.Round(PlValue, 1);
                double plRoundDown = Math.Floor(PlValue);
                double _basePl     = Math.Ceiling(PlValue);

                //Counter Used Counting How Many Pieces are Underleveled
                int counter = 0;

                //Displaying The Power Level Code
                powertext.Content = plRoundUp.ToString();
                Destiny2Logic.avg(_basePl, plRoundUp, IncreaseVal);
                colourchanger(counter, newset.Helmet, newset.Arms, newset.Chest, newset.Class, newset.Legs, newset.Primary, newset.Secondary, newset.Power, PlValue, plRoundUp);
                PowerMethod(plRoundUp);

                //Progress Bar
                SettingProgressBar(plRoundDown, _basePl, PlValue);
            }
            catch (Exception ex)
            {
                if (isAdmin == true)
                {
                    MessageBox.Show(ex.ToString());
                }
                else
                {
                    MessageBox.Show("Please Enter Valid Gear Scores Within the Provided Boxes");
                }
            }
        }