Inheritance: nHydrate.Generator.Common.GeneratorFramework.BaseModelObjectController
        public override void Refresh()
        {
            if ((this.TreeView != null) && (this.TreeView.InvokeRequired))
            {
                this.TreeView.Invoke(new EmptyDelegate(this.Refresh));
                return;
            }

            this.Text               = "Relationships";
            this.Name               = "Relationships";
            this.ImageIndex         = ImageHelper.GetImageIndex(TreeIconConstants.FolderClose);
            this.SelectedImageIndex = ImageHelper.GetImageIndex(TreeIconConstants.FolderOpen);

            this.Nodes.Clear();
            var referenceCollection = (ReferenceCollection)this.Object;

            foreach (Reference reference in referenceCollection)
            {
                if (this.Nodes.Find(reference.Key, false).Length == 0)
                {
                    var controller = new RelationController(reference.Object);
                    controller.Node.Name = reference.Key;
                    controller.Node.Text = ((Relation)reference.Object).PascalRoleName;
                    this.Nodes.Add(controller.Node);
                }
            }

            //Rename nodes if name change
            foreach (TreeNode node in this.Nodes)
            {
                var item = referenceCollection.FirstOrDefault(x => x.Key == node.Name);
                if (item != null)
                {
                    node.Text = ((Relation)item.Object).PascalRoleName;
                }
            }

            //Remove non-existing nodes
            for (var ii = this.Nodes.Count - 1; ii >= 0; ii--)
            {
                var node = (RelationNode)this.Nodes[ii];
                if (!referenceCollection.Contains(node.Name))
                {
                    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 = "Relationships";
			this.Name = "Relationships";
			this.ImageIndex = ImageHelper.GetImageIndex(TreeIconConstants.FolderClose);
			this.SelectedImageIndex = ImageHelper.GetImageIndex(TreeIconConstants.FolderOpen);

			this.Nodes.Clear();
			var referenceCollection = (ReferenceCollection)this.Object;
			foreach (Reference reference in referenceCollection)
			{
				if (this.Nodes.Find(reference.Key, false).Length == 0)
				{
					var controller = new RelationController(reference.Object);
					controller.Node.Name = reference.Key;
					controller.Node.Text = ((Relation)reference.Object).PascalRoleName;
					this.Nodes.Add(controller.Node);
				}
			}

			//Rename nodes if name change
			foreach (TreeNode node in this.Nodes)
			{
				var item = referenceCollection.FirstOrDefault(x => x.Key == node.Name);
				if (item != null) node.Text = ((Relation)item.Object).PascalRoleName;
			}

			//Remove non-existing nodes
			for (var ii = this.Nodes.Count - 1; ii >= 0; ii--)
			{
				var node = (RelationNode)this.Nodes[ii];
				if (!referenceCollection.Contains(node.Name))
				{
					this.Nodes.RemoveAt(ii);
				}
			}

			this.Sort();

			this.Controller.UIControl.Refresh();

		}
Exemple #3
0
		public RelationNode(RelationController controller)
			: base(controller)
		{
		}
Exemple #4
0
 public RelationNode(RelationController controller)
     : base(controller)
 {
 }