コード例 #1
0
ファイル: HtmlToolTip.cs プロジェクト: jcaillon/3P
 private void OnImageLoad(object sender, HtmlImageLoadEventArgs e)
 {
     OnImageLoad(e);
 }
コード例 #2
0
ファイル: HtmlToolTip.cs プロジェクト: jcaillon/3P
 /// <summary>
 /// Propagate the image load event from root container.
 /// </summary>
 protected virtual void OnImageLoad(HtmlImageLoadEventArgs e)
 {
     var handler = ImageLoad;
     if (handler != null)
         handler(this, e);
     if (!e.Handled)
         YamuiThemeManager.GetHtmlImages(e);
 }
コード例 #3
0
ファイル: YamuiThemeManager.cs プロジェクト: jcaillon/3P
 /// <summary>
 /// Feeds the images to the html renderer
 /// </summary>
 internal static void GetHtmlImages(HtmlImageLoadEventArgs e)
 {
     Image img = FindImage(e.Src);
     if (img != null) {
         e.Callback(img);
         e.Handled = true;
     }
 }
コード例 #4
0
ファイル: HtmlPanel.cs プロジェクト: jcaillon/YamuiFramework
 /// <summary>
 /// Propagate the image load event from root container.
 /// </summary>
 protected virtual void OnImageLoad(HtmlImageLoadEventArgs e)
 {
     YamuiThemeManager.OnHtmlImageLoad(e);
     var handler = ImageLoad;
     if (handler != null)
         handler(this, e);
 }
コード例 #5
0
 /// <summary>
 /// Raise the image load event with the given event args.
 /// </summary>
 /// <param name="args">the event args</param>
 internal void RaiseHtmlImageLoadEvent(HtmlImageLoadEventArgs args)
 {
     try
     {
         if (ImageLoad != null)
         {
             ImageLoad(this, args);
         }
     }
     catch (Exception ex)
     {
         ReportError(HtmlRenderErrorType.Image, "Failed image load event", ex);
     }
 }
コード例 #6
0
        /// <summary>
        /// Set image of this image box by analyzing the src attribute.<br/>
        /// LoadFromRaw the image from inline base64 encoded string.<br/>
        /// Or from calling property/method on the bridge object that returns image or URL to image.<br/>
        /// Or from file path<br/>
        /// Or from URI.
        /// </summary>
        /// <remarks>
        /// File path and URI image loading is executed async and after finishing calling <see cref="ImageLoadComplete"/>
        /// on the main thread and not thread-pool.
        /// </remarks>
        /// <param name="src">the source of the image to load</param>
        /// <param name="attributes">the collection of attributes on the element to use in event</param>
        /// <returns>the image object (null if failed)</returns>
        public void LoadImage(string src, Dictionary<string, string> attributes)
        {
            try
            {
                var args = new HtmlImageLoadEventArgs(src, attributes, OnHtmlImageLoadEventCallback);
                _htmlContainer.RaiseHtmlImageLoadEvent(args);
                _asyncCallback = !_htmlContainer.AvoidAsyncImagesLoading;

                if (!args.Handled)
                {
                    if (!string.IsNullOrEmpty(src))
                    {
                        if (src.StartsWith("data:image", StringComparison.CurrentCultureIgnoreCase))
                        {
                            SetFromInlineData(src);
                        }
                        else
                        {
                            SetImageFromPath(src);
                        }
                    }
                    else
                    {
                        ImageLoadComplete(false);
                    }
                }
            }
            catch (Exception ex)
            {
                _htmlContainer.ReportError(HtmlRenderErrorType.Image, "Exception in handling image source", ex);
                ImageLoadComplete(false);
            }
        }