public async Task InstallAsync(bool Repair = false) { try { TouchupFile.Refresh(); if (TouchupFile.Exists && !string.IsNullOrEmpty(InstallationParameter)) { if (Repair && string.IsNullOrEmpty(RepairParameter)) { return; } await Main.FormAccessor.AppView.AppPanel.Dispatcher.Invoke(async delegate { var ProgressInformationMessage = await Main.FormAccessor.ShowProgressAsync("Please wait...", $"Asking Origin to install {AppName} as you have requested."); ProgressInformationMessage.SetIndeterminate(); var process = Process.Start(TouchupFile.FullName, ((Repair) ? RepairParameter : InstallationParameter).Replace("{locale}", InstalledLocale).Replace("{installLocation}", InstallationDirectory.FullName)); Debug.WriteLine(InstallationParameter.Replace("{locale}", InstalledLocale).Replace("{installLocation}", InstallationDirectory.FullName)); ProgressInformationMessage.SetMessage($"Asking Origin to install {AppName} as you have requested.\n\n\nWaiting for Origin to complete the installation..."); while (!process.HasExited) { await Task.Delay(100); } await ProgressInformationMessage.CloseAsync(); var installLog = File.ReadAllLines(Path.Combine(InstallationDirectory.FullName, "__Installer", "InstallLog.txt")).Reverse(); if (installLog.Any(x => x.IndexOf("Installer finished with exit code:", StringComparison.OrdinalIgnoreCase) != -1)) { var test = installLog.FirstOrDefault(x => x.IndexOf("Installer finished with exit code:", StringComparison.OrdinalIgnoreCase) != -1); await Main.FormAccessor.ShowMessageAsync("Origin App Installation", "Origin app installation completed.\n\n\nResult message:\n\n" + test); } }); } } catch (Exception ex) { logger.Error(ex); await SLM.RavenClient.CaptureAsync(new SharpRaven.Data.SentryEvent(ex)); } }
public async Task InstallAsync(bool Repair = false) { try { TouchupFile.Refresh(); if (TouchupFile.Exists && !string.IsNullOrEmpty(InstallationParameter)) { if (Repair && string.IsNullOrEmpty(RepairParameter)) { return; } await Main.FormAccessor.AppView.AppPanel.Dispatcher.Invoke(async delegate { var ProgressInformationMessage = await Main.FormAccessor.ShowProgressAsync(Functions.SLM.Translate(nameof(Properties.Resources.PleaseWait)), Framework.StringFormat.Format(Functions.SLM.Translate(nameof(Properties.Resources.OriginInstallation_Start)), new { AppName })); ProgressInformationMessage.SetIndeterminate(); var process = Process.Start(TouchupFile.FullName, ((Repair) ? RepairParameter : InstallationParameter).Replace("{locale}", InstalledLocale).Replace("{installLocation}", InstallationDirectory.FullName)); Debug.WriteLine(InstallationParameter.Replace("{locale}", InstalledLocale).Replace("{installLocation}", InstallationDirectory.FullName)); ProgressInformationMessage.SetMessage(Framework.StringFormat.Format(Functions.SLM.Translate(nameof(Properties.Resources.OriginInstallation_Ongoing)), new { AppName })); while (!process.HasExited) { await Task.Delay(100); } await ProgressInformationMessage.CloseAsync(); var installLog = File.ReadAllLines(Path.Combine(InstallationDirectory.FullName, "__Installer", "InstallLog.txt")).Reverse(); if (installLog.Any(x => x.IndexOf("Installer finished with exit code:", StringComparison.OrdinalIgnoreCase) != -1)) { var installerResult = installLog.FirstOrDefault(x => x.IndexOf("Installer finished with exit code:", StringComparison.OrdinalIgnoreCase) != -1); await Main.FormAccessor.ShowMessageAsync(Functions.SLM.Translate(nameof(Properties.Resources.OriginInstallation)), Framework.StringFormat.Format(Functions.SLM.Translate(nameof(Properties.Resources.OriginInstallation_Completed)), new { installerResult })); } }); } } catch (Exception ex) { logger.Error(ex); await SLM.RavenClient.CaptureAsync(new SharpRaven.Data.SentryEvent(ex)); } }