Esempio n. 1
0
        private void btnAddScheduler_Click(object sender, RoutedEventArgs e)
        {
            var radioButtons = UIHelpers.FindRBChildren(this, "Interval");

            string interval = "";

            foreach (RadioButton rbInterval in radioButtons)
            {
                if (rbInterval.IsChecked.Value)
                {
                    interval = rbInterval.Tag.ToString();
                }
            }

            switch (interval)
            {
            case "Manual":
                addEntries(getSelectedDays());
                break;

            case "Daily":
                addEntries(Enum.GetValues(typeof(DayOfWeek)).Cast <DayOfWeek>().ToList());
                break;

            case "TTS":
                addEntries(new List <DayOfWeek>()
                {
                    DayOfWeek.Thursday, DayOfWeek.Tuesday, DayOfWeek.Saturday
                });
                break;

            case "EveryOther":
                addEntries(new List <DayOfWeek>()
                {
                    DayOfWeek.Monday, DayOfWeek.Wednesday, DayOfWeek.Friday, DayOfWeek.Sunday
                });
                break;

            case "Weekend":
                addEntries(new List <DayOfWeek>()
                {
                    DayOfWeek.Sunday, DayOfWeek.Saturday
                });
                break;

            case "MWF":
                addEntries(new List <DayOfWeek>()
                {
                    DayOfWeek.Monday, DayOfWeek.Wednesday, DayOfWeek.Friday
                });
                break;

            case "Weekdays":
                addEntries(new List <DayOfWeek>()
                {
                    DayOfWeek.Monday, DayOfWeek.Tuesday, DayOfWeek.Wednesday, DayOfWeek.Thursday, DayOfWeek.Friday
                });
                break;
            }
        }
Esempio n. 2
0
        private void btnSaveChanges_Click(object sender, RoutedEventArgs e)
        {
            WPFMessageBoxResult result = WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2952"), Translator.GetInstance().GetString("MessageBox", "2952", "message"), WPFMessageBoxButtons.YesNo);

            if (result == WPFMessageBoxResult.Yes)
            {
                AppSettings.GetInstance().setLanguage((Language)cbLanguage.SelectedItem);

                Settings.GetInstance().AirportCodeDisplay   = rbIATA.IsChecked.Value ? Settings.AirportCode.IATA : Settings.AirportCode.ICAO;
                Settings.GetInstance().MailsOnLandings      = cbLandings.IsChecked.Value;
                Settings.GetInstance().MailsOnBadWeather    = cbWeather.IsChecked.Value;
                Settings.GetInstance().MailsOnAirlineRoutes = cbAirlineDestinations.IsChecked.Value;
                Settings.GetInstance().CurrencyShorten      = cbShortenCurrency.IsChecked.Value;

                if (this.Options.HourRoundEnabled)
                {
                    Settings.GetInstance().MinutesPerTurn = (int)cbHours.SelectedItem;
                }

                GeneralHelpers.GameSpeedValue gameSpeed = (GeneralHelpers.GameSpeedValue)Enum.ToObject(typeof(GeneralHelpers.GameSpeedValue), (int)slGameSpeed.Value);

                Settings.GetInstance().setGameSpeed(gameSpeed);

                var rbAutoSaves = UIHelpers.FindRBChildren(this, "AutoSave");

                foreach (RadioButton rbInterval in rbAutoSaves)
                {
                    if (rbInterval.IsChecked.Value)
                    {
                        Settings.GetInstance().AutoSave = (Settings.Intervals)Enum.Parse(typeof(Settings.Intervals), rbInterval.Tag.ToString(), true);
                    }
                }

                var rbClearings = UIHelpers.FindRBChildren(this, "ClearStats");

                foreach (RadioButton rbInterval in rbClearings)
                {
                    if (rbInterval.IsChecked.Value)
                    {
                        Settings.GetInstance().ClearStats = (Settings.Intervals)Enum.Parse(typeof(Settings.Intervals), rbInterval.Tag.ToString(), true);
                    }
                }
            }
        }
Esempio n. 3
0
        //sets the values of the interval types
        private void setIntevalValues()
        {
            var rbAutoSaves = UIHelpers.FindRBChildren(this, "AutoSave");

            foreach (RadioButton rbInterval in rbAutoSaves)
            {
                if (rbInterval.Tag.ToString() == this.Options.AutoSave.ToString())
                {
                    rbInterval.IsChecked = true;
                }
            }

            var rbClearings = UIHelpers.FindRBChildren(this, "ClearStats");

            foreach (RadioButton rbInterval in rbClearings)
            {
                if (rbInterval.Tag.ToString() == this.Options.ClearStats.ToString())
                {
                    rbInterval.IsChecked = true;
                }
            }
        }