Exemple #1
0
        /// <summary>
        /// Render predefined HorizontalCounters widget.
        /// </summary>
        /// <returns></returns>
        public static MvcHtmlString HorizontalCounters()
        {
            ShareThisBuilder shareThis = new ShareThisBuilder();

            shareThis.AddButton(ShareThisButton.Twitter);
            shareThis.AddButton(ShareThisButton.Facebook);
            shareThis.AddButton(ShareThisButton.Email);
            shareThis.AddButton(ShareThisButton.ShareThis);

            shareThis.CounterStyle = ShareThisCounterStyle.Horizontal;

            return(ShareThisHelper.Render(shareThis));
        }
Exemple #2
0
        /// <summary>
        /// Render predefined MultiChannel widget.
        /// </summary>
        /// <returns></returns>
        public static MvcHtmlString MultiChannel()
        {
            ShareThisBuilder shareThis = new ShareThisBuilder();

            shareThis.AddButton(ShareThisButton.Twitter);
            shareThis.AddButton(ShareThisButton.Facebook);
            shareThis.AddButton(ShareThisButton.Yahoo);
            shareThis.AddButton(ShareThisButton.Google_Buzz);
            shareThis.AddButton(ShareThisButton.Email);
            shareThis.AddButton(ShareThisButton.ShareThis);

            return(ShareThisHelper.Render(shareThis));
        }
Exemple #3
0
        /// <summary>
        /// Render predefined Classic Button.
        /// </summary>
        /// <param name="displayText">Optional label text to use with Classic Button.</param>
        /// <returns></returns>
        public static MvcHtmlString Classic(string displayText = "")
        {
            string strScript = string.Empty;

            if (displayText == "")
            {
                displayText = "ShareThis";
            }

            strScript += ShareThisHelper.GetButtonPlaceholder(ShareThisButton.ShareThis, "_button", true, displayText);
            strScript += ShareThisHelper.GetCommonScript;

            return(new MvcHtmlString(strScript));
        }
Exemple #4
0
        /// <summary>
        /// Render custom ShareThis widget.
        /// </summary>
        /// <param name="shareThis">ShareThisBuilder object configured with user customization.</param>
        /// <returns></returns>
        public static MvcHtmlString Render(ShareThisBuilder shareThis)
        {
            string strScript      = string.Empty;
            string strButtonStyle = string.Empty;

            if (shareThis.CounterStyle == ShareThisCounterStyle.None)
            {
                if (shareThis.ButtonStyle == ShareThisButtonStyle.Medium_32X32)
                {
                    strButtonStyle      = "_large";
                    shareThis.ShowLabel = false;
                }
                else if (shareThis.ButtonStyle == ShareThisButtonStyle.Rectangle)
                {
                    strButtonStyle      = "_button";
                    shareThis.ShowLabel = true;
                }
            }
            else if (shareThis.CounterStyle == ShareThisCounterStyle.Horizontal)
            {
                strButtonStyle      = "_hcount";
                shareThis.ShowLabel = true;
            }
            else
            {
                strButtonStyle      = "_vcount";
                shareThis.ShowLabel = true;
            }

            ShareThisHelper.WidgetStyle = shareThis.WidgetStyle;

            for (int counter = 0; counter < shareThis.Buttons.Count; counter++)
            {
                strScript += ShareThisHelper.GetButtonPlaceholder(shareThis.Buttons[counter], strButtonStyle, shareThis.ShowLabel, shareThis.ButtonLabelDictionaty[shareThis.Buttons[counter].ToString()]);
            }

            strScript += ShareThisHelper.GetCommonScript;

            return(new MvcHtmlString(strScript));
        }