private void treeView_AfterLabelEdit(object sender, NodeLabelEditEventArgs e) { if (e.Label != null) { if (e.Label.Length > 0) { if (e.Label.IndexOfAny(new char[] { '@', '.', ',', '!' }) == -1) { e.Node.EndEdit(false); IDatabaseItem item = e.Node.Tag as IDatabaseItem; item.Name = e.Label; e.Node.Name = e.Label; SortAndRefreshDelegate sortAndRefreshDelegate = SortAndRefresh; treeView.BeginInvoke(sortAndRefreshDelegate, e.Node); RefreshPanel(e.Node); } else { e.CancelEdit = true; MessageBox.Show("Invalid name.\n" + "Cannot use any of the following characters: '@','.', ',', '!'", "Name Edit"); e.Node.BeginEdit(); } } else { e.CancelEdit = true; MessageBox.Show("Invalid name.\nThe name cannot be left blank", "Name Edit"); e.Node.BeginEdit(); } } }
private static string GetDescription(IDatabaseItem dbItem) { var sb = new StringBuilder(); sb.AppendLine("Type: " + dbItem.Connection.DatabaseType); sb.AppendLine("Connection: " + dbItem.Connection.GetUIConnection()); return(sb.ToString()); }
private TreeNode InitializeNewNode(string name, IDatabaseItem tag, TreeNode parent) { TreeNode newNode = parent.Nodes.Add(name, name); newNode.Tag = tag; if (parent.IsExpanded != true) { newNode.Parent.Expand(); } treeView.SelectedNode = newNode; EditNodeLabel(newNode); return(newNode); }
public ItemCommandManager() { _IDatabaseItem = new DatabaseItemSQLite(new LogManager(), System.IO.Path.Combine(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), "DatabaseItem.sqlite")); }