コード例 #1
0
        /// <summary>Gets the OneAll sharing display script for the currently initialized OneAll domain.</summary>
        /// <param name="page">The <see cref="Page" /> being executed.</param>
        /// <param name="style">The desired button style.</param>
        /// <param name="socialInsights">True to enable social insights and measure referral traffic.</param>
        /// <param name="titleFormat">The format for the button title, example: "Send to {0}" where "{0}" will be the provider name.</param>
        /// <param name="shareUrl">A custom URL to share, or null to share the URL of the page executing this script.</param>
        /// <param name="providers">The providers to be displayed.</param>
        /// <returns>A string of HTML to cause the sharing API to be rendered.</returns>
        public static string OneAllSharingDisplayScript(this Page page, OneAllButtonStyle style, bool socialInsights, string titleFormat, Uri shareUrl, params Provider[] providers)
        {
            string retVal = string.Empty;

            if (page != null)
            {
                retVal = ExtensionImplementations.OneAllSharingDisplayScript(style, socialInsights, titleFormat, shareUrl, providers);
            }

            return(retVal);
        }
コード例 #2
0
        /// <summary>Gets the OneAll social sharing display script.</summary>
        /// <param name="style">The desired button style.</param>
        /// <param name="socialInsights">True to enable social insights and measure referral traffic.</param>
        /// <param name="titleFormat">The format for the button title, example: "Send to {0}" where "{0}" will be the provider name.</param>
        /// <param name="shareUrl">A custom URL to share, or null to share the URL of the page executing this script.</param>
        /// <param name="providers">The providers to be displayed.</param>
        /// <returns>A string of HTML to cause the sharing API to be rendered.</returns>
        public static string OneAllSharingDisplayScript(OneAllButtonStyle style, bool socialInsights, string titleFormat, Uri shareUrl, params Provider[] providers)
        {
            if (providers == null || providers.Length < 1 || providers.All(x => string.IsNullOrEmpty(x.Identifier)))
            {
                throw new ArgumentException(OneAllConstants.ERR_INVALID_PARAM_COLLECTION, OneAllConstants.PARAM_PROVIDERS);
            }

            string        retVal = null;
            string        styleInternal = string.Empty;
            string        dataUrl = string.Empty, dataOpt = string.Empty;
            StringBuilder builder = new StringBuilder();

            switch (style)
            {
            case OneAllButtonStyle.Small: { styleInternal = "oas_box_btns_s"; } break;

            case OneAllButtonStyle.Medium: { styleInternal = "oas_box_btns_m"; } break;

            case OneAllButtonStyle.Large: { styleInternal = "oas_box_btns_l"; } break;

            case OneAllButtonStyle.HorizontalCounter: { styleInternal = "oas_box_count_h"; } break;

            case OneAllButtonStyle.VerticalCounter: { styleInternal = "oas_box_count_v"; } break;

            default: { styleInternal = "oas_box_btns_s"; } break;
            }

            dataUrl = (shareUrl != null ? " data-url=\"" + shareUrl.ToString() + "\"" : string.Empty);
            dataOpt = (!socialInsights ? " data-opt=\"si:0\"" : string.Empty);

            builder.AppendLine(string.Format(CultureInfo.InvariantCulture, "<div class=\"oas_box {0}\"{1}{2}>", styleInternal, dataUrl, dataOpt));
            foreach (Provider provider in providers)
            {
                if (string.IsNullOrEmpty(provider.Identifier))
                {
                    continue;
                }
                else
                {
                    builder.AppendLine(string.Format(CultureInfo.InvariantCulture, "\t<span class=\"oas_btn oas_btn_{0}\" title=\"{1}\"></span>", provider.Identifier,
                                                     (!string.IsNullOrEmpty(titleFormat) && titleFormat.Contains("{0}") && !string.IsNullOrEmpty(provider.Name) ?
                                                      string.Format(CultureInfo.InvariantCulture, titleFormat, provider.Name) : string.Empty)));
                }
            }
            builder.Append("</div>");

            if (builder != null)
            {
                retVal = builder.ToString();
            }

            return(retVal);
        }
コード例 #3
0
ファイル: WebExtensions.ASPNET.cs プロジェクト: eme158/OneAll
        /// <summary>Gets the OneAll sharing display script for the currently initialized OneAll domain.</summary>
        /// <param name="page">The <see cref="Page" /> being executed.</param>
        /// <param name="style">The desired button style.</param>
        /// <param name="socialInsights">True to enable social insights and measure referral traffic.</param>
        /// <param name="titleFormat">The format for the button title, example: "Send to {0}" where "{0}" will be the provider name.</param>
        /// <param name="shareUrl">A custom URL to share, or null to share the URL of the page executing this script.</param>
        /// <param name="providers">The providers to be displayed.</param>
        /// <returns>A string of HTML to cause the sharing API to be rendered.</returns>
        public static string OneAllSharingDisplayScript(this Page page, OneAllButtonStyle style, bool socialInsights, string titleFormat, Uri shareUrl, params Provider[] providers)
        {
            string retVal = string.Empty;
            if (page != null) { retVal = ExtensionImplementations.OneAllSharingDisplayScript(style, socialInsights, titleFormat, shareUrl, providers); }

            return retVal;
        }
コード例 #4
0
ファイル: WebExtensions.ASPNET.cs プロジェクト: eme158/OneAll
 /// <summary>Gets the OneAll sharing display script for the currently initialized OneAll domain.</summary>
 /// <param name="page">The <see cref="Page" /> being executed.</param>
 /// <param name="style">The desired button style.</param>
 /// <param name="socialInsights">True to enable social insights and measure referral traffic.</param>
 /// <param name="titleFormat">The format for the button title, example: "Send to {0}" where "{0}" will be the provider name.</param>
 /// <param name="shareUrl">A custom URL to share, or null to share the URL of the page executing this script.</param>
 /// <returns>A string of HTML to cause the sharing API to be rendered.</returns>
 public static string OneAllSharingDisplayScript(this Page page, OneAllButtonStyle style, bool socialInsights, string titleFormat, Uri shareUrl)
 {
     return OneAllSharingDisplayScript(page, style, socialInsights, titleFormat, shareUrl, Settings.Instance.Providers.ToArray());
 }
コード例 #5
0
ファイル: WebExtensions.ASPNET.cs プロジェクト: eme158/OneAll
 /// <summary>Gets the OneAll sharing display script for the currently initialized OneAll domain.</summary>
 /// <param name="page">The <see cref="Page" /> being executed.</param>
 /// <param name="style">The desired button style.</param>
 /// <param name="socialInsights">True to enable social insights and measure referral traffic.</param>
 /// <param name="titleFormat">The format for the button title, example: "Send to {0}" where "{0}" will be the provider name.</param>
 /// <returns>A string of HTML to cause the sharing API to be rendered.</returns>
 public static string OneAllSharingDisplayScript(this Page page, OneAllButtonStyle style, bool socialInsights, string titleFormat)
 {
     return OneAllSharingDisplayScript(page, style, socialInsights, titleFormat, Settings.Instance.ShareUrl);
 }
コード例 #6
0
ファイル: WebExtensions.ASPNET.cs プロジェクト: eme158/OneAll
 /// <summary>Gets the OneAll sharing display script for the currently initialized OneAll domain.</summary>
 /// <param name="page">The <see cref="Page" /> being executed.</param>
 /// <param name="style">The desired button style.</param>
 /// <returns>A string of HTML to cause the sharing API to be rendered.</returns>
 public static string OneAllSharingDisplayScript(this Page page, OneAllButtonStyle style)
 {
     return OneAllSharingDisplayScript(page, style, Settings.Instance.EnableInsights ?? true);
 }
コード例 #7
0
 /// <summary>Gets the OneAll sharing display script for the currently initialized OneAll domain.</summary>
 /// <param name="page">The <see cref="Page" /> being executed.</param>
 /// <param name="style">The desired button style.</param>
 /// <param name="socialInsights">True to enable social insights and measure referral traffic.</param>
 /// <param name="titleFormat">The format for the button title, example: "Send to {0}" where "{0}" will be the provider name.</param>
 /// <param name="shareUrl">A custom URL to share, or null to share the URL of the page executing this script.</param>
 /// <returns>A string of HTML to cause the sharing API to be rendered.</returns>
 public static string OneAllSharingDisplayScript(this Page page, OneAllButtonStyle style, bool socialInsights, string titleFormat, Uri shareUrl)
 {
     return(OneAllSharingDisplayScript(page, style, socialInsights, titleFormat, shareUrl, Settings.Instance.Providers.ToArray()));
 }
コード例 #8
0
 /// <summary>Gets the OneAll sharing display script for the currently initialized OneAll domain.</summary>
 /// <param name="page">The <see cref="Page" /> being executed.</param>
 /// <param name="style">The desired button style.</param>
 /// <param name="socialInsights">True to enable social insights and measure referral traffic.</param>
 /// <param name="titleFormat">The format for the button title, example: "Send to {0}" where "{0}" will be the provider name.</param>
 /// <returns>A string of HTML to cause the sharing API to be rendered.</returns>
 public static string OneAllSharingDisplayScript(this Page page, OneAllButtonStyle style, bool socialInsights, string titleFormat)
 {
     return(OneAllSharingDisplayScript(page, style, socialInsights, titleFormat, Settings.Instance.ShareUrl));
 }
コード例 #9
0
 /// <summary>Gets the OneAll sharing display script for the currently initialized OneAll domain.</summary>
 /// <param name="page">The <see cref="Page" /> being executed.</param>
 /// <param name="style">The desired button style.</param>
 /// <returns>A string of HTML to cause the sharing API to be rendered.</returns>
 public static string OneAllSharingDisplayScript(this Page page, OneAllButtonStyle style)
 {
     return(OneAllSharingDisplayScript(page, style, Settings.Instance.EnableInsights ?? true));
 }
コード例 #10
0
        /// <summary>Gets the OneAll sharing display script for the currently initialized OneAll domain.</summary>
        /// <param name="helper">The standard MVC HTML helper.</param>
        /// <param name="style">The desired button style.</param>
        /// <param name="socialInsights">True to enable social insights and measure referral traffic.</param>
        /// <param name="titleFormat">The format for the button title, example: "Send to {0}" where "{0}" will be the provider name.</param>
        /// <param name="shareUrl">A custom URL to share, or null to share the URL of the page executing this script.</param>
        /// <param name="providers">The providers to be displayed.</param>
        /// <returns>A string of HTML to cause the sharing API to be rendered.</returns>
        public static MvcHtmlString OneAllSharingDisplayScript(this HtmlHelper helper, OneAllButtonStyle style, bool socialInsights, string titleFormat, Uri shareUrl, params Provider[] providers)
        {
            MvcHtmlString retVal = null;

            if (helper != null)
            {
                retVal = MvcHtmlString.Create(ExtensionImplementations.OneAllSharingDisplayScript(style, socialInsights, titleFormat, shareUrl, providers));
            }

            return(retVal);
        }
コード例 #11
0
 /// <summary>Gets the OneAll sharing display script for the currently initialized OneAll domain.</summary>
 /// <param name="helper">The standard MVC HTML helper.</param>
 /// <param name="style">The desired button style.</param>
 /// <param name="socialInsights">True to enable social insights and measure referral traffic.</param>
 /// <param name="titleFormat">The format for the button title, example: "Send to {0}" where "{0}" will be the provider name.</param>
 /// <returns>A string of HTML to cause the sharing API to be rendered.</returns>
 public static MvcHtmlString OneAllSharingDisplayScript(this HtmlHelper helper, OneAllButtonStyle style, bool socialInsights, string titleFormat)
 {
     return(OneAllSharingDisplayScript(helper, style, socialInsights, titleFormat, Settings.Instance.ShareUrl));
 }
コード例 #12
0
 /// <summary>Gets the OneAll sharing display script for the currently initialized OneAll domain.</summary>
 /// <param name="helper">The standard MVC HTML helper.</param>
 /// <param name="style">The desired button style.</param>
 /// <returns>A string of HTML to cause the sharing API to be rendered.</returns>
 public static MvcHtmlString OneAllSharingDisplayScript(this HtmlHelper helper, OneAllButtonStyle style)
 {
     return(OneAllSharingDisplayScript(helper, style, Settings.Instance.EnableInsights ?? true));
 }
コード例 #13
0
ファイル: WebExtensions.MVC.cs プロジェクト: K232/OneAll
        /// <summary>Gets the OneAll sharing display script for the currently initialized OneAll domain.</summary>
        /// <param name="helper">The standard MVC HTML helper.</param>
        /// <param name="style">The desired button style.</param>
        /// <param name="socialInsights">True to enable social insights and measure referral traffic.</param>
        /// <param name="titleFormat">The format for the button title, example: "Send to {0}" where "{0}" will be the provider name.</param>
        /// <param name="shareUrl">A custom URL to share, or null to share the URL of the page executing this script.</param>
        /// <param name="providers">The providers to be displayed.</param>
        /// <returns>A string of HTML to cause the sharing API to be rendered.</returns>
        public static MvcHtmlString OneAllSharingDisplayScript(this HtmlHelper helper, OneAllButtonStyle style, bool socialInsights, string titleFormat, Uri shareUrl, params Provider[] providers)
        {
            MvcHtmlString retVal = null;
            if (helper != null) { retVal = MvcHtmlString.Create(ExtensionImplementations.OneAllSharingDisplayScript(style, socialInsights, titleFormat, shareUrl, providers)); }

            return retVal;
        }
コード例 #14
0
ファイル: WebExtensions.MVC.cs プロジェクト: K232/OneAll
 /// <summary>Gets the OneAll sharing display script for the currently initialized OneAll domain.</summary>
 /// <param name="helper">The standard MVC HTML helper.</param>
 /// <param name="style">The desired button style.</param>
 /// <param name="socialInsights">True to enable social insights and measure referral traffic.</param>
 /// <param name="titleFormat">The format for the button title, example: "Send to {0}" where "{0}" will be the provider name.</param>
 /// <returns>A string of HTML to cause the sharing API to be rendered.</returns>
 public static MvcHtmlString OneAllSharingDisplayScript(this HtmlHelper helper, OneAllButtonStyle style, bool socialInsights, string titleFormat)
 {
     return OneAllSharingDisplayScript(helper, style, socialInsights, titleFormat, Settings.Instance.ShareUrl);
 }
コード例 #15
0
ファイル: WebExtensions.MVC.cs プロジェクト: K232/OneAll
 /// <summary>Gets the OneAll sharing display script for the currently initialized OneAll domain.</summary>
 /// <param name="helper">The standard MVC HTML helper.</param>
 /// <param name="style">The desired button style.</param>
 /// <returns>A string of HTML to cause the sharing API to be rendered.</returns>
 public static MvcHtmlString OneAllSharingDisplayScript(this HtmlHelper helper, OneAllButtonStyle style)
 {
     return OneAllSharingDisplayScript(helper, style, Settings.Instance.EnableInsights ?? true);
 }