コード例 #1
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 MvcHtmlString.Create(strScript);
        }
コード例 #2
0
        /// <summary>
        /// Render predefined VerticalCounters widget.
        /// </summary>
        /// <returns></returns>
        public static MvcHtmlString VerticalCounters()
        {
            ShareThisBuilder shareThis = new ShareThisBuilder();

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

            shareThis.CounterStyle = ShareThisCounterStyle.Vertical;

            return ShareThisHelper.Render(shareThis);
        }
コード例 #3
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);
        }