Наследование: nHydrate.Generator.Common.GeneratorFramework.BaseModelObjectController
Пример #1
0
        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();

		}
Пример #3
0
        //protected ModelObjectTreeNode mRelationCollectionNode = null;

        #endregion

        #region Constructor

        public CustomStoredProcedureNode(CustomStoredProcedureController controller)
            : base(controller)
        {
        }
		//protected ModelObjectTreeNode mRelationCollectionNode = null;

		#endregion

		#region Constructor

		public CustomStoredProcedureNode(CustomStoredProcedureController controller)
			: base(controller)
		{
		}