public DocumentWindow(IServiceProvider serviceProvider, Microsoft.Matrix.Core.Documents.Document document) : base(serviceProvider) { if (document == null) { throw new ArgumentNullException("document"); } this._document = document; try { base.SuspendLayout(); this.InitializeUserInterface(); this._documentView = this.CreateDocumentView(); } finally { base.ResumeLayout(true); } this._documentView.DocumentChanged += new EventHandler(this.OnDocumentViewDocumentChanged); this._viewCommandHandler = this._documentView as ICommandHandler; this._viewToolboxClient = this._documentView as IToolboxClient; this._viewSelectionContainer = this._documentView as ISelectionContainer; IDesigner designer = ((IDesignerHost) serviceProvider.GetService(typeof(IDesignerHost))).GetDesigner(document); this._designerCommandHandler = designer as ICommandHandler; this._contextCommandHandler = this._document.ProjectItem.Project; this.UpdateCaption(); }
protected override void Dispose(bool disposing) { if (disposing) { this._viewCommandHandler = null; this._documentView.DocumentChanged -= new EventHandler(this.OnDocumentViewDocumentChanged); this.DisposeDocumentView(); this._documentView = null; this._designerCommandHandler = null; this._contextCommandHandler = null; this._document = null; } base.Dispose(disposing); }
protected internal bool UpdateCommand(ICommandHandler[] handlers, ICommandHandlerWithContext contextHandler, object context) { this._handler = null; this._contextHandler = null; this._contextObject = null; if (contextHandler.UpdateCommand(this, context)) { this._contextHandler = contextHandler; this._contextObject = context; return true; } return this.UpdateCommand(handlers); }
protected internal virtual bool UpdateCommand(ICommandHandler[] handlers) { this._handler = null; this._contextHandler = null; this._contextObject = null; for (int i = 0; i < handlers.Length; i++) { if (handlers[i].UpdateCommand(this)) { this._handler = handlers[i]; return true; } } this.Enabled = false; return false; }
private void OnContextMenuClose(object sender, EventArgs e) { this._contextCommandHandler = null; this._contextObject = null; }
void ICommandManager.ShowContextMenu(Type commandGroup, int menuID, ICommandHandlerWithContext commandHandler, object context, Control referenceControl, Point location) { if ((commandGroup == null) || (this._contextMenus == null)) { throw new ArgumentException("commandGroup"); } IDictionary dictionary = (IDictionary) this._contextMenus[commandGroup]; if (dictionary == null) { throw new ArgumentException("commandGroup"); } MxContextMenu menu = (MxContextMenu) dictionary[menuID]; if (menu == null) { throw new ArgumentException("menuID"); } this._contextCommandHandler = commandHandler; this._contextObject = context; menu.Show(referenceControl, location.X, location.Y); }