コード例 #1
0
        public MainWindow()
        {
            InitializeComponent();
            Instance = this;

            const int ContentWidth  = 1280;
            const int ContentHeight = 720;

            double ChromeWidth  = SystemParameters.WindowNonClientFrameThickness.Left + SystemParameters.WindowNonClientFrameThickness.Right;
            double ChromeHeight = SystemParameters.WindowNonClientFrameThickness.Top + SystemParameters.WindowNonClientFrameThickness.Bottom;
            double ResizeBorder = SystemParameters.ResizeFrameVerticalBorderWidth;

            Width  = ChromeWidth + ContentWidth + 2 * ResizeBorder;
            Height = ChromeHeight + ContentHeight + 2 * ResizeBorder;

            VersionText.Text = App.Version;

            if (Utils.IsVoid())
            {
                Main.Content = Invalid.Instance;
                MainWindow.Instance.ModsButton.IsEnabled      = false;
                MainWindow.Instance.OptionsButton.IsEnabled   = false;
                MainWindow.Instance.IntroButton.IsEnabled     = false;
                MainWindow.Instance.AboutButton.IsEnabled     = false;
                MainWindow.Instance.GameVersionsBox.IsEnabled = false;
                return;
            }

            Themes.LoadThemes();
            Themes.FirstLoad(Properties.Settings.Default.SelectedTheme);

            Task.Run(() => LoadVersionsAsync());

            if (!Properties.Settings.Default.Agreed || string.IsNullOrEmpty(Properties.Settings.Default.LastTab))
            {
                Main.Content = Intro.Instance;
            }
            else
            {
                switch (Properties.Settings.Default.LastTab)
                {
                case "Intro":
                    Main.Content = Intro.Instance;
                    break;

                case "Mods":
                    _ = ShowModsPage();
                    break;

                case "About":
                    Main.Content = About.Instance;
                    break;

                case "Options":
                    Main.Content = Options.Instance;
                    Themes.LoadThemes();
                    break;

                default:
                    Main.Content = Intro.Instance;
                    break;
                }
            }
        }