internal static async Task PerformCheckAndUpdateButtonAsync() { PerformUpdate.Text = UPDATE_STRING; CanCheckForUpdate = false; var oldText = CheckForUpdate.Text; CheckForUpdate.Text = "Finding Latest Update..."; CanPerformUpdate = PathfinderUpdaterPlugin.NeedsUpdate = (await PathfinderUpdaterPlugin.PerformCheckAsync(true)).Length > 0; CheckForUpdate.Text = oldText; CanCheckForUpdate = true; PerformUpdate.Text += $" (v{PathfinderUpdaterPlugin.PathfinderUpdater.LatestVersion})"; }
public override void Draw(GameTime gameTime) { ScreenManager.SpriteBatch.Begin(); ScreenManager.SpriteBatch.Draw(Utils.white, new Rectangle(0, 0, ScreenManager.SpriteBatch.GraphicsDevice.Viewport.Width, GuiData.spriteBatch.GraphicsDevice.Viewport.Height), new Color(0, 0, 0, 0.65f)); ScreenManager.SpriteBatch.Draw(Utils.white, new Rectangle(400, 250, 800, 150), Color.Black); TextItem.doLabel(new Vector2(550, 260), $"Do you want to restart the game?", Color.White); NoRestartPrompt.Draw(675, 300); if (AcceptVersion.Do()) { PathfinderUpdaterPlugin.RestartForUpdate(); ExitScreen(); } else if (DenyVersion.Do()) { ExitScreen(); } ScreenManager.SpriteBatch.End(); }
private static async Task PerformUpdateAndUpdateButtonAsync(MainMenu menu) { var couldCheckForUpdate = CanCheckForUpdate; CanCheckForUpdate = false; CanPerformUpdate = false; var oldText = PerformUpdate.Text; PerformUpdate.Text = "Currently Updating..."; await PathfinderUpdaterPlugin.PerformUpdateAsync(); PerformUpdate.Text = oldText; if (!menu.ScreenManager.screens.Contains(popupScreen) && !PathfinderUpdaterPlugin.NoRestartPrompt.Value) { menu.ScreenManager.AddScreen(popupScreen ??= new RestartPopupScreen()); } CanPerformUpdate = !menu.ScreenManager.screens.Contains(popupScreen); CanCheckForUpdate = couldCheckForUpdate; }