コード例 #1
0
 /// <summary>
 /// Adds a set of PropertyPage instances to the collection.
 /// </summary>
 /// <param name="items">The items to add.</param>
 public void AddRange(PropertyTabPageCollection items)
 {
     if (items == null)
     {
         throw new ArgumentNullException("items");
     }
     for (int index = 0; index < items.Count; index++)
     {
         Add(items[index]);
     }
 }
コード例 #2
0
        /// <summary>
        /// Updates the view.
        /// </summary>
        private void RefreshView()
        {
            this.tabs.SuspendLayout();
            try
            {
                // clear...
                this.tabs.TabPages.Clear();

                // create...
                if (this.DataSource != null)
                {
                    // set...
                    this.Text = this.DataSource.ToString() + " " + BaseCaption;

                    // get the controls...
                    Control[] controls = this.GetControls(this.DataSource.GetType());
                    if (controls == null)
                    {
                        throw new InvalidOperationException("controls is null.");
                    }

                    // do we have any pages?
                    if (controls.Length > 0)
                    {
                        // create the pages...
                        PropertyTabPageCollection tabPages = new PropertyTabPageCollection();

                        // walk and create...
                        foreach (Control control in controls)
                        {
                            // add the page...
                            PropertyTabPage tabPage = new PropertyTabPage(control);
                            this.tabs.TabPages.Add(tabPage);

                            // do the binding...
                            if (control is IDataControl)
                            {
                                ((IDataControl)control).DataSource = this.DataSource;
                            }
                        }
                    }
                }
                else
                {
                    this.Text = BaseCaption;
                }
            }
            finally
            {
                this.tabs.ResumeLayout();
            }
        }