private async void Initialize() { pluginStatusText.Text = Resources.InitRuntime; Registry.Init(); logger = new Logger(); asmResolver.ExceptionOccured += (o, e) => logger.Log(LogLevel.Error, Resources.AssemblyResolverError, e.Exception); asmResolver.AssemblyLoaded += (o, e) => logger.Log(LogLevel.Debug, Resources.AssemblyResolverLoaded, e.LoadedAssembly.FullName); pluginMain = new PluginMain(pluginDirectory, logger); pluginStatusText.Text = Resources.InitCef; SanityChecker.CheckDependencyVersions(); try { CurlWrapper.Init(pluginDirectory); } catch (Exception ex) { logger.Log(LogLevel.Error, ex.ToString()); ActGlobals.oFormActMain.WriteDebugLog(ex.ToString()); } await FinishInit(); }
private void Initialize(TabPage pluginScreenSpace, Label pluginStatusText) { // Prevent a stack overflow in the assembly loaded handler by loading the logger interface early. var dummy = typeof(ILogger); Registry.Init(); logger = new Logger(); asmResolver.ExceptionOccured += (o, e) => logger.Log(LogLevel.Error, "AssemblyResolver: Error: {0}", e.Exception); asmResolver.AssemblyLoaded += (o, e) => logger.Log(LogLevel.Debug, "AssemblyResolver: Loaded: {0}", e.LoadedAssembly.FullName); pluginMain = new PluginMain(pluginDirectory, logger); if (ActGlobals.oFormActMain.Visible) { // ACT is running and this plugin was added. Immediately initialize! pluginMain.InitPlugin(pluginScreenSpace, pluginStatusText); } else { // ACT is starting up and loading plugins. Wait until it's done and the main window becomes visible before we start initializing. EventHandler initHandler = null; initHandler = (o, e) => { ActGlobals.oFormActMain.VisibleChanged -= initHandler; pluginMain.InitPlugin(pluginScreenSpace, pluginStatusText); }; ActGlobals.oFormActMain.VisibleChanged += initHandler; } }
private void Initialize(TabPage pluginScreenSpace, Label pluginStatusText) { pluginStatusText.Text = "Initializing Runtime..."; Registry.Init(); logger = new Logger(); asmResolver.ExceptionOccured += (o, e) => logger.Log(LogLevel.Error, "AssemblyResolver: Error: {0}", e.Exception); asmResolver.AssemblyLoaded += (o, e) => logger.Log(LogLevel.Debug, "AssemblyResolver: Loaded: {0}", e.LoadedAssembly.FullName); pluginMain = new PluginMain(pluginDirectory, logger); if (ActGlobals.oFormActMain.Visible) { // ACT is running and this plugin was added. Immediately initialize! InitPluginCore(pluginScreenSpace, pluginStatusText); } else { // ACT is starting up and loading plugins. Wait until it's done and the main window becomes visible before we start initializing. EventHandler initHandler = null; initHandler = (o, e) => { ActGlobals.oFormActMain.VisibleChanged -= initHandler; InitPluginCore(pluginScreenSpace, pluginStatusText); }; ActGlobals.oFormActMain.VisibleChanged += initHandler; pluginStatusText.Text = "Waiting for ACT to finish startup..."; } }
private async void Initialize(TabPage pluginScreenSpace, Label pluginStatusText) { pluginStatusText.Text = Resources.InitRuntime; Registry.Init(); logger = new Logger(); asmResolver.ExceptionOccured += (o, e) => logger.Log(LogLevel.Error, Resources.AssemblyResolverError, e.Exception); asmResolver.AssemblyLoaded += (o, e) => logger.Log(LogLevel.Debug, Resources.AssemblyResolverLoaded, e.LoadedAssembly.FullName); pluginMain = new PluginMain(pluginDirectory, logger); pluginStatusText.Text = Resources.InitCef; try { CurlWrapper.Init(pluginDirectory); } catch (Exception ex) { logger.Log(LogLevel.Error, ex.ToString()); } if (await CefInstaller.EnsureCef(GetCefPath())) { // Finally, load the html renderer. We load it here since HtmlRenderer depends on CEF which we can't load these before // the CefInstaller is done. if (SanityChecker.LoadSaneAssembly("HtmlRenderer")) { // Since this is an async method, we could have switched threds. Make sure InitPlugin() runs on the ACT main thread. ActGlobals.oFormActMain.Invoke((Action)(() => { pluginMain.InitPlugin(pluginScreenSpace, pluginStatusText); })); } else { pluginStatusText.Text = Resources.CoreOrHtmlRendererInsane; } } }