private void UpdateValue(TreeNode node) { if (node == null) return; KeyItem item = node.Tag as KeyItem; if (item == null) return; if (item.Connection.Select(item.DbIndex)) { using (var form = new EditForm() { EditName = item.Key, EditValue = item.GetValue(AppCache.Instance.CurrentEncoding) }) { if (form.ShowDialog(this) == DialogResult.OK) { if (form.ByteData != null) { item.SetValue(form.ByteData); } else { item.SetValue(form.EditValue.Trim(), AppCache.Instance.CurrentEncoding); } ShowValue(node); } } } else { Show(string.Format("Can not select db:{0}", item.DbIndex)); } }
private void OnNodeClickUpdateValueMenu(object sender, EventArgs e) { MenuItem menu = sender as MenuItem; TreeNode node = menu.Tag as TreeNode; if (node == null || node.Tag == null && node.Parent == null) return; NodeItem item = node.Tag as NodeItem; using (var form = new EditForm() { EditName = item.Name, EditValue = item.Value }) { if (form.ShowDialog(this) == DialogResult.OK) { item.Value = form.EditValue.Trim(); } } }