public static void ActivateEditor() { if (PaletteUtils.ActiveDocument == null) { return; } PaletteUtils.PostMessage(PaletteUtils.ActiveDocument.Window.Handle, 7, IntPtr.Zero, IntPtr.Zero); System.Windows.Forms.Application.DoEvents(); }
private void Application_Idle(object sender, EventArgs e) { Application.Idle -= new EventHandler(this.Application_Idle); PaletteUtils.ActivateEditor(); try { this.handler(null, e); } finally { this.Dispose(); } }
protected override void OnMouseDown(MouseEventArgs mea) { if (!base.DesignMode) { ToolStripItem item = base.GetItemAt(mea.X, mea.Y); if (item != null && (item is ToolStripButton || item is ToolStripMenuItem)) { PaletteUtils.OnEditorActivated(item, delegate(object sender, EventArgs e) { item.PerformClick(); }); return; } } base.OnMouseDown(mea); }
public static void OnCommandExecute() { if (PaletteUtils.documentContextHandler != null) { bool documentActivationEnabled = Application.DocumentManager.DocumentActivationEnabled; Application.DocumentManager.DocumentActivationEnabled = (false); try { PaletteUtils.documentContextHandler(); } finally { PaletteUtils.documentContextHandler = null; Application.DocumentManager.DocumentActivationEnabled = (documentActivationEnabled); } } }
public void SendBehind() { Document parentDocument = this.ParentDataset.ParentDocument; using (parentDocument.LockDocument()) { var transactionManager = parentDocument.TransactionManager; using (Transaction transaction = transactionManager.StartTransaction()) { BlockTable blockTable = (BlockTable)transaction.GetObject(parentDocument.Database.BlockTableId, 0); BlockTableRecord blockTableRecord = (BlockTableRecord)transaction.GetObject(blockTable[(BlockTableRecord.ModelSpace)], (OpenMode)1); DrawOrderTable drawOrderTable = (DrawOrderTable)transaction.GetObject(blockTableRecord.DrawOrderTableId, (OpenMode)1); ObjectIdCollection objectIdCollection = new ObjectIdCollection(); objectIdCollection.Add(this.RasterObjectId); drawOrderTable.MoveToBottom(objectIdCollection); parentDocument.TransactionManager.QueueForGraphicsFlush(); parentDocument.TransactionManager.FlushGraphics(); parentDocument.Editor.UpdateScreen(); transaction.Commit(); } } PaletteUtils.ActivateEditor(); }
public static void ExecuteInDocumentContext(PaletteUtils.ExecuteInDocumentContextDelegate handler) { if (handler == null) { return; } if (PaletteUtils.ActiveDocument == null) { return; } PaletteUtils.ActivateEditor(); if (!Application.DocumentManager.IsApplicationContext) { handler(); return; } if (!PaletteUtils.ActiveDocument.Editor.IsQuiescent) { throw new InvalidOperationException(AfaStrings.AutoCADIsBusy); } PaletteUtils.documentContextHandler = handler; PaletteUtils.ActiveDocument.SendStringToExecute("DOCUMENT_COMMAND\n", true, false, false); PaletteUtils.acedPostCommand(""); }