void AppDialogShowing(object sender, RevitDialogEvents.DialogBoxShowingEventArgs args)
        {
            int dialogId = args.HelpId;

            String promptInfo = "A Revit dialog will be opened.\n";

            promptInfo += "The help id of this dialog is " + dialogId.ToString() + "\n";
            promptInfo += "If you don't want the dialog to open, please press cancel button";

            TaskDialog taskDialog = new TaskDialog("Revit");

            taskDialog.MainContent = promptInfo;
            TaskDialogCommonButtons buttons = TaskDialogCommonButtons.Ok |
                                              TaskDialogCommonButtons.Cancel;

            taskDialog.CommonButtons = buttons;
            TaskDialogResult result = taskDialog.Show();

            if (TaskDialogResult.Cancel == result)
            {
                args.OverrideResult(1);
            }
            else
            {
                args.OverrideResult(0);
            }
        }
Esempio n. 2
0
 void UIControlledApplication_DialogBoxShowing(object sender, Autodesk.Revit.UI.Events.DialogBoxShowingEventArgs e)
 {
     if (e is TaskDialogShowingEventArgs args)
     {
         //对于对话框 "打印 - 着色视图的设置已修改", 即使不在批处理模式下也不允许其显示, 避免影响手工转换输出
         if (args.DialogId == @"TaskDialog_Printing_Setting_Changed_For_Shaded_Views")
         {
             args.OverrideResult(8); //关闭
         }
     }
 }
Esempio n. 3
0
        public static void HandleDialogBoxShowing(object sender, Autodesk.Revit.UI.Events.DialogBoxShowingEventArgs e)
        {
            TaskDialogShowingEventArgs taskEvent = e as TaskDialogShowingEventArgs;
            MessageBoxShowingEventArgs msgEvent  = e as MessageBoxShowingEventArgs;

            try
            {
                if (taskEvent != null)
                {
                    //  Click OK
                    string dialogId = taskEvent.DialogId;
                    int    helpId   = taskEvent.HelpId;
                    string message  = taskEvent.Message;
                    LogFileManager.AppendLog("TaskDialog Message", message);
                    taskEvent.OverrideResult((int)WinForms.DialogResult.OK);
                }
                else if (msgEvent != null)
                {
                    int    okid       = (int)WinForms.DialogResult.OK;
                    int    dialogType = msgEvent.DialogType;
                    int    helpId     = msgEvent.HelpId;
                    string message    = msgEvent.Message;
                    LogFileManager.AppendLog("MessageBox Message", message);
                    msgEvent.OverrideResult(okid);
                }
                else
                {
                    LogFileManager.AppendLog("Windows MessageBox Id", e.HelpId.ToString());
                    e.OverrideResult(1);
                }
            }
            catch (Exception ex)
            {
                string message = ex.Message;
            }
        }
Esempio n. 4
0
 public void UIApplication_DialogBoxShowing(object sender, Autodesk.Revit.UI.Events.DialogBoxShowingEventArgs e)
 {
     ExecuteEventHooks(EventType.UIApplication_DialogBoxShowing, sender, e);
 }