private void _editField(object obj)
 {
     if (SelectedField != null)
     {
         var selected = (KeyValuePair <string, string>)SelectedField;
         var kve      = new KeyValueEditViewmodel(selected, false);
         if (kve.ShowDialog() == true)
         {
             _fields[kve.Key] = kve.Value;
         }
     }
 }
Beispiel #2
0
        private void _editField(object obj)
        {
            var editObject = obj ?? SelectedField;

            if (editObject != null)
            {
                var kv  = (KeyValuePair <string, string>)editObject;
                var kve = new KeyValueEditViewmodel((KeyValuePair <string, string>)editObject, true);
                if (kve.ShowDialog() == true)
                {
                    _fields[kve.Key] = kve.Value;
                }
            }
        }
 private void _addField(object obj)
 {
     using (var kve = new KeyValueEditViewmodel(new KeyValuePair <string, string>(string.Empty, string.Empty), false))
     {
         kve.OnOk += (o) =>
         {
             var co = (KeyValueEditViewmodel)o;
             return(!string.IsNullOrWhiteSpace(co.Key) && !string.IsNullOrWhiteSpace(co.Value) && !co.Key.Contains(' ') && !_fields.ContainsKey(co.Key));
         };
         if (kve.ShowDialog() == true)
         {
             _fields.Add(kve.Key, kve.Value);
         }
     }
 }