public IEnumerator DeletePackages(List <PackageInfo> packages) { var choice = _view.PromptForUserChoice( "<color=yellow>Are you sure you want to delete the following packages?</color>\n\n{0}\n\n<color=yellow>Please note the following:</color>\n\n- This change is not undoable\n- Any changes that you've made since installing will be lost\n- Any projects or other packages that still depend on this package may be put in an invalid state by deleting it".Fmt(packages.Select(x => "- " + x.Name).Join("\n")), new[] { "Delete", "Cancel" }, null, "DeleteSelectedPopupTextStyle", 0, 1); yield return(choice); if (choice.Current == 0) { yield return(_prjCommandHandler.ProcessPrjCommand( "Deleting packages", PrjHelper.DeletePackagesAsync(packages))); yield return(RefreshPackagesAsync()); } }
public IEnumerator DeletePackages(List <PackageInfo> packages) { var choice = _view.PromptForUserChoice( "<color=yellow>Are you sure you want to delete the following packages?</color>\n\n{0}\n\n<color=yellow>Please note the following:</color>\n\n- This change is not undoable\n- Any changes that you've made since installing will be lost\n- Any projects or other packages that still depend on this package may be put in an invalid state by deleting it".Fmt(packages.Select(x => "- " + x.Name).Join("\n")), new[] { "Delete", "Cancel" }, null, "DeleteSelectedPopupTextStyle", 0, 1); yield return(choice); if (choice.Current == 0) { foreach (var package in packages) { var expandedPath = PrjPathVars.Expand(package.FullPath); Log.Debug("Deleting package directory at '{0}'", expandedPath); Directory.Delete(expandedPath, true); } yield return(RefreshPackagesAsync()); } }
IEnumerator TryChangeProjectType(ProjectConfigTypes configType) { if (_projectHandler.HasProjectConfigChanged()) { var fileName = Path.GetFileName(ProjenyEditorUtil.GetProjectConfigPath(_view.ProjectConfigType)); var choice = _view.PromptForUserChoice( "Do you want to save changes to {0}?".Fmt(fileName), new[] { "Save", "Don't Save", "Cancel" }, null, null, 0, 2); yield return(choice); switch (choice.Current) { case 0: { _projectHandler.OverwriteConfig(); break; } case 1: { // Do nothing break; } case 2: { yield break; } default: { Assert.Throw(); break; } } } _view.ProjectConfigType = configType; _projectHandler.RefreshProject(); }
IEnumerator CheckShouldInstallInternal(ReleaseInfo releaseInfo) { var packageInfo = TryFindPackageInfoForRelease(releaseInfo); if (packageInfo == null) { yield return(InstallReleaseUserChoices.Install); yield break; } Assert.IsNotNull(packageInfo.InstallInfo); var packageReleaseInfo = packageInfo.InstallInfo.ReleaseInfo; Assert.IsNotNull(packageReleaseInfo); // TODO - how to handle? Assert.That(packageReleaseInfo.HasVersionCode); Assert.That(releaseInfo.HasVersionCode); IEnumerator <int> userChoice; if (packageReleaseInfo.VersionCode == releaseInfo.VersionCode) { Assert.IsEqual(releaseInfo.Version, packageReleaseInfo.Version); userChoice = _view.PromptForUserChoice( "Package '{0}' is already installed with the same version ('{1}'). Would you like to re-install it anyway? Note that any local changes you've made to the package will be reverted." .Fmt(packageReleaseInfo.Name, packageReleaseInfo.Version), new[] { "Overwrite", "Skip", "Cancel" }, null, null, 0, 2); } else if (releaseInfo.VersionCode > packageReleaseInfo.VersionCode) { userChoice = _view.PromptForUserChoice( "Package '{0}' is already installed with version '{1}'. Would you like to UPGRADE it to version '{2}'? Note that any local changes you've made to the package will be lost." .Fmt(releaseInfo.Name, packageReleaseInfo.Version, releaseInfo.Version), new[] { "Upgrade", "Skip", "Cancel" }, null, null, 0, 2); } else { Assert.That(releaseInfo.VersionCode < packageReleaseInfo.VersionCode); userChoice = _view.PromptForUserChoice( "Package '{0}' is already installed with version '{1}'. Would you like to DOWNGRADE it to version '{2}'? Note that any local changes you've made to the package will be lost." .Fmt(releaseInfo.Name, packageReleaseInfo.Version, releaseInfo.Version), new[] { "Downgrade", "Skip", "Cancel" }, null, null, 0, 2); } yield return(userChoice); switch (userChoice.Current) { case 0: { yield return(InstallReleaseUserChoices.Install); break; } case 1: { yield return(InstallReleaseUserChoices.Skip); break; } case 2: { yield return(InstallReleaseUserChoices.Cancel); break; } default: { Assert.Throw(); break; } } }