Beispiel #1
0
        /// <summary>
        /// Binds the toolbar.
        /// </summary>
        public void BindToolbar()
        {
            LanguageBar.Rows.Clear();
            TableRow newRow1 = new TableRow();
            TableRow newRow2 = new TableRow();

            using (IDataReader reader = mc.Language.GetAllLanguages())
            {
                while (reader.Read())
                {
                    TableCell newCell1 = new TableCell();
                    TableCell newCell2 = new TableCell();
                    newCell1.Text    = reader["LangId"].ToString();
                    newCell1.Visible = false;
                    newRow1.Cells.Add(newCell1);
                    //newCell.Text = reader["LangName"].ToString();
                    ImageButton imgBtn = new ImageButton();
                    if (DisableUnavaliable)
                    {
                        if (AvaliableLanguage != null)
                        {
                            if (AvaliableLanguage.Contains(reader["LangId"]))
                            {
                                imgBtn.ImageUrl = Mediachase.Commerce.Shared.CommerceHelper.GetAbsoluteThemedPath("/images/" + reader["LangName"].ToString() + ".gif", Page.Theme);
                            }
                            else
                            {
                                imgBtn.ImageUrl = Mediachase.Commerce.Shared.CommerceHelper.GetAbsoluteThemedPath("/images/" + reader["LangName"].ToString() + "_gray.gif", Page.Theme);
                            }
                        }
                        else
                        {
                            imgBtn.ImageUrl = Mediachase.Commerce.Shared.CommerceHelper.GetAbsoluteThemedPath("/images/" + reader["LangName"].ToString() + "_gray.gif", Page.Theme);
                        }
                    }
                    else
                    {
                        imgBtn.ImageUrl = Mediachase.Commerce.Shared.CommerceHelper.GetAbsoluteThemedPath("/images/" + reader["LangName"].ToString() + ".gif", Page.Theme);
                    }

                    imgBtn.Height           = 12;
                    imgBtn.Width            = 18;
                    imgBtn.BorderWidth      = 1;
                    imgBtn.CommandArgument  = reader["LangId"].ToString();
                    imgBtn.Click           += new ImageClickEventHandler(imgBtn_Click);
                    imgBtn.CausesValidation = false;
                    newCell2.Controls.Add(imgBtn);
                    newRow2.Cells.Add(newCell2);
                }

                reader.Close();
            }
            LanguageBar.Rows.Add(newRow1);
            LanguageBar.Rows.Add(newRow2);
            HighlightCurrentLanguage();
        }
Beispiel #2
0
        /// <summary>
        /// Binds the toolbar.
        /// </summary>
        public void BindToolbar()
        {
            LanguageBar.Rows.Clear();
            TableRow newRow1 = new TableRow();
            TableRow newRow2 = new TableRow();


            using (IDataReader reader = mc.Language.GetAllLanguages())
            {
                while (reader.Read())
                {
                    TableCell newCell1 = new TableCell();
                    TableCell newCell2 = new TableCell();
                    newCell1.Text    = reader["LangId"].ToString();
                    newCell1.Visible = false;
                    newRow1.Cells.Add(newCell1);
                    ImageButton imgBtn  = new ImageButton();
                    CultureInfo culture = CultureInfo.CreateSpecificCulture(reader["LangName"].ToString());
                    if (DisableUnavaliable)
                    {
                        if (AvaliableLanguage != null)
                        {
                            if (AvaliableLanguage.Contains(reader["LangId"]))
                            {
                                imgBtn.ImageUrl = CommonHelper.GetFlagIcon(culture);//CommerceHelper.GetAbsolutePath("~/images/flags/" + reader["LangName"].ToString().Substring(0, 2) + ".gif");
                            }
                            else
                            {
                                imgBtn.ImageUrl = CommerceHelper.GetAbsolutePath("~/images/flags/" + reader["LangName"].ToString().Substring(0, 2) + "_gray.gif");
                            }
                        }
                        else
                        {
                            imgBtn.ImageUrl = CommerceHelper.GetAbsolutePath("~/images/flags/" + reader["LangName"].ToString().Substring(0, 2) + "_gray.gif");
                        }

                        //imgBtn.ImageUrl = CommonHelper.GetFlagIcon(culture);
                    }
                    else
                    {
                        //imgBtn.ImageUrl = CommonHelper.GetFlagIcon(culture);
                        imgBtn.ImageUrl = CommonHelper.GetFlagIcon(CultureInfo.CreateSpecificCulture(reader["LangName"].ToString())); // CommerceHelper.GetAbsolutePath("~/images/flags/" + reader["LangName"].ToString().Substring(0, 2) + ".gif");
                    }

                    imgBtn.AlternateText = culture.DisplayName;

                    imgBtn.Height = 12;
                    imgBtn.Width  = 18;

                    if ((int)reader["LangId"] == CurrentLanguageId)
                    {
                        imgBtn.BorderWidth = 2;
                        imgBtn.BorderColor = System.Drawing.Color.Gold;
                    }
                    else
                    {
                        imgBtn.BorderWidth = 1;
                        imgBtn.BorderColor = System.Drawing.Color.Black;
                    }

                    imgBtn.CommandArgument  = reader["LangId"].ToString();
                    imgBtn.Click           += new ImageClickEventHandler(imgBtn_Click);
                    imgBtn.CausesValidation = false;
                    newCell2.Controls.Add(imgBtn);
                    newRow2.Cells.Add(newCell2);
                }

                reader.Close();
            }
            LanguageBar.Rows.Add(newRow1);
            LanguageBar.Rows.Add(newRow2);
            //HighlightCurrentLanguage();
        }