private void menuEditReplace_Click(object sender, EventArgs e) { IFindReplaceHandler h = this.DockPanel.ActiveContent as IFindReplaceHandler; if (h != null && h.CanShowReplaceDialog) { h.ShowReplaceDialog(); } }
public void ResetHandler(object handler) { hUndo = handler as IUndoHandler; hClip = handler as IClipboardHandler; hDelete = handler as IDeleteHandler; hSelectAll = handler as ISelectAllHandler; hFind = handler as IFindReplaceHandler; this.menuUndo.Tag = hUndo != null; this.menuRedo.Tag = hUndo != null; this.menuCut.Tag = hClip != null; this.menuCopy.Tag = hClip != null; this.menuPaste.Tag = hClip != null; this.menuDelete.Tag = hDelete != null; this.menuSelectAll.Tag = hSelectAll != null; this.menuFind.Tag = hFind != null; this.menuReplace.Tag = hFind != null; }
private void menuEdit_DropDownOpening(object sender, EventArgs e) { IUndoHandler hUndo = this.DockPanel.ActiveContent as IUndoHandler; IClipboardHandler hClip = this.DockPanel.ActiveContent as IClipboardHandler; IDeleteHandler hDelete = this.DockPanel.ActiveContent as IDeleteHandler; ISelectAllHandler hSelectAll = this.DockPanel.ActiveContent as ISelectAllHandler; IFindReplaceHandler hFind = this.DockPanel.ActiveContent as IFindReplaceHandler; if (hUndo != null) { this.menuEditUndo.Enabled = hUndo.CanUndo; this.menuEditRedo.Enabled = hUndo.CanRedo; } else { this.menuEditUndo.Enabled = false; this.menuEditRedo.Enabled = false; } if (hClip != null) { this.menuEditCut.Enabled = hClip.CanCut; this.menuEditCopy.Enabled = hClip.CanCopy; this.menuEditPaste.Enabled = hClip.CanPaste; } else { this.menuEditCut.Enabled = false; this.menuEditCopy.Enabled = false; this.menuEditPaste.Enabled = false; } if (hDelete != null) { this.menuEditDelete.Enabled = hDelete.CanDelete; } else { this.menuEditDelete.Enabled = false; } if (hSelectAll != null) { this.menuEditSelectAll.Enabled = hSelectAll.CanSelectAll; } else { this.menuEditSelectAll.Enabled = false; } if (hFind != null) { this.menuEditFind.Enabled = hFind.CanShowFindDialog; this.menuEditReplace.Enabled = hFind.CanShowReplaceDialog; } else { this.menuEditFind.Enabled = false; this.menuEditReplace.Enabled = false; } }