Exemplo n.º 1
0
 private void App_Idling(object sender, Autodesk.Revit.UI.Events.IdlingEventArgs e)
 {
     if (fastExecutionEnabled)
     {
         e.SetRaiseWithoutDelay();
     }
     if (!queue.IsEmpty)
     {
         using (Transaction t = new Transaction(this.app.ActiveUIDocument.Document))
         {
             if (t.Start("Async Idling Transaction") == TransactionStatus.Started)
             {
                 Task task;
                 while (queue.TryDequeue(out task))
                 {
                     task.ConfigureAwait(false);
                     task.RunSynchronously();
                 }
                 if (TransactionStatus.Committed != t.Commit())
                 {
                     t.RollBack();
                     throw new Exception("Something bad happened. Transaction failed. Rollbacked");
                 }
             }
         }
     }
 }
Exemplo n.º 2
0
 private void UiApp_Idling(object sender, Autodesk.Revit.UI.Events.IdlingEventArgs e)
 {
     if (idling < 3)
     {
         //非默认模式
         e.SetRaiseWithoutDelay();
         idling++;
     }
     ShowMessage("闲置事件:" + idling);
 }
        private void _uiApp_Idling(object sender, Autodesk.Revit.UI.Events.IdlingEventArgs e)
        {
            ActionEnum tmp = _action;

            _action = ActionEnum.None;

            e.SetRaiseWithoutDelay();

            switch (tmp)
            {
            case ActionEnum.Show:
                performShow();
                break;

            case ActionEnum.DrawRoute:
                performCreate();
                break;
            }
        }