private void toolStripMenuItemDelete_Click(object sender, EventArgs e) { var selectedPage = _menuHitInfo.Page as TabPage; if (selectedPage == null) return; using (var form = new FormCustomDialog( String.Format("{0}{1}{2}", "<size=+4>Are you SURE you want to DELETE this Page?</size><br>", String.Format("<size=+2>{0}</size>", selectedPage.Page.Name), "<br><br>*All Links on this page will be removed from your site" ), new[] { new CustomDialogButtonInfo {Title = "DELETE",DialogResult = DialogResult.OK,Width = 100}, new CustomDialogButtonInfo {Title = "CANCEL",DialogResult = DialogResult.Cancel,Width = 100} } )) { form.Width = 500; form.Height = 160; if (form.ShowDialog(MainController.Instance.MainForm) != DialogResult.OK) return; selectedPage.DisposePage(); MainController.Instance.ProcessManager.Run("Deleting Page...", cancelationToken => { selectedPage.Page.Delete(DataStorage); DataStorage.Library.MarkAsModified(); DataStorage.Library.Pages.RemoveItem(selectedPage.Page); ActivePage = null; }); IsDataChanged = true; SaveData(); pnEmpty.BringToFront(); MainController.Instance.ProcessManager.RunInQueue("Loading Library...", () => MainController.Instance.MainForm.Invoke(new MethodInvoker(() => { LoadView(true); }))); } }
private void DeleteBundle() { if (SelectedBundle == null) return; var bundleToDelete = SelectedBundle; using (var form = new FormCustomDialog( String.Format("{0}{1}{2}", "<size=+4>Are you SURE you want to DELETE this Link Bundle?</size><br>", String.Format("<size=+2>{0}</size>", bundleToDelete.Name), "<br><br>*All Links to this bundle will be removed from your site" ), new[] { new CustomDialogButtonInfo {Title = "DELETE", DialogResult = DialogResult.OK, Width = 100}, new CustomDialogButtonInfo {Title = "CANCEL", DialogResult = DialogResult.Cancel, Width = 100} } )) { form.Width = 500; form.Height = 160; if (form.ShowDialog(MainController.Instance.MainForm) == DialogResult.OK) { var currentBundleIndex = gridViewBundles.FocusedRowHandle; var bundleLinks = bundleToDelete.GetLibraryLinks(); DataStateObserver.Instance.RaiseLinksDeleted(bundleLinks.Select(l => l.ExtId)); _library.LinkBundles.RemoveItem(bundleToDelete); bundleToDelete.Delete(_library.Context); LoadBundles(currentBundleIndex); RaiseDataChanged(); } } }
private void DeleteBundleItem() { if (SelectedBundleItem == null) return; using (var form = new FormCustomDialog( String.Format("{0}{1}", "<size=+4>Are you SURE you want to DELETE this bundle item?</size><br>", String.Format("<size=+2>{0}</size>", SelectedBundleItem.Name)), new[] { new CustomDialogButtonInfo {Title = "DELETE", DialogResult = DialogResult.OK, Width = 100}, new CustomDialogButtonInfo {Title = "CANCEL", DialogResult = DialogResult.Cancel, Width = 100} } )) { form.Width = 500; form.Height = 160; if (form.ShowDialog(MainController.Instance.MainForm) == DialogResult.OK) { var currentItemIndex = gridViewBundleItems.FocusedRowHandle; SelectedBundle.Settings.Items.RemoveItem(SelectedBundleItem); LoadBundleItems(currentItemIndex); RaiseDataChanged(); } } }
private void OnDragDrop(object sender, DragEventArgs e) { FolderContainer.ProcessScrollOnDragLeave(sender, e); if (!FormatState.AllowEdit) return; SelectionManager.SelectFolder(this); if (IsSourceLinksDragged) { var droppedLinks = DataDraggedOver?.GetData(DataFormats.Serializable, true) as SourceLink[] ?? new SourceLink[] { }; SelectionManager.SelectFolder(this); var fileLinks = droppedLinks.OfType<FileLink>().ToList(); var folderLinks = droppedLinks.OfType<FolderLink>().ToList(); var confirmDrop = true; if (!folderLinks.Any() && fileLinks.Count == 1 && FileFormatHelper.IsUrlFile(fileLinks.Single().Path)) { AddHyperLink(UrlLinkInfo.FromFile(fileLinks.Single().Path)); confirmDrop = false; } else if (folderLinks.Any(folderLink => fileLinks.Any(fileLink => fileLink.Path.Contains(folderLink.Path)))) { using (var form = new FormCustomDialog( String.Format("{0}{1}", "<size=+4>Are you SURE you want to Drag the Folder AND all the Files into this Window?</size><br>", "<br>It might look kind of strange to have the entire folder in this window…" ), new[] { new CustomDialogButtonInfo {Title = "Yep!", DialogResult = DialogResult.OK, Width = 100}, new CustomDialogButtonInfo {Title = "CANCEL", DialogResult = DialogResult.Cancel, Width = 100} } )) { form.Width = 500; form.Height = 160; confirmDrop = form.ShowDialog(MainController.Instance.MainForm) == DialogResult.OK; } } if (confirmDrop) InsertLinks(droppedLinks, _mouseDragOverHitInfo.RowIndex); } if (IsLinkBundleDragged) { var droppedLinkBundle = DataDraggedOver?.GetData(DataFormats.Serializable, true) as LinkBundle; AddLinkBundle(droppedLinkBundle, _mouseDragOverHitInfo.RowIndex); } var droppedRow = DataDraggedOver?.GetData(typeof(LinkRow)) as LinkRow; if (droppedRow != null) ProcessRowMoving(droppedRow, _mouseDragOverHitInfo.RowIndex); var droppedFolder = DataDraggedOver?.GetData(typeof(ClassicFolderBox)) as ClassicFolderBox; if (droppedFolder != null && droppedFolder != this) FolderContainer.ProcessFolderMoving(droppedFolder, DataSource.ColumnOrder, DataSource.RowOrder); ResetDragInfo(); }
private void DeleteFolder() { using (var form = new FormCustomDialog( String.Format("{0}{1}{2}", "<size=+4>Are you SURE you want to DELETE this Window?</size><br>", String.Format("<size=+2>{0}</size>", DataSource.Name), "<br><br>*All Links in this window will be removed from your site" ), new[] { new CustomDialogButtonInfo {Title = "DELETE",DialogResult = DialogResult.OK,Width = 100}, new CustomDialogButtonInfo {Title = "CANCEL",DialogResult = DialogResult.Cancel,Width = 100} } )) { form.Width = 500; form.Height = 160; if (form.ShowDialog(MainController.Instance.MainForm) == DialogResult.OK) FolderContainer.DeleteFolder(this); } }
private void tmiFileDelete_Click(object sender, EventArgs e) { var fileNode = treeListAllFiles.Selection[0]; var fileLink = fileNode.Tag as FileLink; if (fileLink == null) return; using (var form = new FormCustomDialog( String.Format("{0}{1}", "<size=+4>Are you SURE you want to DELETE this file from your Site Source Directory?</size>", "<br><br>* This Link will also be removed from your Site…<br>*This file is saved in z_archive…" ), new[] { new CustomDialogButtonInfo {Title = "DELETE",DialogResult = DialogResult.OK,Width = 100}, new CustomDialogButtonInfo {Title = "CANCEL",DialogResult = DialogResult.Cancel,Width = 100} } )) { form.Width = 500; form.Height = 170; if (form.ShowDialog(MainController.Instance.MainForm) != DialogResult.OK) return; if (Utils.MoveFileToArchive(fileLink.Path)) fileNode.ParentNode.Nodes.Remove(fileNode); else MainController.Instance.PopupMessages.ShowWarning("Couldn't delete file. It might be busy by another process"); } }