private void OnStylesheetLoad(object sender, HtmlStylesheetLoadEventArgs e) { if (CheckAccess()) { OnStylesheetLoad(e); } else { Dispatcher.UIThread.InvokeAsync(() => OnStylesheetLoad(e)).Wait(); } }
private void OnStylesheetLoad(object sender, HtmlStylesheetLoadEventArgs e) { if (CheckAccess()) { OnStylesheetLoad(e); } else { Dispatcher.Invoke(new Action <HtmlStylesheetLoadEventArgs>(OnStylesheetLoad), e); } }
/// <summary> /// Raise the stylesheet load event with the given event args. /// </summary> /// <param name="args">the event args</param> internal void RaiseHtmlStylesheetLoadEvent(HtmlStylesheetLoadEventArgs args) { try { if (StylesheetLoad != null) { StylesheetLoad(this, args); } } catch (Exception ex) { ReportError(HtmlRenderErrorType.CssParsing, "Failed stylesheet load event", ex); } }
protected override void OnStylesheetLoad(HtmlStylesheetLoadEventArgs e) { string styleSheetFilePath = GetFullPath(ChapterContent.HtmlFilePath, e.Src); string styleSheetContent; if (ChapterContent.StyleSheets.TryGetValue(styleSheetFilePath, out styleSheetContent)) { e.SetStyleSheet = styleSheetContent; } base.OnStylesheetLoad(e); }
/// <summary> /// Raise the stylesheet load event with the given event args. /// </summary> /// <param name="args">the event args</param> internal void RaiseHtmlStylesheetLoadEvent(HtmlStylesheetLoadEventArgs args) { try { EventHandler <HtmlStylesheetLoadEventArgs> handler = this.StylesheetLoad; if (handler != null) { handler(this, args); } } catch (Exception ex) { this.ReportError(HtmlRenderErrorType.CssParsing, "Failed stylesheet load event", ex); } }
private void OnStylesheetLoad(object sender, HtmlStylesheetLoadEventArgs e) { // e.SetStyleSheet = e.Src == null // ? e.Src // : @"h1, h2, h3 { color: navy; font-weight:normal; } // h1 { margin-bottom: .47em } // h2 { margin-bottom: .3em } // h3 { margin-bottom: .4em } // ul { margin-top: .5em } // ul li {margin: .25em} // body { font:10pt Tahoma } // pre { border:solid 1px gray; background-color:#eee; padding:1em } // a:link { text-decoration: none; } // a:hover { text-decoration: underline; } // .gray { color:gray; } // .example { background-color:#efefef; corner-radius:5px; padding:0.5em; } // .whitehole { background-color:white; corner-radius:10px; padding:15px; } // .caption { font-size: 1.1em } // .comment { color: green; margin-bottom: 5px; margin-left: 3px; } // .comment2 { color: green; }"; }
/// <summary> /// LoadFromRaw stylesheet data from the given source.<br/> /// The source can be local file or web URI.<br/> /// First raise <see cref="HtmlStylesheetLoadEventArgs"/> event to allow the client to overwrite the stylesheet loading.<br/> /// If the stylesheet is downloaded from URI we will try to correct local URIs to absolute.<br/> /// </summary> /// <param name="htmlContainer">the container of the html to handle load stylesheet for</param> /// <param name="src">the source of the element to load the stylesheet by</param> /// <param name="attributes">the attributes of the link element</param> /// <param name="stylesheet">return the stylesheet string that has been loaded (null if failed or <paramref name="stylesheetData"/> is given)</param> /// <param name="stylesheetData">return stylesheet data object that was provided by overwrite (null if failed or <paramref name="stylesheet"/> is given)</param> public static void LoadStylesheet(HtmlContainerInt htmlContainer, string src, Dictionary<string, string> attributes, out string stylesheet, out CssData stylesheetData) { ArgChecker.AssertArgNotNull(htmlContainer, "htmlContainer"); stylesheet = null; stylesheetData = null; try { var args = new HtmlStylesheetLoadEventArgs(src, attributes); htmlContainer.RaiseHtmlStylesheetLoadEvent(args); if (!string.IsNullOrEmpty(args.SetStyleSheet)) { stylesheet = args.SetStyleSheet; } else if (args.SetStyleSheetData != null) { stylesheetData = args.SetStyleSheetData; } else if (args.SetSrc != null) { stylesheet = LoadStylesheet(htmlContainer, args.SetSrc); } else { stylesheet = LoadStylesheet(htmlContainer, src); } } catch (Exception ex) { htmlContainer.ReportError(HtmlRenderErrorType.CssParsing, "Exception in handling stylesheet source", ex); } }
/// <summary> /// Propagate the stylesheet load event from root container. /// </summary> protected virtual void OnStylesheetLoad(HtmlStylesheetLoadEventArgs e) => RaiseRouted(StylesheetLoadEvent, e);
private void OnStylesheetLoad(object sender, HtmlStylesheetLoadEventArgs e) { OnStylesheetLoad(e); }
/// <summary> /// Propagate the stylesheet load event from root container. /// </summary> protected virtual void OnStylesheetLoad(HtmlStylesheetLoadEventArgs e) { RoutedEventArgs newEventArgs = new RoutedEvenArgs <HtmlStylesheetLoadEventArgs>(StylesheetLoadEvent, this, e); RaiseEvent(newEventArgs); }
/// <summary> /// Propagate the stylesheet load event from root container. /// </summary> protected virtual void OnStylesheetLoad(HtmlStylesheetLoadEventArgs e) { var handler = StylesheetLoad; if (handler != null) handler(this, e); }
/// <summary> /// Propagate the stylesheet load event from root container. /// </summary> protected virtual void OnStylesheetLoad(HtmlStylesheetLoadEventArgs e) { StylesheetLoad?.Invoke(this, e); }
/// <summary> /// Handle stylesheet resolve. /// </summary> void OnStylesheetLoad(object sender, HtmlStylesheetLoadEventArgs e) { AltGUIHelper.HtmlRendererTools.OnStylesheetLoad(sender, e); }