private async Task RunInstall() { source = new CancellationTokenSource(); await Task.Yield(); var updateSource = new CancellationTokenSource(); var updateTask = UIUpdateTask(updateSource.Token); try { if (toInstallProvider.Model.InstallTools) { await InstallTools(source.Token); } else { await InstallEverything(source.Token); } updateSource.Cancel(); await updateTask; } catch (OperationCanceledException) { // Ignore, as we just want to continue } if (source.IsCancellationRequested) { succeeded = false; } else { succeeded = true; } await viewModelResolver.ResolveMainWindow().ExecuteGoNext(); }
public InstallPageViewModel(IViewModelResolver viewModelResolver, IToInstallProvider toInstallProvider, IConfigurationProvider configurationProvider, IVsCodeInstallLocationProvider vsInstallProvider, IProgramWindow programWindow, ICatchableButtonFactory buttonFactory) : base("", "") { this.viewModelResolver = viewModelResolver; this.toInstallProvider = toInstallProvider; this.configurationProvider = configurationProvider; this.vsInstallProvider = vsInstallProvider; this.programWindow = programWindow; CancelInstall = buttonFactory.CreateCatchableButton(CancelInstallFunc); runInstallTask = installFunc(); async Task installFunc() { try { await RunInstall(); } catch (Exception e) { viewModelResolver.ResolveMainWindow().HandleException(e); } } }
private async Task RunInstall() { source = new CancellationTokenSource(); await Task.Yield(); var updateSource = new CancellationTokenSource(); var updateTask = UIUpdateTask(updateSource.Token); try { do { ProgressTotal = 0; TextTotal = "Extracting"; await ExtractArchive(source.Token); if (source.IsCancellationRequested) { break; } ProgressTotal = 11; TextTotal = "Installing Gradle"; await RunGradleSetup(); if (source.IsCancellationRequested) { break; } ProgressTotal = 22; TextTotal = "Installing Tools"; await RunToolSetup(); if (source.IsCancellationRequested) { break; } ProgressTotal = 33; TextTotal = "Installing CPP"; await RunCppSetup(); if (source.IsCancellationRequested) { break; } ProgressTotal = 44; TextTotal = "Fixing Maven"; await RunMavenMetaDataFixer(); if (source.IsCancellationRequested) { break; } ProgressTotal = 55; TextTotal = "Installing VS Code"; await RunVsCodeSetup(source.Token); if (source.IsCancellationRequested) { break; } ProgressTotal = 66; TextTotal = "Configuring VS Code"; await ConfigureVsCodeSettings(); if (source.IsCancellationRequested) { break; } ProgressTotal = 77; TextTotal = "Installing VS Code Extensions"; await RunVsCodeExtensionsSetup(); if (source.IsCancellationRequested) { break; } ProgressTotal = 88; TextTotal = "Creating Shortcuts"; await RunShortcutCreator(source.Token); } while (false); updateSource.Cancel(); await updateTask; } catch (OperationCanceledException) { // Ignore, as we just want to continue } if (source.IsCancellationRequested) { succeeded = false; } else { succeeded = true; } await viewModelResolver.ResolveMainWindow().ExecuteGoNext(); }
private async Task InstallLocalUserFunc() { Model.InstallAsAdmin = false; await viewModelResolver.ResolveMainWindow().ExecuteGoNext(); }
private async Task RunInstall() { source = new CancellationTokenSource(); await Task.Yield(); var updateSource = new CancellationTokenSource(); var updateTask = UIUpdateTask(updateSource.Token); try { do { await ExtractArchive(source.Token); if (source.IsCancellationRequested) { break; } await RunGradleSetup(); if (source.IsCancellationRequested) { break; } await RunToolSetup(); if (source.IsCancellationRequested) { break; } await RunCppSetup(); if (source.IsCancellationRequested) { break; } await RunMavenMetaDataFixer(); if (source.IsCancellationRequested) { break; } await RunVsCodeSetup(source.Token); if (source.IsCancellationRequested) { break; } await ConfigureVsCodeSettings(); if (source.IsCancellationRequested) { break; } await RunVsCodeExtensionsSetup(); if (source.IsCancellationRequested) { break; } await RunShortcutCreator(source.Token); } while (false); updateSource.Cancel(); await updateTask; } catch (OperationCanceledException) { // Ignore, as we just want to continue } if (source.IsCancellationRequested) { succeeded = false; } else { succeeded = true; } await viewModelResolver.ResolveMainWindow().ExecuteGoNext(); }