Example #1
0
 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();
     }
 }
        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();
        }
Example #3
0
 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("");
 }