<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: DialogBoxShowing event not firing when model is opened. in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/dialogboxshowing-event-not-firing-when-model-is-opened/m-p/6538259#M63486</link>
    <description>&lt;P&gt;I'm using a similar handler and it works. The code is different than yours. I sort of recall starting out like yours but having do write it this way. Notice the "ControlledApplication" between the "a" and the "DocumentOpened" event name. Your code is missing that. Maybe that is what is wrong?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt; public Result OnStartup(UIControlledApplication a) {
            _app = this;
            AddBeThisTo_WTA_Ribbon(a);

            /// Subscribe to doc open event so that a user set
            /// default workset can be set
            a.ControlledApplication.DocumentOpened +=
            new EventHandler&amp;lt;DocumentOpenedEventArgs&amp;gt;(a_DocumentOpened);
            return Result.Succeeded;
        }&lt;/PRE&gt;</description>
    <pubDate>Fri, 02 Sep 2016 03:28:59 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2016-09-02T03:28:59Z</dc:date>
    <item>
      <title>DialogBoxShowing event not firing when model is opened.</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/dialogboxshowing-event-not-firing-when-model-is-opened/m-p/6506605#M63485</link>
      <description>&lt;P&gt;After smashing my face against this problem and pouring through the API documentation/building coder blog I'm stumped. I can't get the DialogBoxShowing event to fire while opening a document, either manually or via the API. Note that this is very similar to the problem mentioned here: &lt;A href="http://forums.autodesk.com/t5/revit-api/dialogboxshowing-event-not-firing-when-model-is-opened/m-p/5578594#M9479" target="_blank"&gt;http://forums.autodesk.com/t5/revit-api/dialogboxshowing-event-not-firing-when-model-is-opened/m-p/5578594#M9479&lt;/A&gt; If I'm reading the answer correctly, the problem could not be reproduced, so I've tried to boil the problem down to a few simple reproducible steps.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Steps:&lt;/P&gt;&lt;P&gt;1. Create a new RVT file.&lt;/P&gt;&lt;P&gt;2. Create a new blank DWG file.&lt;/P&gt;&lt;P&gt;3. Link the DWG file into the RVT file, you will get a warning&amp;nbsp;"Import detected no valid elements in the file's Model space. Do you want to import from the Paper space?" This will also trigger the DialogBoxShowing event.&lt;/P&gt;&lt;P&gt;4. Save the RVT and close.&lt;/P&gt;&lt;P&gt;5. Open the RVT file you just created. You'll get the same warning, but no event will trigger.&lt;/P&gt;&lt;P&gt;6. Run the code below, using OpenDoucmentFile. Same thing, warning, no event.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the code I am also using to reproduce this behavior:&lt;/P&gt;&lt;PRE&gt;using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Autodesk.Revit;
using Autodesk.Revit.ApplicationServices;
using Autodesk.Revit.DB;
using Autodesk.Revit.DB.Events;
using Autodesk.Revit.UI;
using Autodesk.Revit.UI.Events;
using System.Management;

namespace Dialog
{
    [Autodesk.Revit.Attributes.Regeneration(Autodesk.Revit.Attributes.RegenerationOption.Manual)]
    [Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Automatic)]

    public class Class1 : IExternalApplication
    {
        public Autodesk.Revit.UI.Result OnStartup(UIControlledApplication application)
        {
            MessageBox.Show("Registering event handler");
                application.DialogBoxShowing += new EventHandler&amp;lt;DialogBoxShowingEventArgs&amp;gt;(HandleDialogBoxShowing);
                application.ControlledApplication.ApplicationInitialized += new EventHandler&amp;lt;ApplicationInitializedEventArgs&amp;gt;(appinitialized);
                return Result.Succeeded;
        }
        public static void HandleDialogBoxShowing(object sender, Autodesk.Revit.UI.Events.DialogBoxShowingEventArgs dialogargs)
        {
            TaskDialogShowingEventArgs taskargs = dialogargs as TaskDialogShowingEventArgs;
            MessageBox.Show("Dialog about to show.");
        }
        public static void appinitialized(object sender, ApplicationInitializedEventArgs e)
        {
            Document doc = null;
            Autodesk.Revit.ApplicationServices.Application applin = sender as Autodesk.Revit.ApplicationServices.Application;
            UIApplication uiApp = new UIApplication(applin);
            doc = uiApp.Application.OpenDocumentFile(@"C:\not showing.rvt");
        }
        public Autodesk.Revit.UI.Result OnShutdown(UIControlledApplication application)
        {
            return Autodesk.Revit.UI.Result.Succeeded;
        }

    }
}&lt;/PRE&gt;&lt;P&gt;I would really like to be able to handle this message but I can't get the event to trigger. Is this intended behavior? Any work around anyone has come across?&lt;/P&gt;</description>
      <pubDate>Wed, 17 Aug 2016 20:49:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/dialogboxshowing-event-not-firing-when-model-is-opened/m-p/6506605#M63485</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-08-17T20:49:19Z</dc:date>
    </item>
    <item>
      <title>Re: DialogBoxShowing event not firing when model is opened.</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/dialogboxshowing-event-not-firing-when-model-is-opened/m-p/6538259#M63486</link>
      <description>&lt;P&gt;I'm using a similar handler and it works. The code is different than yours. I sort of recall starting out like yours but having do write it this way. Notice the "ControlledApplication" between the "a" and the "DocumentOpened" event name. Your code is missing that. Maybe that is what is wrong?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt; public Result OnStartup(UIControlledApplication a) {
            _app = this;
            AddBeThisTo_WTA_Ribbon(a);

            /// Subscribe to doc open event so that a user set
            /// default workset can be set
            a.ControlledApplication.DocumentOpened +=
            new EventHandler&amp;lt;DocumentOpenedEventArgs&amp;gt;(a_DocumentOpened);
            return Result.Succeeded;
        }&lt;/PRE&gt;</description>
      <pubDate>Fri, 02 Sep 2016 03:28:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/dialogboxshowing-event-not-firing-when-model-is-opened/m-p/6538259#M63486</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-09-02T03:28:59Z</dc:date>
    </item>
    <item>
      <title>Re: DialogBoxShowing event not firing when model is opened.</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/dialogboxshowing-event-not-firing-when-model-is-opened/m-p/6539894#M63487</link>
      <description>&lt;P&gt;Sorry, ignore what I posted. The DialogBoxShowing event is not at the ControlledApplication.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Sep 2016 18:09:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/dialogboxshowing-event-not-firing-when-model-is-opened/m-p/6539894#M63487</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-09-02T18:09:35Z</dc:date>
    </item>
    <item>
      <title>Re: DialogBoxShowing event not firing when model is opened.</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/dialogboxshowing-event-not-firing-when-model-is-opened/m-p/6544404#M63488</link>
      <description>&lt;P&gt;Thank you for trying. I hope this thread at least caught the attention of someone who can log it as a bug.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Sep 2016 13:44:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/dialogboxshowing-event-not-firing-when-model-is-opened/m-p/6544404#M63488</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-09-06T13:44:31Z</dc:date>
    </item>
  </channel>
</rss>

