public CSLProcessorOutputConsumer(string script_directory, string citations_javascript, BibliographyReadyDelegate brd, object user_argument) { WPFDoEvents.AssertThisCodeIsRunningInTheUIThread(); this.citations_javascript = citations_javascript; this.brd = brd; this.user_argument = user_argument; // Create the browser Logging.Info("Creating web browser for InCite CSL processing"); web_browser = new GeckoWebBrowser(); web_browser.CreateControl(); // Add the name of the script to run script_directory = Path.GetFullPath(Path.Combine(script_directory, @"runengine.html")); script_directory = script_directory.Replace(@"\\", @"\"); script_directory = script_directory.Replace(@"//", @"/"); Uri uri = new Uri(script_directory); Logging.Info("CSLProcessorOutputConsumer is about to browse to {0}", uri); // This is the only way we can communicate from JavaScript to .NET!! web_browser.EnableConsoleMessageNotfication(); web_browser.ConsoleMessage += web_browser_ConsoleMessage; // Kick off citeproc computation web_browser.Navigate(uri.ToString()); }
public CSLProcessorOutputConsumer(string script_directory, string citations_javascript, BibliographyReadyDelegate brd, object user_argument) { this.citations_javascript = citations_javascript; this.brd = brd; this.user_argument = user_argument; // Create the browser Logging.Info("Creating web browser"); web_browser = new GeckoWebBrowser(); web_browser.CreateControl(); // Add the name of the script to run script_directory = script_directory + "\\runengine.html"; script_directory = script_directory.Replace("\\\\", "\\"); script_directory = script_directory.Replace("//", "/"); Uri uri = new Uri(script_directory); Logging.Info("CSLProcessorOutputConsumer is about to browse to " + uri); // This is the only way we can communicate from JavaScript to .NET!! web_browser.EnableConsoleMessageNotfication(); web_browser.ConsoleMessage += web_browser_ConsoleMessage; // Kick off citeproc computation web_browser.Navigate(uri.ToString()); }
protected virtual void Dispose(bool disposing) { Logging.Debug("CSLProcessorOutputConsumer::Dispose({0}) @{1}", disposing, dispose_count); WPFDoEvents.InvokeInUIThread(() => { WPFDoEvents.SafeExec(() => { if (dispose_count == 0) { // Get rid of managed resources web_browser?.Dispose(); } }); WPFDoEvents.SafeExec(() => { web_browser = null; brd = null; user_argument = null; }); WPFDoEvents.SafeExec(() => { position_to_inline.Clear(); inline_to_positions.Clear(); position_to_text.Clear(); bibliography.Clear(); logs.Clear(); }); ++dispose_count; }); }
protected virtual void Dispose(bool disposing) { Logging.Debug("CSLProcessorOutputConsumer::Dispose({0}) @{1}", disposing, dispose_count); try { if (dispose_count == 0) { // Get rid of managed resources web_browser?.Dispose(); } web_browser = null; brd = null; user_argument = null; position_to_inline.Clear(); inline_to_positions.Clear(); position_to_text.Clear(); bibliography.Clear(); logs.Clear(); } catch (Exception ex) { Logging.Error(ex); } ++dispose_count; }