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

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

                var tableComponentCollection = (TableComponentCollection)this.Object;

                //Add new nodes
                foreach (TableComponent component in tableComponentCollection)
                {
                    if (this.Nodes.Find(component.Key, false).Length == 0)
                    {
                        var tc = new TableComponentController(component);
                        tc.Node.Name = component.Key;
                        tc.Node.Text = component.Name;
                        this.Nodes.Add(tc.Node);
                    }
                }

                //Rename nodes if name change
                foreach (TreeNode node in this.Nodes)
                {
                    var item = tableComponentCollection.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 = (TableComponentNode)this.Nodes[ii];
                    if (tableComponentCollection.GetByKey(node.Name) == null)
                    {
                        this.Nodes.RemoveAt(ii);
                    }
                }

                this.Sort();

                this.Controller.UIControl.Refresh();
            }
            catch (Exception ex)
            {
                throw;
            }
        }
		public override void Refresh()
		{
			try
			{
				if ((this.TreeView != null) && (this.TreeView.InvokeRequired))
				{
					this.TreeView.Invoke(new EmptyDelegate(this.Refresh));
					return;
				}

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

				var tableComponentCollection = (TableComponentCollection)this.Object;

				//Add new nodes      
				foreach (TableComponent component in tableComponentCollection)
				{
					if (this.Nodes.Find(component.Key, false).Length == 0)
					{
						var tc = new TableComponentController(component);
						tc.Node.Name = component.Key;
						tc.Node.Text = component.Name;
						this.Nodes.Add(tc.Node);
					}
				}

				//Rename nodes if name change
				foreach (TreeNode node in this.Nodes)
				{
					var item = tableComponentCollection.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 = (TableComponentNode)this.Nodes[ii];
					if (tableComponentCollection.GetByKey(node.Name) == null)
					{
						this.Nodes.RemoveAt(ii);
					}
				}

				this.Sort();

				this.Controller.UIControl.Refresh();

			}
			catch (Exception ex)
			{
				throw;
			}

		}
Esempio n. 3
0
 public TableComponentNode(TableComponentController controller)
     : base(controller)
 {
 }
Esempio n. 4
0
		public TableComponentNode(TableComponentController controller)
			: base(controller)
		{
		}