Beispiel #1
0
        /// <summary>
        /// Updates Game, console, category and splits.
        /// </summary>
        /// <param name="g"></param>
        /// <param name="cat"></param>
        public void UpdateGUI(Game g, Category cat)
        {
            MainWindow.instance.Startbtn.IsEnabled = true;
            MainWindow.instance.Resetbtn.IsEnabled = true;
            MainWindow.instance.Splitbtn.IsEnabled = true;
            MainWindow.instance.Stopbtn.IsEnabled  = true;
            GameTitle.Text     = g.GetName();
            ConsoleTitle.Text  = g.GetConsole();
            CategoryTitle.Text = cat.Name;
            if (SPLT.LoadedGame != null)
            {
                SOBTimeText.Text    = SPLT.TimeSpanToString(SPLT.LoadedGame.CategoryList[0].SOBTime, false);
                PBTimeText.Text     = SPLT.TimeSpanToString(SPLT.LoadedGame.CategoryList[0].PersonalBest, false);
                TargetTimeText.Text = SPLT.TimeSpanToString(SPLT.LoadedGame.CategoryList[0].TargetTime, false);
            }
            Splititemlist.Items.Clear();
            foreach (Split s in cat.SplitList)
            {
                Splititemlist.Items.Add(s.GetTitle());
            }
            switch (Preferences.DefaultComparisonSplits)
            {
            case 1:
                RunManager.WriteTargetTime(SPLT.LoadedGame.CategoryList[0].PBSplits);
                break;

            case 2:
                RunManager.WriteTargetTime(SPLT.LoadedGame.CategoryList[0].TargetSplits);
                break;

            case 3:
                RunManager.WriteTargetTime(SPLT.LoadedGame.CategoryList[0].SOBSplits);
                break;
            }
        }
Beispiel #2
0
        /// <summary>
        /// Loads preferences and updates the preferences tab with correct info.
        /// </summary>
        public static void LoadPreferences()
        {
            MainWindow.instance.ShowMSChkBox.IsChecked = ShowMS;
            if (WindowAlwaysOnTop)
            {
                MainWindow.instance.Topmost = true;
                MainWindow.instance.WindowAlwaysOnTopCheckBox.IsChecked = true;
            }
            else
            {
                MainWindow.instance.Topmost = false;
                MainWindow.instance.WindowAlwaysOnTopCheckBox.IsChecked = false;
            }

            try
            {
                if (DefaultGamePath != null)
                {
                    SPLT.ReadAndPrint(DefaultGamePath);
                }
                else
                {
                    MainWindow.instance.Startbtn.IsEnabled = false;
                    MainWindow.instance.Resetbtn.IsEnabled = false;
                    MainWindow.instance.Splitbtn.IsEnabled = false;
                    MainWindow.instance.Stopbtn.IsEnabled  = false;
                }
            } catch
            {
                Debug.WriteLine("failed to set defaultgame");
            }
            try
            {
                switch (DefaultComparisonSplits)
                {
                case 1:
                    MainWindow.instance.ComparisonTimeComboBox.SelectedIndex = 1;
                    //MainWindow.instance.CurrentComparisonTime.SelectedIndex = 0;
                    RunManager.WriteTargetTime(SPLT.LoadedGame.CategoryList[0].PBSplits);
                    MainWindow.instance.ComparisonTimeComboBox.SelectedIndex = 1;
                    break;

                case 2:
                    MainWindow.instance.ComparisonTimeComboBox.SelectedIndex = 2;
                    //MainWindow.instance.CurrentComparisonTime.SelectedIndex = 1;
                    RunManager.WriteTargetTime(SPLT.LoadedGame.CategoryList[0].TargetSplits);
                    MainWindow.instance.ComparisonTimeComboBox.SelectedIndex = 2;
                    break;

                case 3:
                    MainWindow.instance.ComparisonTimeComboBox.SelectedIndex = 3;
                    //MainWindow.instance.CurrentComparisonTime.SelectedIndex = 2;
                    RunManager.WriteTargetTime(SPLT.LoadedGame.CategoryList[0].SOBSplits);
                    MainWindow.instance.ComparisonTimeComboBox.SelectedIndex = 3;
                    break;
                }
            } catch
            {
                Debug.WriteLine("Failed to set defaultComparisonSplits");
            }
            try
            {
                MainWindow.instance.TargetTimeText.Text = SPLT.TimeSpanToString(DefaultTargetTime, false);
            } catch
            {
                Debug.WriteLine("Failed to set defaultTargetTime");
            }

            if (SavePrefsOnQuit)
            {
                MainWindow.instance.SavePreferencesOnQuitChkBox.IsChecked = true;
            }
            else
            {
                MainWindow.instance.SavePreferencesOnQuitChkBox.IsChecked = false;
            }
        }