// check witch type of node we dragg private static NodeType CheckCurrentNode(ISharpQueryNode node) { NodeType enm; if (node is SharpQueryNodeColumn) { enm = NodeType.ColumnImage; } else if (node is SharpQueryNodeTable) { enm = NodeType.TableImage; } else if (node is SharpQueryNodeProcedure) { enm = NodeType.ProcedureImage; } else if (node is SharpQueryNodeView) { enm = NodeType.ViewImage; } else { enm = NodeType.NodeError; } return(enm); }
private void SharpQueryTreeAfterSelect(object sender, System.Windows.Forms.TreeViewEventArgs e) { ISharpQueryNode node = e.Node as ISharpQueryNode; if (node != null) { this.currentNode = node; // Set the connectionstring here and toogle EnableNext if (node.Connection != null) { if (node.Connection.ConnectionString.Length > 0) { this.connectionString = node.Connection.ConnectionString; this.txtSqlString.Enabled = true; if (this.firstDrag) { this.txtSqlString.Text = String.Empty; } } else { this.EnableNext = false; } } } }
protected override void OnAfterCollapse(TreeViewEventArgs e) { ISharpQueryNode node = e.Node as ISharpQueryNode; if (node != null) { node.Clear(); } base.OnAfterCollapse(e); }
protected override void OnAfterExpand(TreeViewEventArgs e) { ISharpQueryNode node = e.Node as ISharpQueryNode; if (node != null) { node.Refresh(); } base.OnAfterExpand(e); }
public override void BuildsChilds() { IConnection connection = null; ISharpQueryNode node = null; try { connection = AbstractSharpQueryConnectionWrapper.CreateFromDataConnectionLink(); if (connection != null) { string ChildClass = ""; if (SharpQueryTree.SchemaClassDict.ContainsKey(connection.GetType().FullName) == true) { ChildClass = SharpQueryTree.SchemaClassDict[connection.GetType().FullName]; } if ((ChildClass != null) && (ChildClass != "")) { node = (ISharpQueryNode)ass.CreateInstance(ChildClass, false, BindingFlags.CreateInstance, null, new object[] { connection }, null, null); } else { node = new SharpQueryNodeNotSupported(new SharpQueryNotSupported(connection, "", "", "", connection.GetType().FullName)); } //TODO : do an interface for the node connection! (node as SharpQueryNodeConnection).Connect(); this.Nodes.Add(node as TreeNode); node.Refresh(); if (node.Connection.IsConnectionStringWrong == true) { this.Nodes.Remove(node as TreeNode); } else { this.Expand(); } } } catch (ConnectionStringException e) { if (this.Nodes.Contains(node as TreeNode) == true) { this.Nodes.Remove(node as TreeNode); } MessageService.ShowError(e.Message); } }
///<summary> /// Display the context menu associated with a node type ///</summary> protected override void OnMouseUp(MouseEventArgs e) { if (e.Button == MouseButtons.Right && this.SelectedNode != null && SelectedNode is ISharpQueryNode) { ISharpQueryNode selectedBrowserNode = SelectedNode as ISharpQueryNode; if (selectedBrowserNode.AddinContextMenu != "") { MenuService.ShowContextMenu(this, selectedBrowserNode.AddinContextMenu, this, e.X, e.Y); } } base.OnMouseUp(e); }
public virtual void BuildsChilds() { string childclass = ""; ISharpQueryNode ChildNode = null; if (this.Entities != null) { foreach (KeyValuePair <string, SharpQuerySchemaClassCollection> DicEntry in this.Entities) { if (DicEntry.Value != null) { SharpQuerySchemaClassCollection entitieslist = DicEntry.Value as SharpQuerySchemaClassCollection; foreach (ISchemaClass entity in entitieslist) { childclass = SharpQueryTree.SchemaClassDict[entity.GetType().FullName]; if ((childclass != null) && (childclass != "")) { ChildNode = (ISharpQueryNode)ass.CreateInstance(childclass, false, BindingFlags.CreateInstance, null, new object[] { entity }, null, null); if (ChildNode != null) { bool addNode = true; if (ChildNode is SharpQueryNodeNotSupported) { addNode = this.ShowUnsupported(); } if (addNode == true) { this.Nodes.Add(ChildNode as TreeNode); ChildNode.Refresh(); } } } } } } } }
// check witch type of node we dragg private static NodeType CheckCurrentNode (ISharpQueryNode node) { NodeType enm; if (node is SharpQueryNodeColumn) { enm = NodeType.ColumnImage; } else if (node is SharpQueryNodeTable) { enm = NodeType.TableImage; } else if (node is SharpQueryNodeProcedure) { enm = NodeType.ProcedureImage; } else if (node is SharpQueryNodeView) { enm = NodeType.ViewImage; } else { enm = NodeType.NodeError; } return enm; }
private void SharpQueryTreeAfterSelect(object sender, System.Windows.Forms.TreeViewEventArgs e) { ISharpQueryNode node = e.Node as ISharpQueryNode; if (node != null){ this.currentNode = node; // Set the connectionstring here and toogle EnableNext if (node.Connection != null) { if (node.Connection.ConnectionString.Length > 0) { this.connectionString = node.Connection.ConnectionString; this.txtSqlString.Enabled = true; if (this.firstDrag) { this.txtSqlString.Text = String.Empty; } } else { this.EnableNext = false; } } } }