private Result Initialize(UIControlledApplication app) { try { LoggingService.LogInfo("Starting up application via Revit"); ResolveBrowserBinaries(); var backupAuto = new AutoModelBackupService(); var backupManual = new ManualModelBackupService(); Sidebar = new BardWebClient(app); UpdaterRegistrationService.AddRegisterableServices( backupAuto ); SocketRegistrationService.AddRegisterableServices( backupManual, Sidebar ); CreateRibbon(app); RegisterAppEvents(app); RegisterSideBar(app, Sidebar); RegisterInstallerEvents(app); LoggingService.LogInfo("Application loaded successfully"); return(Result.Succeeded); } catch (Exception e) { LoggingService.LogError("Failed to load application due to internal error:", e); TaskDialog.Show("Fatal error", $"Failed to load application due to internal exception: {e.Message}"); return(Result.Failed); } }
private void RegisterSideBar(UIControlledApplication app, BardWebClient sidebar) { try { LoggingService.LogInfo("Attempting to register Bard Client sidebar with Revit"); app.RegisterDockablePane(BardWebClient.Id, "BR+A Revit Helper", sidebar); app.ControlledApplication.DocumentOpened += sidebar.JoinRevitSession; app.ControlledApplication.DocumentOpened += sidebar.ShowSidebar; LoggingService.LogInfo("Browser binary resolution complete"); } catch (Exception e) { throw new Exception("Failed to resolve browser binaries", e); } }
public void ResolveBrowserBinaries() { try { LoggingService.LogInfo("Attempting to resolve browser binaries"); AppDomain.CurrentDomain.AssemblyResolve += BardWebClient.ResolveCefBinaries; BardWebClient.InitializeCefSharp(); LoggingService.LogInfo("Browser binary resolution complete"); } catch (Exception e) { var ex = new Exception("Fatal error! Failed to resolve browser binaries", e); throw ex; } }