상속: IWin32Window
예제 #1
0
        public Result OnStartup(UIControlledApplication application)
        {
            documentLoaded = false;

            try
            {
                process = Process.GetCurrentProcess();
                handle = process.MainWindowHandle;
                revitWindowHandle = new RevitWindowHandle(handle);

                uiCtrlApp = application;
                app = uiCtrlApp.ControlledApplication;

                app.DocumentOpened += ((object o, DocumentOpenedEventArgs e) =>
                {
                    UpdateDocument(e.Document);
                    documentLoaded = true;
                    ShowDialog();
                });

                app.DocumentClosed += ((object o, DocumentClosedEventArgs e) =>
                {
                    documentLoaded = false;
                });

                uiCtrlApp.ViewActivated += ((object o, ViewActivatedEventArgs e) =>
                {
                    if (documentLoaded)
                    {
                        UpdateActiveView(e);
                        ShowDialog();
                    }
                });
            }
            catch (Exception)
            {
                return Result.Failed;
            }

            return Result.Succeeded;
        }
예제 #2
0
        public Result OnStartup(UIControlledApplication application)
        {
            documentLoaded = false;

            try
            {
                process           = Process.GetCurrentProcess();
                handle            = process.MainWindowHandle;
                revitWindowHandle = new RevitWindowHandle(handle);

                uiCtrlApp = application;
                app       = uiCtrlApp.ControlledApplication;

                app.DocumentOpened += ((object o, DocumentOpenedEventArgs e) =>
                {
                    UpdateDocument(e.Document);
                    documentLoaded = true;
                    ShowDialog();
                });

                app.DocumentClosed += ((object o, DocumentClosedEventArgs e) =>
                {
                    documentLoaded = false;
                });

                uiCtrlApp.ViewActivated += ((object o, ViewActivatedEventArgs e) =>
                {
                    if (documentLoaded)
                    {
                        UpdateActiveView(e);
                        ShowDialog();
                    }
                });
            }
            catch (Exception)
            {
                return(Result.Failed);
            }

            return(Result.Succeeded);
        }