private void mnuAddFromCulture_Click(object sender, EventArgs e)
        {
            Culture selected;

            if (AddFromCulture.Execute(culture.Cultures, (Culture)cbCulture.SelectedItem, out selected))
            {
                LoadDB(selected.CultureText);
                SaveIfNotExist();
                LoadDB();
            }
        }
Example #2
0
        public static bool Execute(List <Culture> cultures, Culture current, out Culture selected)
        {
            AddFromCulture ac = new AddFromCulture();

            ac.cbCulture.Items.AddRange(cultures.ToArray());
            for (int i = ac.cbCulture.Items.Count - 1; i >= 0; i--)
            {
                if (((Culture)ac.cbCulture.Items[i]).LCID == current.LCID)
                {
                    ac.cbCulture.Items.RemoveAt(i);
                    break;
                }
            }

            for (int i = 0; i < ac.cbCulture.Items.Count; i++)
            {
                ac.cbCulture.AutoCompleteCustomSource.Add((ac.cbCulture.Items[i] as Culture).NativeName);
            }

            bool retVal = ac.ShowDialog() == DialogResult.OK;

            selected = (Culture)ac.cbCulture.SelectedItem;
            return(retVal);
        }