private void SelectComboBox_LostFocus(object sender, RoutedEventArgs e)
        {
            ChoiceItem ci = FileManager.choiceItemInfo;

            ci.id     = Convert.ToInt32(this.SelectComboBox.Text == ""? "0":this.SelectComboBox.Text);
            ci.jolist = FileManager.jsonDictionary[FileManager.choiceItemInfo.file][ci.id];
        }
        private void comboBox_LostFocus(object sender, RoutedEventArgs e)
        {
            ChoiceItem ci = FileManager.choiceItemInfo;

            ci.Name  = this.comboBox.Text;
            ci.Value = this.textBox.Text;
        }
        private void buttonApply_Click(object sender, RoutedEventArgs e)
        {
            ChoiceItem ci = FileManager.choiceItemInfo;

            ci.Name  = this.comboBox.Text;
            ci.Value = this.textBox.Text;
            FileManager.jsonDictionary[ci.file][ci.id][ci.Name] = ci.Value;
            FileManager.SaveJsonFiles();
        }
        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            ChoiceItem ci      = FileManager.choiceItemInfo;
            string     jtvalue = "{\"" + ci.Name + "\":" + "\"" + value.ToString() + "\"}";
            JObject    jo      = JObject.Parse(jtvalue);

            return((JToken)jo);

            throw new NotImplementedException();
        }
        private void buttonAddAttribute_Click(object sender, RoutedEventArgs e)
        {
            ChoiceItem ci = FileManager.choiceItemInfo;

            ci.Name  = this.textBoxAddAttribute.Text;
            ci.Value = "";
            for (int i = 1; i < FileManager.jsonDictionary[ci.file].Count; i++)
            {
                FileManager.jsonDictionary[ci.file][i][ci.Name] = ci.Value;
            }
            FileManager.SaveJsonFiles();
        }
        private void buttonDeleteAttribute_Click(object sender, RoutedEventArgs e)
        {
            ChoiceItem ci = FileManager.choiceItemInfo;

            ci.Name  = this.comboBox.Text;
            ci.Value = this.textBox.Text;
            for (int i = 1; i < FileManager.jsonDictionary[ci.file].Count; i++)
            {
                JProperty id = FileManager.jsonDictionary[ci.file][i].Children <JProperty>().FirstOrDefault(p => p.Name == ci.Name);
                if (id != null)
                {
                    id.Remove();
                }
            }
            FileManager.SaveJsonFiles();
        }
Exemple #7
0
 public static void Initialize()
 {
     choiceItemInfo = new ChoiceItem();
     LoadJsonFiles();
 }
 private void textBox_LostFocus(object sender, RoutedEventArgs e)
 {
     ChoiceItem ci = FileManager.choiceItemInfo;
 }