private void LoadLang()
        {
            this.Text = StrManipulation.Replace(lang.GetValue("Form", "GiveItems", "Title").Value.ToString(), CollectionItems.DefaultEscapeList);

            List <JsonProperty> list = null;

            #region Add Item to comboBox_Category
            list = JsonIterator.TraversalObject(lang.GetValue("Form", "GiveItems", "Category"));
            foreach (var p in list)
            {
                comboBox_Category.Items.Add(p.Value.Value);
            }
            #endregion

            #region Add Item to comboBox_HideFlags
            list = JsonIterator.TraversalObject(lang.GetValue("Form", "GiveItems", "HideFlags"));
            foreach (var p in list)
            {
                comboBox_HideFlags.Items.Add(p.Value.Value);
            }
            #endregion

            #region Add Item to comboBox_NameColorAndFont & comboBox_LoreColorAndFont
            comboBox_NameColorAndFont.Items.Add(lang.GetValue("Form", "GiveItems", "DisplayName", "ColorAndFont.Index").Value);
            comboBox_LoreColorAndFont.Items.Add(lang.GetValue("Form", "GiveItems", "Lore", "ColorAndFont.Index").Value);
            list = JsonIterator.TraversalObject(lang.GetValue("Minecraft", "Color"));
            foreach (var p in list)
            {
                comboBox_NameColorAndFont.Items.Add(p.Value.Value);
                comboBox_LoreColorAndFont.Items.Add(p.Value.Value);
            }
            list = JsonIterator.TraversalObject(lang.GetValue("Minecraft", "Font"));
            foreach (var p in list)
            {
                comboBox_NameColorAndFont.Items.Add(p.Value.Value);
                comboBox_LoreColorAndFont.Items.Add(p.Value.Value);
            }
            #endregion

            #region Add Item to comboBox_{comboBox_Attributes}
            list = JsonIterator.TraversalObject(lang.GetValue("Minecraft", "Part"));
            foreach (Control control in panel_Attributes.Controls)
            {
                if (Regex.IsMatch(control.Name, "comboBox_\\w+"))
                {
                    foreach (var p in list)
                    {
                        (control as ComboBox).Items.Add(p.Value.Value);
                    }
                }
            }
            #endregion

            comboBox_Items.Items.Add(lang.GetValue("Form", "GiveItems", "Items", "Index").Value);
            comboBox_Player.Items.Add(lang.GetValue("Form", "GiveItems", "Player", "Index").Value);
        }
Exemplo n.º 2
0
        private void Initialize()
        {
            this.Icon = new Icon(FilePath.icoIcon1);

            #region comboBox_DisplayLang
            JsonIterator     langlistJson = new JsonIterator(JsonFile.Parse(FilePath.langlist));
            List <JsonValue> langlist     = langlistJson.TraversalArray("display", "List");
            ComboBox_DisplayLang.Items.Add(lang.GetValue("Form", "Settings", "General", "DisplayLang.Indexes").Value);
            foreach (var p in langlist)
            {
                ComboBox_DisplayLang.Items.Add(p.Value);
            }
            ComboBox_DisplayLang.SelectedIndex = langlistJson.QueryItemInArray(SettingItems.lang, "code", "List") + 1;
            #endregion
        }
Exemplo n.º 3
0
        private void comboBox_DisplayLang_DropDownClosed(object sender, EventArgs e)
        {
            JsonIterator langlistJson = new JsonIterator(JsonFile.Parse(FilePath.langlist));

            if (ComboBox_DisplayLang.SelectedIndex != 0 && ComboBox_DisplayLang.SelectedIndex != langlistJson.QueryItemInArray(SettingItems.lang, "code", "List") + 1)
            {
                string   newLang = new Json(langlistJson).GetValue("List", ComboBox_DisplayLang.SelectedIndex - 1, "code").Value.ToString();
                string[] btnT    =
                {
                    lang.GetValue("MessageBox", "Button", "OK").Value.ToString(),
                    lang.GetValue("MessageBox", "Button", "Cancel").Value.ToString()
                };
                Json tmp = new Json(JsonFile.Parse(FilePath.config));
                tmp.SetValue(JsonValue.Parse(newLang), "Language");
                JsonFile.Save(FilePath.config, tmp.GetJsonObject());
                if (MsgBox.Show(lang.GetValue("Info", "Information", "SuccessfullyChangedLanguage").Value.ToString(), lang.GetValue("MessageBox", "Title", "Tip").Value.ToString(), MessageBoxButtons.OKCancel, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, btnT) == DialogResult.OK)
                {
                    Application.Restart();
                }
            }
        }