public void RemoveSolutionItem (SolutionItem item) { string question = GettextCatalog.GetString ("Do you really want to remove project '{0}' from '{1}'?", item.Name, item.ParentFolder.Name); string secondaryText = GettextCatalog.GetString ("The Remove option remove the project from the solution, but it will not physically delete any file from disk."); SolutionEntityItem prj = item as SolutionEntityItem; if (prj == null) { if (MessageService.Confirm (question, AlertButton.Remove) && IdeApp.Workspace.RequestItemUnload (item)) RemoveItemFromSolution (prj); return; } AlertButton delete = new AlertButton (GettextCatalog.GetString ("Delete from Disk")); AlertButton result = MessageService.AskQuestion (question, secondaryText, delete, AlertButton.Cancel, AlertButton.Remove); if (result == delete) { if (!IdeApp.Workspace.RequestItemUnload (prj)) return; ConfirmProjectDeleteDialog dlg = new ConfirmProjectDeleteDialog (prj); if (MessageService.RunCustomDialog (dlg) == (int) Gtk.ResponseType.Ok) { // Remove the project before removing the files to avoid unnecessary events RemoveItemFromSolution (prj); List<FilePath> files = dlg.GetFilesToDelete (); dlg.Destroy (); using (IProgressMonitor monitor = new MessageDialogProgressMonitor (true)) { monitor.BeginTask (GettextCatalog.GetString ("Deleting Files..."), files.Count); foreach (FilePath file in files) { try { if (Directory.Exists (file)) FileService.DeleteDirectory (file); else FileService.DeleteFile (file); } catch (Exception ex) { monitor.ReportError (GettextCatalog.GetString ("The file or directory '{0}' could not be deleted.", file), ex); } monitor.Step (1); } monitor.EndTask (); } } else dlg.Destroy (); } else if (result == AlertButton.Remove && IdeApp.Workspace.RequestItemUnload (prj)) { RemoveItemFromSolution (prj); } }
protected virtual void OnButton24Clicked (object sender, System.EventArgs e) { var dialog = new SelectFileDialog (GettextCatalog.GetString ("Add items to toolbox")) { SelectMultiple = true, TransientFor = this, }; dialog.AddFilter (null, "*.dll"); if (dialog.Run ()) { indexModified = true; // Add the new files to the index using (var monitor = new MessageDialogProgressMonitor (true, false, false, true)) { monitor.BeginTask (GettextCatalog.GetString ("Looking for components..."), dialog.SelectedFiles.Length); foreach (string s in dialog.SelectedFiles) { var cif = index.AddFile (s); monitor.Step (1); if (cif != null) { // Select all new items by default foreach (var it in cif.Components) currentItems.Add (it, it); } else MessageService.ShowWarning (GettextCatalog.GetString ("The file '{0}' does not contain any component.", s)); } } Fill (); } }