public override void DisablePackage() { ClearReportedMessages(); if (_addIn == null) { return; } if (_addIn.Manifest.PrimaryIdentity == "ICSharpCode.AddInManager2") { MessageService.ShowMessage("${res:AddInManager.CannotDisableAddInManager}", "${res:AddInManager.Title}"); return; } if (this.IsEnabled) { var dependentAddIns = AddInManager.Setup.GetDependentAddIns(_addIn); if ((dependentAddIns != null) && dependentAddIns.Any()) { string addInNames = ""; foreach (var dependentAddIn in dependentAddIns) { addInNames += "\t " + dependentAddIn.AddIn.Name + Environment.NewLine; } if (!MessageService.AskQuestionFormatted( "${res:AddInManager.Title}", "${res:AddInManager2.DisableDependentWarning}", _addIn.Name, addInNames)) { return; } } } AddInManager.Setup.SwitchAddInActivation(_addIn); }
private bool CanInstallPackage() { // Ask for downloading dependent packages if ((_packageOperations != null) && _packageOperations.Any()) { var operationsForDependencies = _packageOperations.Where(p => p.Package.Id != _package.Id); if ((operationsForDependencies != null) && operationsForDependencies.Any()) { string addInNames = ""; foreach (var packageOperation in operationsForDependencies) { addInNames += "\t " + packageOperation.Package.Id + " " + packageOperation.Package.Version.ToString() + Environment.NewLine; } if (!MessageService.AskQuestionFormatted( "${res:AddInManager.Title}", "${res:AddInManager2.InstallDependentMessage}", _package.Id, addInNames)) { return(false); } } } // Ask for license acceptance IEnumerable <IPackage> packages = GetPackagesRequiringLicenseAcceptance(); if (packages.Any()) { AcceptLicensesEventArgs acceptLicenses = new AcceptLicensesEventArgs(packages); acceptLicenses.IsAccepted = true; AddInManager.Events.OnAcceptLicenses(acceptLicenses); return(acceptLicenses.IsAccepted); } return(true); }
/// <summary> /// Make a request for confirmation /// </summary> /// <param name="title">The title of the confirmation message</param> /// <param name="format">The message template</param> /// <param name="args">The template values</param> /// <returns>true if confirmed, false otherwise</returns> public bool ConfirmFormatted(string title, string format, params string[] args) { if (!string.IsNullOrEmpty(title)) { return(MessageService.AskQuestionFormatted(title, format, args)); } else { return(MessageService.AskQuestionFormatted(format, args)); } }
protected override void OnBeforeSave(object sender, CancelEventArgs e) { List <string> affectedMapDefinitions = new List <string>(); var resSvc = _edsvc.CurrentConnection.ResourceService; var refs = resSvc.EnumerateResourceReferences(_edsvc.ResourceID); foreach (var r in refs.ResourceId) { ResourceIdentifier rid = new ResourceIdentifier(r); if (rid.ResourceType == ResourceTypes.LayerDefinition.ToString()) { var lrefs = resSvc.EnumerateResourceReferences(r); foreach (var lr in lrefs.ResourceId) { ResourceIdentifier rid2 = new ResourceIdentifier(lr); if (rid2.ResourceType == ResourceTypes.MapDefinition.ToString()) { var mdf = (IMapDefinition)resSvc.GetResource(lr); if (mdf.BaseMap != null) { foreach (var blg in mdf.BaseMap.BaseMapLayerGroups) { foreach (var bl in blg.BaseMapLayer) { if (bl.ResourceId.Equals(r)) { affectedMapDefinitions.Add(r); } } } } } } } } if (affectedMapDefinitions.Count > 0) { if (!MessageService.AskQuestionFormatted(Strings.Confirm, Strings.ConfirmBaseMapInvalidationFeatureSourceSave, string.Join(Environment.NewLine, affectedMapDefinitions.ToArray()) + Environment.NewLine)) { e.Cancel = true; return; } } base.OnBeforeSave(sender, e); }
void RemoveButtonClick(object sender, EventArgs e) { if (listBox.Items.Count == 1) { MessageService.ShowMessage("You cannot delete all configurations/platforms."); } string name = listBox.SelectedItem.ToString(); if (MessageService.AskQuestionFormatted("Do you really want to remove '{0}'?", new string[] { name })) { if (project != null) { Remove(project, name, editPlatforms); } else { Remove(solution, name, editPlatforms); } InitList(); } }
public static bool RenameMember(IMember member, string newName) { List <Reference> list; using (AsynchronousWaitDialog monitor = AsynchronousWaitDialog.ShowWaitDialog("${res:SharpDevelop.Refactoring.Rename}")) { list = RefactoringService.FindReferences(member, monitor); if (list == null) { return(false); } FindReferencesAndRenameHelper.RenameReferences(list, newName); } if (member is IField) { IProperty property = FindProperty((IField)member); if (property != null) { string newPropertyName = member.DeclaringType.ProjectContent.Language.CodeGenerator.GetPropertyName(newName); if (newPropertyName != newName && newPropertyName != property.Name) { if (MessageService.AskQuestionFormatted("${res:SharpDevelop.Refactoring.Rename}", "${res:SharpDevelop.Refactoring.RenameFieldAndProperty}", property.FullyQualifiedName, newPropertyName)) { using (AsynchronousWaitDialog monitor = AsynchronousWaitDialog.ShowWaitDialog("${res:SharpDevelop.Refactoring.Rename}")) { list = RefactoringService.FindReferences(property, monitor); if (list != null) { FindReferencesAndRenameHelper.RenameReferences(list, newPropertyName); } } } } } } return(true); }
void RemoveButtonClick(object sender, EventArgs e) { if (listBox.Items.Count == 1) { MessageService.ShowMessage("${res:Dialog.EditAvailableConfigurationsDialog.CannotDeleteAllConfigurationsOrPlatforms}"); return; } string name = listBox.SelectedItem.ToString(); if (MessageService.AskQuestionFormatted("${res:Dialog.EditAvailableConfigurationsDialog.ConfirmRemoveConfigurationOrPlatform}", new string[] { name })) { if (project != null) { Remove(project, name, editPlatforms); } else { Remove(solution, name, editPlatforms); } InitList(); } }