public Result OnStartup(UIControlledApplication application) { var appPanel = application.CreateRibbonPanel(Tab.AddIns, "HLApps"); var showAppBtn = new PushButtonData("hleaPublishToGraph", "Publish to Graph", System.Reflection.Assembly.GetExecutingAssembly().Location, typeof(GraphAppShowCommand).FullName); showAppBtn.ToolTip = "Publish the current Revit model to a graph database"; appPanel.AddItem(showAppBtn); var syncBtn = new PushButtonData("hleaSyncWithGraph", "Pull Changes", System.Reflection.Assembly.GetExecutingAssembly().Location, typeof(RevitGraphSyncCommand).FullName); appPanel.AddItem(syncBtn); //TODO: persist settings with local storage SessionSettings = new RevitToGraphPublisherSettings(); RevitEventDispatcher.Init(); var streamConsumer = new RevitStreamConsumer(); var bc = new BuildingGraphClient(@"http://localhost:4002/graphql", null); var spacesEsh = new ElementStreamHandler(RevitEventDispatcher.Current, bc); streamConsumer.StreamHandlers.Add(spacesEsh); streamConsumer.Start(); return(Result.Succeeded); }
public static void Init() { if (Current != null) { Current._extEvent.Dispose(); } Current = new RevitEventDispatcher(); }