private void Application_DocumentOpened(object sender, DocumentOpenedEventArgs args) { if (args.Document == null || (Path.GetTempPath().StartsWith(Path.GetDirectoryName(args.Document.PathName)) && args.Document.PathName.EndsWith(".ifc.RVT"))) { return; } try { openedDocuments.Add(args.Document, new BimbotDocument(args.Document)); BimbotDocument curDoc = openedDocuments[args.Document]; DockableResultPanel.DataContext = curDoc; DockableServicesPanel.DataContext = curDoc; ExtEvents.ChangeDocumentHandler.documentToUpdate = curDoc; // ActiveDocument = curApp.openedDocuments[args.Document]; outputPane = uiApplication.GetDockablePane(OutputPaneId); servicePane = uiApplication.GetDockablePane(ServicePaneId); ViewToggleButtonResults.IsChecked = true; ViewToggleButtonResults.IsEnabled = true; ViewToggleButtonServices.IsChecked = true; ViewToggleButtonServices.IsEnabled = true; } catch (Exception e) { MessageBox.Show("Failed to open bimbot part in document due to:\n" + e.Message); } }
public static void UpdateDocument(Document doc) { // If document exists it is already opened if (openedDocuments.ContainsKey(doc)) { BimbotDocument curDoc = openedDocuments[doc]; curApp.ExtEvents.ChangeDocumentHandler.documentToUpdate = curDoc; curApp.ExtEvents.ChangeDocumentEvent.Raise(); } }
/* * void ComponentManager_UIElementActivated(object sender, adWin.UIElementActivatedEventArgs e) * { * if (e != null && e.Item != null && e.Item.Id != null) * { * if (e.Item.Id == "ID_RESULT_BUTTON") * { * // Perform the button action * if (((adWin.RibbonToggleButton)(e.Item)).IsChecked) * outputPane.Show(); * else * outputPane.Hide(); * } * if (e.Item.Id == "ID_SERVICE_BUTTON") * { * // Perform the button action * if (((adWin.RibbonToggleButton)(e.Item)).IsChecked) * servicePane.Show(); * else * servicePane.Hide(); * } * } * } */ private void Application_ViewActivated(object sender, ViewActivatedEventArgs args) { if (args.Document == null) { return; } // If document exists it is already opened if (openedDocuments.ContainsKey(args.Document)) { BimbotDocument curDoc = openedDocuments[args.Document]; // Change the data context of viewing panels to the current document DockableResultPanel.DataContext = curDoc; DockableServicesPanel.DataContext = curDoc; ExtEvents.ChangeDocumentHandler.documentToUpdate = curDoc; } }