protected internal PageOptionsButtonLanguageItem CloneAddThisButtonLanguageItem()
        {
            PageOptionsButtonLanguageItem newAddThisItem = this.CreateAddThisLanguageItem();

            this.CopyProperties(newAddThisItem);
            return(newAddThisItem);
        }
        protected override void OnRemoveComplete(int index, object value)
        {
            PageOptionsButtonLanguageItem buttonItem = value as PageOptionsButtonLanguageItem;

            if (buttonItem != null)
            {
                buttonItem.LanguageItemChanged += new EventHandler(this.LanguageCollectionChanged);
            }

            this.OnLanguageCollectionChanged();
        }
        protected override void RenderContents(HtmlTextWriter writer)
        {
            PageOptionsButtonLanguageItem buttonLanguageItem = _itemsCollection["en"];

            string language = pgInstruction.GetField("Language");

            if (language == "es")
            {
                buttonLanguageItem = _itemsCollection["es"];
            }

            writer.RenderBeginTag(HtmlTextWriterTag.Ul);

            foreach (PageOptionsButtonItem button in buttonLanguageItem.ButtonsCollection)
            {
                if (pgInstruction.AlternateContentVersionsKeys.Contains(button.AlternateContentVersionKey))
                {
                    string liClass = string.Empty;
                    liClass += button.CssClass;
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, liClass);
                    writer.RenderBeginTag(HtmlTextWriterTag.Li);

                    if (button is PageOptionsAddThisButtonItem)
                    {
                        RenderPageOptionsAddThisButton(writer, (PageOptionsAddThisButtonItem)button);
                    }

                    if (button is EmailButtonItem)
                    {
                        RenderEmailButtonItem(writer, (EmailButtonItem)button);
                    }

                    if (button is LinkButtonItem)
                    {
                        RenderLinkButtonItem(writer, (LinkButtonItem)button);
                    }

                    if (button is ClientSideButtonItem)
                    {
                        RenderClientSideButtonItem(writer, (ClientSideButtonItem)button);
                    }
                    writer.RenderEndTag(); // li
                }
            }

            writer.RenderEndTag(); // ul
        }
 protected void CopyProperties(PageOptionsButtonLanguageItem newAddThisItems)
 {
     ((PageOptionsButtonLanguageItem)newAddThisItems).ButtonsCollection = this.ButtonsCollection;
     ((PageOptionsButtonLanguageItem)newAddThisItems).Language          = this.Language;
 }
        public override void RenderBeginTag(HtmlTextWriter writer)
        {
            #region Var AddThis_Share
            writer.AddAttribute(HtmlTextWriterAttribute.Type, "text/javascript");
            writer.RenderBeginTag(HtmlTextWriterTag.Script);
            writer.Write("var addthis_share = {\n");
            bool multipleConfigItems = false;
            //title
            if (!string.IsNullOrEmpty(pgInstruction.GetField("add_this_title")))
            {
                if (multipleConfigItems)
                {
                    writer.Write(",\n");
                }
                string titleField = pgInstruction.GetField("add_this_title").Replace("\"", "\\\"");
                writer.Write("title: \"" + titleField + "\"");
                multipleConfigItems = true;
            }
            //description
            if (!string.IsNullOrEmpty(pgInstruction.GetField("add_this_description")))
            {
                if (multipleConfigItems)
                {
                    writer.Write(",\n");
                }
                writer.Write("description: \"" + pgInstruction.GetField("add_this_description") + "\"");
                multipleConfigItems = true;
            }
            //url

            /**if (!pgInstruction.GetUrl("add_this_url").Equals(""))
             * {
             *  if (multipleConfigItems)
             *  {
             *      writer.Write(",\n");
             *  }
             *  writer.Write("url: \"" + pgInstruction.GetUrl("add_this_url") + "\"");
             *  multipleConfigItems = true;
             * }*/
            writer.Write("}");
            writer.RenderEndTag();
            #endregion

            #region Var AddThis_Config
            writer.AddAttribute(HtmlTextWriterAttribute.Type, "text/javascript");
            writer.RenderBeginTag(HtmlTextWriterTag.Script);
            writer.Write("var addthis_config = {\n");
            multipleConfigItems = false;
            String language = pgInstruction.GetField("Language");
            if (!language.Equals(""))
            {
                PageOptionsButtonLanguageItem langItem = _itemsCollection[language];
                if (langItem != null)
                {
                    //Custom Button Definitions
                    PageOptionsButtonCollection buttonCollection = langItem.ButtonsCollection;
                    if (buttonCollection != null)
                    {
                        bool hasCustomButtons = false;

                        /*foreach (PageOptionsAddThisButtonItem currButton in buttonCollection)
                         * {
                         *
                         *  if (currButton.GetType().Name.Equals("CustomAddThisButtonItem"))
                         *  {
                         *      if (!hasCustomButtons)
                         *      {
                         *          writer.Write("services_custom: {");
                         *          hasCustomButtons = true;
                         *      }
                         *
                         *      bool hasMoreThenOneProperty = false;
                         *      //Name
                         *      if (!string.IsNullOrEmpty(((CustomAddThisButtonItem)currButton).Name))
                         *      {
                         *          writer.Write("name: \"" + ((CustomAddThisButtonItem)currButton).Name + "\"");
                         *          hasMoreThenOneProperty = true;
                         *      }
                         *      //Url
                         *      if (!string.IsNullOrEmpty(((CustomAddThisButtonItem)currButton).Url))
                         *      {
                         *          if (hasMoreThenOneProperty)
                         *          {
                         *              writer.Write(",\n");
                         *          }
                         *          hasMoreThenOneProperty = true;
                         *          writer.Write("url: \"" + ((CustomAddThisButtonItem)currButton).Url + "\"");
                         *      }
                         *      //Icon
                         *      if (!string.IsNullOrEmpty(((CustomAddThisButtonItem)currButton).Icon))
                         *      {
                         *          if (hasMoreThenOneProperty)
                         *          {
                         *              writer.Write(",\n");
                         *          }
                         *          hasMoreThenOneProperty = true;
                         *          writer.Write("icon: \"" + ((CustomAddThisButtonItem)currButton).Icon + "\"");
                         *      }
                         *
                         *  }
                         * }*/
                        if (hasCustomButtons)
                        {
                            writer.Write("}");
                            multipleConfigItems = true;
                        }
                    }
                    //Account Field
                    if (!langItem.Account.Equals(""))
                    {
                        if (multipleConfigItems)
                        {
                            writer.Write(",\n");
                        }
                        writer.Write("username: \"" + langItem.Account + "\"");
                        multipleConfigItems = true;
                    }
                    //Language Field
                    if (!string.IsNullOrEmpty(langItem.Language))
                    {
                        if (multipleConfigItems)
                        {
                            writer.Write(",\n");
                        }
                        writer.Write("ui_language: \"" + langItem.Language + "\"");
                        multipleConfigItems = true;
                    }
                    //Compact Field
                    if (!string.IsNullOrEmpty(langItem.Compact))
                    {
                        if (multipleConfigItems)
                        {
                            writer.Write(",\n");
                        }
                        writer.Write("services_compact: \"" + langItem.Compact + "\"");
                        multipleConfigItems = true;
                    }
                    //Expanded Field
                    if (!string.IsNullOrEmpty(langItem.Expanded))
                    {
                        if (multipleConfigItems)
                        {
                            writer.Write(",\n");
                        }
                        writer.Write("services_expanded: \"" + langItem.Expanded + "\"");
                        multipleConfigItems = true;
                    }
                    //508 compliance
                    if (multipleConfigItems)
                    {
                        writer.Write(",\n");
                    }
                    writer.Write("ui_508_compliant: true");
                }
                writer.Write("}");
                writer.RenderEndTag();
            }
            #endregion

            //writer.AddAttribute(HtmlTextWriterAttribute.Class, "addthis_toolbox addthis_container addthis_default_style addthis_32x32_style");
            base.RenderBeginTag(writer);
        }
 public void Removed(PageOptionsButtonLanguageItem languageItem)
 {
     ((IList)this).Remove(languageItem);
 }
 public void Insert(int index, PageOptionsButtonLanguageItem languageItem)
 {
     ((IList)this).Insert(index, languageItem);
 }
 public int IndexOf(PageOptionsButtonLanguageItem languageItem)
 {
     return(((IList)this).IndexOf(languageItem));
 }
 public bool Contains(PageOptionsButtonLanguageItem languageItem)
 {
     return(((IList)this).Contains(languageItem));
 }
 public void Add(PageOptionsButtonLanguageItem languageItem)
 {
     ((IList)this).Add(languageItem);
 }