void ShowGameUpdateWindow(out bool wasUpdated) { RxLogger.Logger.Instance.Write("Showing game update window"); UpdateAvailableWindow theWindow = new UpdateAvailableWindow(); theWindow.LatestVersionText.Content = VersionCheck.GetLatestGameVersionName(); theWindow.GameVersionText.Content = VersionCheck.GetGameVersionName(); theWindow.WindowTitle.Content = "Game update available!"; theWindow.Owner = this; theWindow.ShowDialog(); if (!theWindow.WantsToUpdate) { wasUpdated = false; } else { //Get the previous vid that plays and store it. Nullify the playing vid so no handle is open Uri previousVid = sv_MapPreviewVid.Source; sv_MapPreviewVid.Source = null; // Close any other instances of the RenX-Launcher if (InstanceHandler.IsAnotherInstanceRunning()) { InstanceHandler.KillDuplicateInstance(); } var targetDir = GameInstallation.GetRootPath(); var applicationDir = Path.Combine(GameInstallation.GetRootPath(), "patch"); var patchPath = VersionCheck.GamePatchPath; var patchUrls = VersionCheck.GamePatchUrls; var patchVersion = VersionCheck.GetLatestGameVersionName(); var progress = new Progress <DirectoryPatcherProgressReport>(); var cancellationTokenSource = new CancellationTokenSource(); RxLogger.Logger.Instance.Write($"Starting game update | TargetDir: {targetDir} | AppDir: {applicationDir} | PatchPath: {patchPath},| PatchVersion: {patchVersion}"); Task task = RxPatcher.Instance.ApplyPatchFromWeb(patchPath, targetDir, applicationDir, progress, cancellationTokenSource.Token, VersionCheck.InstructionsHash); RxLogger.Logger.Instance.Write("Download complete, Showing ApplyUpdateWindow"); var window = new ApplyUpdateWindow(task, RxPatcher.Instance, progress, patchVersion, cancellationTokenSource, ApplyUpdateWindow.UpdateWindowType.Update); window.Owner = this; window.ShowDialog(); VersionCheck.UpdateGameVersion(); wasUpdated = true; //Resume playback of vid sv_MapPreviewVid.Source = previousVid; sv_MapPreviewVid.Play(); // Refresh server list StartRefreshingServers(); } }
protected void CheckForUpdates(bool silent) { if (WinBMA.Utilities.UpdateChecker.IsUpdateAvailable) { UpdateAvailableWindow winUpdate = new UpdateAvailableWindow(); winUpdate.Owner = App.MainAppWindow; winUpdate.Topmost = App.MainAppWindow.Topmost; winUpdate.ShowDialog(); } else if (!silent) { MessageBox.Show("You are using the latest version of WinBMA.", "No Update Available", MessageBoxButton.OK, MessageBoxImage.Information); } }
private void Application_Startup(object sender, StartupEventArgs e) { ApplicationContext.Initialize(); this.RootVisual = new UserControlContainer(); if (Application.Current.IsRunningOutOfBrowser) { Application.Current.CheckAndDownloadUpdateCompleted += (obj, args) => { if (args.UpdateAvailable) { UpdateAvailableWindow.Show(() => Application.Current.MainWindow.Close()); } else { var settingsUriString = "Settings.xml"; Uri source = Application.Current.Host.Source; string location; if (Debugger.IsAttached) { location = "http://www.indoorworx.com/IndoorWorx/";// "http://localhost:3415/"; } else { location = source.AbsoluteUri.Substring(0, source.AbsoluteUri.IndexOf("ClientBin", StringComparison.OrdinalIgnoreCase)); } settingsUriString = String.Concat(location, settingsUriString); Uri settingsUri = new Uri(settingsUriString, UriKind.Absolute); SettingsClient settingsService = new SettingsClient(settingsUri); settingsService.GetSettingsCompleted += this.SettingsService_GetSettingsCompleted; settingsService.GetSettingsAsync(); } }; Application.Current.CheckAndDownloadUpdateAsync(); } else { RootContainer.SwitchControl(new ApplicationInstallerView()); } }
void ShowLauncherUpdateWindow(out bool updateInstallPending) { UpdateAvailableWindow theWindow = new UpdateAvailableWindow(); theWindow.LatestVersionText.Content = VersionCheck.GetLatestLauncherVersionName(); theWindow.GameVersionText.Content = VersionCheck.GetLauncherVersionName(); theWindow.WindowTitle.Content = "Launcher update available!"; theWindow.Owner = this; theWindow.ShowDialog(); if (theWindow.WantsToUpdate) { DownloadLauncherUpdate(out updateInstallPending); } else { updateInstallPending = false; } }
void ShowGameUpdateWindow(out bool wasUpdated) { UpdateAvailableWindow theWindow = new UpdateAvailableWindow(); theWindow.LatestVersionText.Content = VersionCheck.GetLatestGameVersionName(); theWindow.GameVersionText.Content = VersionCheck.GetGameVersionName(); theWindow.WindowTitle.Content = "Game update available!"; theWindow.Owner = this; theWindow.ShowDialog(); if (!theWindow.WantsToUpdate) { wasUpdated = false; } else { // Close any other instances of the RenX-Launcher if (InstanceHandler.IsAnotherInstanceRunning()) { InstanceHandler.KillDuplicateInstance(); } var targetDir = GameInstallation.GetRootPath(); var applicationDir = Path.Combine(GameInstallation.GetRootPath(), "patch"); var patchPath = VersionCheck.GamePatchPath; var patchUrls = VersionCheck.GamePatchUrls; var patchVersion = VersionCheck.GetLatestGameVersionName(); var progress = new Progress <DirectoryPatcherProgressReport>(); var cancellationTokenSource = new CancellationTokenSource(); var patcher = new RXPatcher(); Task task = patcher.ApplyPatchFromWeb(patchUrls.Select(url => url.ServerUri.AbsoluteUri).ToArray(), patchPath, targetDir, applicationDir, progress, cancellationTokenSource.Token, VersionCheck.InstructionsHash); var window = new ApplyUpdateWindow(task, patcher, progress, patchVersion, cancellationTokenSource, ApplyUpdateWindow.UpdateWindowType.Update); window.Owner = this; window.ShowDialog(); VersionCheck.UpdateGameVersion(); wasUpdated = true; } }
protected void CheckForUpdates(bool silent) { if (WinBMA.Utilities.UpdateChecker.IsUpdateAvailable) { UpdateAvailableWindow winUpdate = new UpdateAvailableWindow(); winUpdate.Owner = App.MainAppWindow; winUpdate.Topmost = App.MainAppWindow.Topmost; winUpdate.ShowDialog(); } else if (!silent) { MessageBox.Show("You are using the latest version of WinBMA.", "No Update Available", MessageBoxButton.OK, MessageBoxImage.Information); } }