private void UpdatePassword(TreeNode node) { if (node == null) return; ConnectionItem item = node.Tag as ConnectionItem; using (var form = new OneValueForm() { Text = "Setup a new password", EnablePassword = true }) { if (!string.IsNullOrWhiteSpace(item.Connection.Password)) { form.Value = item.Connection.Password.Trim(); } if (form.ShowDialog(this) == System.Windows.Forms.DialogResult.OK) { item.Connection.Password = form.Value.Trim(); } } }
private void UpdateDescription(TreeNode node) { if (node == null) return; ConnectionItem item = node.Tag as ConnectionItem; using (var form = new OneValueForm() { Text = "Write some comments", Value = item.Connection.Description }) { if (form.ShowDialog(this) == System.Windows.Forms.DialogResult.OK) { item.Connection.Description = form.Value.Trim(); if (!string.IsNullOrEmpty(item.Connection.Description)) { string desc = GetString(item.Connection.Description, MAX_STRING_LENGTH, true); node.Text = string.Format("{0} ({1})", item.CntName, desc); node.ToolTipText = item.Connection.Description; } else { node.Text = item.CntName; } } } }
private void Rename(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 OneValueForm() { Text = "New name", Value = item.Key }) { if (form.ShowDialog(this) == DialogResult.OK) { if (!string.IsNullOrWhiteSpace(form.Value)) { if (item.Rename(form.Value)) node.Text = form.Value; } } } } else { Show(string.Format("Can not select db:{0}", item.DbIndex)); } }