public override void Refresh() { if ((this.TreeView != null) && (this.TreeView.InvokeRequired)) { this.TreeView.Invoke(new EmptyDelegate(this.Refresh)); return; } this.Text = "Custom Stored Procedures"; this.Name = "Custom Stored Procedures"; this.ImageIndex = ImageHelper.GetImageIndex(TreeIconConstants.CustomStoredProcedures); this.SelectedImageIndex = this.ImageIndex; var customStoredProcedureCollection = (CustomStoredProcedureCollection)this.Object; //Add new nodes foreach (CustomStoredProcedure customStoredProcedure in customStoredProcedureCollection) { if (this.Nodes.Find(customStoredProcedure.Key, false).Length == 0) { var tc = new CustomStoredProcedureController(customStoredProcedure); tc.Node.Name = customStoredProcedure.Key; tc.Node.Text = customStoredProcedure.Name; this.Nodes.Add(tc.Node); } } //Rename nodes if name change foreach (TreeNode node in this.Nodes) { var item = customStoredProcedureCollection.FirstOrDefault(x => x.Key == node.Name); if ((item != null) && (node.Text != item.Name)) { node.Text = item.Name; } } //Remove non-existing nodes for (var ii = this.Nodes.Count - 1; ii >= 0; ii--) { var node = (CustomStoredProcedureNode)this.Nodes[ii]; if (!customStoredProcedureCollection.Contains(node.Text)) { this.Nodes.RemoveAt(ii); } } this.Sort(); this.Controller.UIControl.Refresh(); }
public override void Refresh() { if((this.TreeView != null) && (this.TreeView.InvokeRequired)) { this.TreeView.Invoke(new EmptyDelegate(this.Refresh)); return; } this.Text = "Custom Stored Procedures"; this.Name = "Custom Stored Procedures"; this.ImageIndex = ImageHelper.GetImageIndex(TreeIconConstants.CustomStoredProcedures); this.SelectedImageIndex = this.ImageIndex; var customStoredProcedureCollection = (CustomStoredProcedureCollection)this.Object; //Add new nodes foreach(CustomStoredProcedure customStoredProcedure in customStoredProcedureCollection) { if(this.Nodes.Find(customStoredProcedure.Key, false).Length == 0) { var tc = new CustomStoredProcedureController(customStoredProcedure); tc.Node.Name = customStoredProcedure.Key; tc.Node.Text = customStoredProcedure.Name; this.Nodes.Add(tc.Node); } } //Rename nodes if name change foreach (TreeNode node in this.Nodes) { var item = customStoredProcedureCollection.FirstOrDefault(x => x.Key == node.Name); if ((item != null) && (node.Text != item.Name)) node.Text = item.Name; } //Remove non-existing nodes for(var ii = this.Nodes.Count - 1 ; ii >= 0 ; ii--) { var node = (CustomStoredProcedureNode)this.Nodes[ii]; if(!customStoredProcedureCollection.Contains(node.Text)) { this.Nodes.RemoveAt(ii); } } this.Sort(); this.Controller.UIControl.Refresh(); }
//protected ModelObjectTreeNode mRelationCollectionNode = null; #endregion #region Constructor public CustomStoredProcedureNode(CustomStoredProcedureController controller) : base(controller) { }