コード例 #1
0
        public MainWindow()
        {
            OFilteredServerList = new TrulyObservableCollection <ServerInfo>();

            SourceInitialized += (s, a) =>
            {
                StartCheckingVersions();

                if (ServerRefreshRate > 0)
                {
                    _refreshTimer          = new DispatcherTimer();
                    _refreshTimer.Interval = new TimeSpan(0, 0, ServerRefreshRate);
                    _refreshTimer.Tick    += (object sender, EventArgs e) => StartRefreshingServers();
                    _refreshTimer.Start();
                }
                StartRefreshingServers();

                if (VersionCheck.GetGameVersionName() == "Unknown")
                {
                    Properties.Settings.Default.Installed = false;
                    Properties.Settings.Default.Save();

                    #region PrimaryStartupInstallation
                    //Show the dialog that asks to install the game
                    this.InitFirstInstall();
                    #endregion PrimaryStartupInstallation
                }
                else
                {
                    Properties.Settings.Default.Installed = true;
                    Properties.Settings.Default.Save();
                    if (Properties.Settings.Default.Username != "")
                    {
                        SD_Username.Content = Properties.Settings.Default.Username;
                    }
                    else
                    {
                        ShowUsernameBox();
                    }
                }
            };
            InitializeComponent();

            //SetMessageboxText(MESSAGE_IDLE); // This must be set before any asynchronous code runs, as it might otherwise be overridden.
            ServerInfoGrid.Items.SortDescriptions.Add(new SortDescription(PlayerCountColumn.SortMemberPath, ListSortDirection.Ascending));

            SD_GameVersion.Content = VersionCheck.GetGameVersionName();

            BannerTools.Setup();
            SD_ClanHeader.Cursor = BannerTools.GetBannerLink(null) != "" ? Cursors.Hand : null;

            //due to the mediaelement being set to manual control, we need to start the previewvid in the constructor
            this.sv_MapPreviewVid.Play();
        }
コード例 #2
0
        private async Task CheckVersionsAsync()
        {
            await VersionCheck.UpdateLatestVersions();

            if (!VersionCheck.IsLauncherOutOfDate())
            {
                SetMessageboxText("Launcher is up to date!");
            }
            else
            {
                SetMessageboxText("Launcher is out of date!");

                bool updateInstallPending;
                ShowLauncherUpdateWindow(out updateInstallPending);
                if (updateInstallPending)
                {
                    Close();
                }
                else
                {
                    // Get banners; consider moving this later
                    BannerTools.Setup();
                }
                return;
            }

            if (VersionCheck.GetGameVersionName() == "Unknown")
            {
                SetMessageboxText("Could not locate installed game version. Latest is " + VersionCheck.GetLatestGameVersionName());
            }
            else if (!VersionCheck.IsGameOutOfDate())
            {
                SetMessageboxText("Game is up to date! " + VersionCheck.GetGameVersionName());
            }
            else
            {
                SetMessageboxText("Game is out of date!");

                bool wasUpdated;
                ShowGameUpdateWindow(out wasUpdated);
                if (wasUpdated)
                {
                    SetMessageboxText("Game was updated! " + VersionCheck.GetGameVersionName());
                }
                SD_GameVersion.Content = VersionCheck.GetGameVersionName();
            }

            // Get banners; consider moving this later
            BannerTools.Setup();
        }