
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
So I want to run postcommand twice after the modeless form however i need to tell the postcommand that the modeless form is closed otherwise they open simultaneously. The only method i can think of is to call a child command from my modeless dialog however that uses an external event handler so is that violating the requirement to not call a post command in this situation?
//SHOW MODELESS FORM - Do stuff, close form and then run post command twice
ribbonapp.thisApp.ShowModelessForm(commandData.Application);
//Subscribe
uiApp.DialogBoxShowing += new EventHandler<DialogBoxShowingEventArgs>(OnDialogShowing);
//Call the post commmand
uiApp.PostCommand(RevitCommandId.LookupPostableCommandId(PostableCommand.PurgeUnused));
//unsubscribe
uiApp.DialogBoxShowing -= new EventHandler<DialogBoxShowingEventArgs>(OnDialogShowing);
//get the confirmation that the post command dialog has been shown, to call the command twice or thrice...
private void OnDialogShowing(object sender, DialogBoxShowingEventArgs e)
{
bool isConfirm = e.DialogId.Equals("Dialog_Revit_PurgeUnusedTree");
if (isConfirm)
{
Dialog_count++;
}
}
Solved! Go to Solution.