Launcher waits for the window to be rendered before checking for updates, fixed error messagebox positioning in launcher
This commit is contained in:
@@ -28,6 +28,8 @@ namespace Launcher
|
|||||||
|
|
||||||
private string latestVersionFileList, latestVersionFolder;
|
private string latestVersionFileList, latestVersionFolder;
|
||||||
|
|
||||||
|
private int updateCheckState;
|
||||||
|
|
||||||
private List<DisplayMode> supportedModes;
|
private List<DisplayMode> supportedModes;
|
||||||
|
|
||||||
private GUIDropDown resolutionDD, contentPackageDD, displayModeDD;
|
private GUIDropDown resolutionDD, contentPackageDD, displayModeDD;
|
||||||
@@ -177,11 +179,6 @@ namespace Launcher
|
|||||||
//var fullScreenTick = new GUITickBox(new Rectangle(x,y+150,20,20), "Fullscreen", Alignment.TopLeft, guiRoot);
|
//var fullScreenTick = new GUITickBox(new Rectangle(x,y+150,20,20), "Fullscreen", Alignment.TopLeft, guiRoot);
|
||||||
//fullScreenTick.OnSelected = ToggleFullScreen;
|
//fullScreenTick.OnSelected = ToggleFullScreen;
|
||||||
//fullScreenTick.Selected = settings.FullScreenEnabled;
|
//fullScreenTick.Selected = settings.FullScreenEnabled;
|
||||||
|
|
||||||
if (settings.AutoCheckUpdates)
|
|
||||||
{
|
|
||||||
CheckForUpdates();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Update(GameTime gameTime)
|
protected override void Update(GameTime gameTime)
|
||||||
@@ -189,6 +186,21 @@ namespace Launcher
|
|||||||
if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
|
if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
|
||||||
Exit();
|
Exit();
|
||||||
|
|
||||||
|
|
||||||
|
if (settings.AutoCheckUpdates)
|
||||||
|
{
|
||||||
|
if (updateCheckState == 0)
|
||||||
|
{
|
||||||
|
updateInfoText.Text = "Checking for updates...";
|
||||||
|
updateCheckState++;
|
||||||
|
}
|
||||||
|
else if (updateCheckState == 2)
|
||||||
|
{
|
||||||
|
CheckForUpdates();
|
||||||
|
updateCheckState++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
base.Update(gameTime);
|
base.Update(gameTime);
|
||||||
|
|
||||||
float deltaTime = (float)gameTime.ElapsedGameTime.TotalSeconds;
|
float deltaTime = (float)gameTime.ElapsedGameTime.TotalSeconds;
|
||||||
@@ -228,6 +240,8 @@ namespace Launcher
|
|||||||
if (GUIMessageBox.VisibleBox != null) GUIMessageBox.VisibleBox.Draw(spriteBatch);
|
if (GUIMessageBox.VisibleBox != null) GUIMessageBox.VisibleBox.Draw(spriteBatch);
|
||||||
|
|
||||||
spriteBatch.End();
|
spriteBatch.End();
|
||||||
|
|
||||||
|
if (updateCheckState == 1) updateCheckState = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool TrySaveSettings(string filePath)
|
private bool TrySaveSettings(string filePath)
|
||||||
@@ -583,9 +597,13 @@ namespace Launcher
|
|||||||
{
|
{
|
||||||
GUIFrame dummyFrame = new GUIFrame(new Rectangle(0, 0, graphicsWidth, graphicsHeight));
|
GUIFrame dummyFrame = new GUIFrame(new Rectangle(0, 0, graphicsWidth, graphicsHeight));
|
||||||
dummyFrame.Padding = Vector4.Zero;
|
dummyFrame.Padding = Vector4.Zero;
|
||||||
|
GUIMessageBox errorBox = new GUIMessageBox(header, message, new string[] { "OK" }, 400, 250, Alignment.Center, dummyFrame);
|
||||||
GUIMessageBox errorBox = new GUIMessageBox(header, message, new string[] { "OK" }, 400, 250, Alignment.TopLeft, dummyFrame);
|
|
||||||
errorBox.Buttons[0].OnClicked = errorBox.Close;
|
errorBox.Buttons[0].OnClicked = errorBox.Close;
|
||||||
|
errorBox.InnerFrame.Rect = new Rectangle(
|
||||||
|
(graphicsWidth - errorBox.InnerFrame.Rect.Width) / 2,
|
||||||
|
(graphicsHeight - errorBox.InnerFrame.Rect.Height) / 2,
|
||||||
|
errorBox.InnerFrame.Rect.Width,
|
||||||
|
errorBox.InnerFrame.Rect.Height);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Completed(object sender, AsyncCompletedEventArgs e)
|
private void Completed(object sender, AsyncCompletedEventArgs e)
|
||||||
@@ -604,7 +622,12 @@ namespace Launcher
|
|||||||
GUIFrame dummyFrame = new GUIFrame(new Rectangle(0, 0, graphicsWidth, graphicsHeight));
|
GUIFrame dummyFrame = new GUIFrame(new Rectangle(0, 0, graphicsWidth, graphicsHeight));
|
||||||
dummyFrame.Padding = Vector4.Zero;
|
dummyFrame.Padding = Vector4.Zero;
|
||||||
GUIMessageBox errorBox = new GUIMessageBox("Error while updating", "Downloading the update failed.",
|
GUIMessageBox errorBox = new GUIMessageBox("Error while updating", "Downloading the update failed.",
|
||||||
new string[] { "Retry", "Cancel" }, 400, 250, Alignment.TopLeft, dummyFrame);
|
new string[] { "Retry", "Cancel" }, 400, 200, Alignment.Center, dummyFrame);
|
||||||
|
errorBox.InnerFrame.Rect = new Rectangle(
|
||||||
|
(graphicsWidth - errorBox.InnerFrame.Rect.Width) / 2,
|
||||||
|
(graphicsHeight - errorBox.InnerFrame.Rect.Height) / 2,
|
||||||
|
errorBox.InnerFrame.Rect.Width,
|
||||||
|
errorBox.InnerFrame.Rect.Height);
|
||||||
|
|
||||||
errorBox.Buttons[0].OnClicked += DownloadButtonClicked;
|
errorBox.Buttons[0].OnClicked += DownloadButtonClicked;
|
||||||
errorBox.Buttons[0].OnClicked += errorBox.Close;
|
errorBox.Buttons[0].OnClicked += errorBox.Close;
|
||||||
|
|||||||
Reference in New Issue
Block a user