Example #1
0
        private void btnCreate_Click(object sender, RoutedEventArgs e)
        {
            Slider slMoney      = UIHelpers.FindChild <Slider>(this, "money");
            Slider slLoan       = UIHelpers.FindChild <Slider>(this, "loan");
            Slider slPrice      = UIHelpers.FindChild <Slider>(this, "price");
            Slider slPassengers = UIHelpers.FindChild <Slider>(this, "passengers");
            Slider slAI         = UIHelpers.FindChild <Slider>(this, "AI");
            Slider slStartData  = UIHelpers.FindChild <Slider>(this, "startdata");

            double money      = slMoney.Value;
            double loan       = slLoan.Value;
            double passengers = slPassengers.Value;
            double price      = slPrice.Value;
            double AI         = slAI.Value;
            double startData  = slStartData.Value;

            DifficultyLevel level = new DifficultyLevel("Custom", money, loan, passengers, price, AI, startData);

            WPFMessageBoxResult result = WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2406"), Translator.GetInstance().GetString("MessageBox", "2406", "message"), WPFMessageBoxButtons.YesNo);

            if (result == WPFMessageBoxResult.Yes)
            {
                DifficultyLevels.AddDifficultyLevel(level);

                PageNavigator.NavigateTo(new PageNewGame());
            }
        }
Example #2
0
        private void btnAddDifficulty_Click(object sender, RoutedEventArgs e)
        {
            object o = PopUpDifficulty.ShowPopUp((DifficultyLevel)cbDifficulty.SelectedItem);

            if (o != null && o is DifficultyLevel)
            {
                DifficultyLevel level = (DifficultyLevel)o;

                if (DifficultyLevels.GetDifficultyLevel("Custom") != null)
                {
                    DifficultyLevel customLevel = DifficultyLevels.GetDifficultyLevel("Custom");

                    DifficultyLevels.RemoveDifficultyLevel(customLevel);
                    cbDifficulty.Items.Remove(customLevel);
                }

                DifficultyLevels.AddDifficultyLevel(level);

                cbDifficulty.Items.Add(level);
                cbDifficulty.SelectedItem = level;
            }
        }