Пример #1
0
        public void ShowWindow(UIApplication uiapp)
        {
            try
            {
                if (mainWindow == null)
                {
                    Document doc = uiapp.ActiveUIDocument.Document;
                    SheetManagerConfiguration config    = DataStorageUtil.GetConfiguration(doc);
                    AddInViewModel            viewModel = new AddInViewModel(config);
                    viewModel.Handler  = new SheetManagerHandler(uiapp);
                    viewModel.ExtEvent = ExternalEvent.Create(viewModel.Handler);

                    SheetUpdater.IsSheetManagerOn    = true;
                    RevisionUpdater.IsSheetManagerOn = true;

                    mainWindow             = new MainWindow();
                    mainWindow.DataContext = viewModel;
                    mainWindow.Closed     += WindowClosed;
                    mainWindow.Show();
                }
            }
            catch (Exception ex)
            {
                string message = ex.Message;
            }
        }
Пример #2
0
 public void DocumentClosing(object sender, DocumentClosingEventArgs args)
 {
     try
     {
         Document doc = args.Document;
         if (null != doc)
         {
             //unregister updater
             SheetManagerConfiguration config = DataStorageUtil.GetConfiguration(doc);
             bool unregistered = UpdaterUtil.UnregisterUpdaters(doc, config);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Failed to unregister updater.\n" + ex.Message, "Sheet Manager : Unregister Updater", MessageBoxButton.OK, MessageBoxImage.Warning);
     }
 }
Пример #3
0
        public Result Execute(ExternalCommandData commandData, ref string message, Autodesk.Revit.DB.ElementSet elements)
        {
            try
            {
                m_app = commandData.Application;
                m_doc = m_app.ActiveUIDocument.Document;

                KeynotePanel         keynoteWindow = new KeynotePanel();
                KeynoteConfiguration configuration = DataStorageUtil.GetConfiguration(m_doc);
                configuration.ProjectId    = "4b5dcbfe-c438-4fb8-a9f9-cbc7537e8fc9";
                configuration.KeynoteSetId = "02234469-3d3d-44f3-9aea-0eb1a5d286f7";
                keynoteWindow.DataContext  = new KeynoteViewModel(m_app, configuration);
                if ((bool)keynoteWindow.ShowDialog())
                {
                }
            }
            catch (Exception ex)
            {
                message = ex.Message;
            }
            return(Result.Succeeded);
        }
Пример #4
0
 public void DocumentOpened(object sender, DocumentOpenedEventArgs args)
 {
     try
     {
         Document doc = args.Document;
         if (null != doc)
         {
             SheetManagerConfiguration config = DataStorageUtil.GetConfiguration(doc);
             if (config.AutoUpdate && !string.IsNullOrEmpty(config.DatabaseFile))
             {
                 if (File.Exists(config.DatabaseFile))
                 {
                     //register updater
                     bool registered = UpdaterUtil.RegisterUpdaters(doc, config);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Failed to trigger the document opened event.\n" + ex.Message, "Document Opened Event", MessageBoxButton.OK, MessageBoxImage.Warning);
     }
 }