Пример #1
0
        /// <summary>
        /// Refresh the list of Asset Types for the currently selected asset type category
        /// </summary>
        /// <param name="category"></param>
        private void RefreshList(UserDataCategory category)
        {
            ulvUserData.BeginUpdate();
            ulvUserData.Items.Clear();

            // Get the small icon which we will display
            Bitmap image = IconMapping.LoadIcon(category.Icon, IconMapping.Iconsize.Small);

            // Add the items to the list
            foreach (UserDataField field in category)
            {
                // Subitems are type and description
                UltraListViewSubItem[] subItemArray = new UltraListViewSubItem[2];
                subItemArray[0] = new UltraListViewSubItem {
                    Value = field.TypeAsString
                };
                subItemArray[1] = new UltraListViewSubItem {
                    Value = field.Description()
                };
                //
                UltraListViewItem lvi = new UltraListViewItem(field.Name, subItemArray);
                lvi.Tag = field;
                lvi.Appearance.Image = image;
                ulvUserData.Items.Add(lvi);
            }
            ulvUserData.EndUpdate();
        }
Пример #2
0
        /// <summary>
        /// Called to refresh the information displayed on this tab
        /// </summary>
        protected void RefreshTab()
        {
            this.assettypesExplorerBar.Groups[0].Items.Clear();
            _listAssetTypes = new AssetTypeList();
            _listAssetTypes.Populate();

            // We now need to display the Asset Type categories in the main ExplorerBar
            AssetTypeList categories = _listAssetTypes.EnumerateCategories();

            foreach (AssetType category in categories)
            {
                UltraExplorerBarItem item = this.assettypesExplorerBar.Groups[0].Items.Add(category.Name, category.Name);
                item.Settings.AppearancesLarge.Appearance.Image = IconMapping.LoadIcon(category.Icon, IconMapping.Iconsize.Medium);
                item.Tag = category;
            }

            // If nothing is selected in the Explorer View then select the first entry
            if (this.assettypesExplorerBar.ActiveItem == null)
            {
                if ((_activeItem == null) || (!this.assettypesExplorerBar.Groups[0].Items.Contains(_activeItem)))
                {
                    this.assettypesExplorerBar.ActiveItem = this.assettypesExplorerBar.Groups[0].Items[0];
                    _activeItem = this.assettypesExplorerBar.Groups[0].Items[0];
                }
                else
                {
                    this.assettypesExplorerBar.ActiveItem = _activeItem;
                }
            }
        }
Пример #3
0
        /// <summary>
        /// Refresh the list of Asset Types for the currently selected asset type category
        /// </summary>
        /// <param name="categoryID"></param>
        private void RefreshList(int categoryID)
        {
            // Call BeginUpdate and set the wait cursor while we refresh
            this.ulvAssetTypes.BeginUpdate();
            this.Cursor = Cursors.WaitCursor;

            // Clear any existing items from the view
            ulvAssetTypes.Items.Clear();

            // ...Get the children to display
            AssetTypeList listSubTypes = _listAssetTypes.EnumerateChildren(categoryID);

            // ...and add to the list view
            foreach (AssetType assettype in listSubTypes)
            {
                Bitmap            icon = IconMapping.LoadIcon(assettype.Icon, IconMapping.Iconsize.Small);
                UltraListViewItem lvi  = new UltraListViewItem(assettype, null);
                lvi.Appearance.Image = icon;
                lvi.Tag = assettype;
                ulvAssetTypes.Items.Add(lvi);
            }

            // Restore the cursor and end the update
            this.Cursor = Cursors.Default;
            this.ulvAssetTypes.EndUpdate(true);
        }
        protected void PopulateUserDataDetails(UltraTreeNode rootNode)
        {
            if (rootNode.Text != AWMiscStrings.UserDataNode)
            {
                return;
            }

            UserDataCategoryList userDataCategories = new UserDataCategoryList(UserDataCategory.SCOPE.Asset);

            userDataCategories.Populate();

            foreach (UserDataCategory category in userDataCategories)
            {
                if (category.Scope == UserDataCategory.SCOPE.Asset)
                {
                    UltraTreeNode categoryNode = new UltraTreeNode(AWMiscStrings.UserDataNode + @"|" + category.Name, category.Name);
                    categoryNode.LeftImages.Add(IconMapping.LoadIcon(category.Icon, IconMapping.Iconsize.Small));
                    //categoryNode.Tag = eRootTypes.userdata + category.CategoryID;
                    rootNode.Nodes.Add(categoryNode);
                    categoryNode.Tag = eRootTypes.userdata;

                    // Add fields within this category
                    foreach (UserDataField field in category)
                    {
                        UltraTreeNode fieldNode = new UltraTreeNode(categoryNode.Key + @"|" + field.Name, field.Name);
                        fieldNode.LeftImages.Add(IconMapping.LoadIcon(category.Icon, IconMapping.Iconsize.Small));
                        fieldNode.Override.ShowExpansionIndicator = ShowExpansionIndicator.Never;
                        //fieldNode.Tag = eRootTypes.userdata;
                        categoryNode.Nodes.Add(fieldNode);
                        fieldNode.Tag = eRootTypes.userdata;
                    }
                }
            }
        }
Пример #5
0
 /// <summary>
 /// Called as the displayed text changes as this should cause the preview icon to change also
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void tbIconFile_TextChanged(object sender, EventArgs e)
 {
     if (tbIconFile.Name == "")
     {
         return;
     }
     pbIcon.Image = IconMapping.LoadIcon(tbIconFile.Text, IconMapping.Iconsize.Medium);
 }
Пример #6
0
        /// <summary>
        /// Called to refresh the information displayed on the users tab
        /// </summary>
        protected void RefreshTab()
        {
            _listCategories.Scope = _currentScope;
            UserDataCategory dummy = new UserDataCategory(_currentScope);

            headerLabel.Text = "User Defined Data [" + dummy.ScopeAsString + "]";

            // Read the user defined data definitions from the database making sure that we set the
            // required scope first
            _listCategories.Populate();

            // Clear the list
            ulvUserData.Items.Clear();

            // Add the categories to the Explorer View
            userDataExplorerBar.BeginUpdate();
            userDataExplorerBar.Groups[0].Items.Clear();
            //
            foreach (UserDataCategory category in _listCategories)
            {
                UltraExplorerBarItem item = userDataExplorerBar.Groups[0].Items.Add(category.Name, category.Name);
                item.Settings.AppearancesLarge.Appearance.Image = IconMapping.LoadIcon(category.Icon, IconMapping.Iconsize.Medium);
                item.Tag = category;
            }

            // If nothing is selected in the Explorer View then select the first entry if there are any
            if (userDataExplorerBar.Groups[0].Items.Count != 0)
            {
                if (_activeItem == null)
                {
                    userDataExplorerBar.ActiveItem = userDataExplorerBar.Groups[0].Items[0];
                    _activeItem = userDataExplorerBar.Groups[0].Items[0];
                }

                else
                {
                    // Can we find the item
                    int index = userDataExplorerBar.Groups[0].Items.IndexOf(_activeItem.Key);
                    if (index != -1)
                    {
                        userDataExplorerBar.ActiveItem = userDataExplorerBar.Groups[0].Items[index];
                    }
                    else
                    {
                        userDataExplorerBar.ActiveItem = userDataExplorerBar.Groups[0].Items[0];
                        _activeItem = userDataExplorerBar.Groups[0].Items[0];
                    }
                }
            }

            userDataExplorerBar.EndUpdate();
        }
Пример #7
0
        private void FormSelectAssetType_Load(object sender, EventArgs e)
        {
            tvAssetTypes.BeginUpdate();
            this.Cursor = Cursors.WaitCursor;

            // get the currebnt list of asset types
            AssetTypeList listAssetTypes = new AssetTypeList();

            listAssetTypes.Populate();

            // We now need to display the Asset Type categories in the main ExplorerBar
            AssetTypeList categories = listAssetTypes.EnumerateCategories();

            foreach (AssetType category in categories)
            {
                Bitmap        icon         = IconMapping.LoadIcon(category.Icon, IconMapping.Iconsize.Small);
                UltraTreeNode categoryNode = tvAssetTypes.Nodes.Add(category.Name, category.Name);
                categoryNode.LeftImages.Add(icon);
                categoryNode.Tag = category;

                // Is this the selected category?
                if (category.AssetTypeID == _selectedAssetTypeID)
                {
                    this.tbSelectedType.Text = category.Name;
                    this.tbSelectedType.Tag  = category;
                }

                // Add the child asset types to the list also
                // ...Get the children to display
                AssetTypeList listSubTypes = listAssetTypes.EnumerateChildren(category.AssetTypeID);

                // ...and add to the list view
                foreach (AssetType assettype in listSubTypes)
                {
                    UltraTreeNode itemNode = categoryNode.Nodes.Add(category.Name + "|" + assettype.Name, assettype.Name);
                    Bitmap        icon2    = IconMapping.LoadIcon(assettype.Icon, IconMapping.Iconsize.Small);
                    itemNode.LeftImages.Add(icon2);
                    itemNode.Tag = assettype;

                    // Is this the selected category?
                    if (assettype.AssetTypeID == _selectedAssetTypeID)
                    {
                        this.tbSelectedType.Text = assettype.Name;
                        this.tbSelectedType.Tag  = assettype;
                    }
                }
            }

            this.Cursor = Cursors.Default;
            tvAssetTypes.EndUpdate();
        }
Пример #8
0
        private void historyGridView_InitializeRow(object sender, InitializeRowEventArgs e)
        {
            // Get the application object being displayed - this is always a tree node in this view
            AuditTrailEntry ate = e.Row.Cells["DataObject"].Value as AuditTrailEntry;

            // The icon displayed will depend on the type of entry - we can have
            //		application installs/uninstalls
            //		audited data changes
            //		audit/reaudit
            if (ate.Class == AuditTrailEntry.CLASS.application_installs)
            {
                e.Row.Cells["Operation"].Appearance.Image = Properties.Resources.application_16;
            }

            else if (ate.Class == AuditTrailEntry.CLASS.audited || ate.Class == AuditTrailEntry.CLASS.reaudited)
            {
                e.Row.Cells["Operation"].Appearance.Image = Properties.Resources.computer16;
            }

            else
            {
                // Recover the Description
                string description = ate.GetTypeDescription();

                // Strip off everything after the last colon (if any)
                int delimiter = description.LastIndexOf(':');
                if (delimiter != -1)
                {
                    description = description.Substring(0, delimiter);
                }

                // Now check this against the database to see if we can find an icon for it
                IconMapping iconMapping = _iconMappings.GetIconMapping(description);
                if (iconMapping != null)
                {
                    e.Row.Cells["Operation"].Appearance.Image = IconMapping.LoadIcon(iconMapping.Icon, IconMapping.Iconsize.Small);
                }
            }
        }
Пример #9
0
        /// <summary>
        /// Return the icon which should display for this asset.
        /// </summary>
        /// <returns></returns>
        public Bitmap DisplayIcon()
        {
            // Load the primary image for this asset - noting that for the 'standard' types
            // (computer, laptop, server, domaincontroller) that we will add the StockStatus to the
            // name to more accurately affect the asset
            string displayIcon = _icon;

            if (displayIcon == "computer.png" || displayIcon == "laptop.png" || displayIcon == "domaincontroller.png" || displayIcon == "server.png")
            {
                string stockStub = "";
                switch (_stockStatus)
                {
                case STOCKSTATUS.disposed: stockStub = "_disposed"; break;

                case STOCKSTATUS.inuse: break;

                case STOCKSTATUS.pendingdisposal: stockStub = "_pending"; break;

                case STOCKSTATUS.stock: stockStub = "_stock"; break;
                }
                //
                displayIcon = displayIcon.Substring(0, displayIcon.Length - 4) + stockStub + ".png";
            }

            // From this we can get the icon
            Bitmap baseImage    = IconMapping.LoadIcon(displayIcon, IconMapping.ICONSIZE.small);
            Bitmap displayImage = new Bitmap(16, 16);

            System.Drawing.Graphics graphics = Graphics.FromImage(displayImage);
            graphics.DrawImage(baseImage, new Point(0, 0));

            // Now add on (any) overlays for the agent status and reaudit request
            // First icon is a little indicator to show if a reaudit has been requested
            if (RequestAudit)
            {
                Bitmap reauditImage = Properties.Resources.asset_reaudit;
                graphics.DrawImage(reauditImage, new Point(0, 9));
            }

            // ..then the AuditAgent Status image in the top left
            if (AgentStatus == Asset.AGENTSTATUS.deployed)
            {
                Bitmap agentImage = Properties.Resources.agent_stopped;
                graphics.DrawImage(agentImage, new Point(0, 0));
            }

            else if (AgentStatus == Asset.AGENTSTATUS.Running)
            {
                Bitmap agentImage = Properties.Resources.agent_active;
                graphics.DrawImage(agentImage, new Point(0, 0));
            }

            // Audited?  - Looks too messy so do not display this icon
            //if (LastAudit.Ticks != 0L)
            //{
            //    Bitmap agentImage = Properties.Resources.audited;
            //    graphics.DrawImage(agentImage, new Point(8, 3));
            //}

            // Return these icons
            return(displayImage);
        }
Пример #10
0
        /// <summary>
        /// Initialize the tab view display
        /// </summary>
        /// <param name="theAsset"></param>
        public void Display(Asset theAsset)
        {
            // Save the asset being displayed
            _displayedAsset = theAsset;

            // Clear the current list of groups
            assetListView.Groups.Clear();
            assetListView.Items.Clear();

            // Add the new group to the list view
            string             groupName = "Audited Data for " + theAsset.Name;
            UltraListViewGroup group     = assetListView.Groups.Add("auditeddata", groupName);

            // Set the group's properties
            group.Visible = true;
            group.Text    = groupName;

            // Now add the items into the group which will act as the placeholders to allow the user
            // to drill down on the audited data
            UltraListViewItem item;

            try
            {
                item                          = assetListView.Items.Add(AWMiscStrings.SummaryNode, "Summary");
                item.Group                    = group;
                item.Appearance.Image         = Properties.Resources.computer96;
                item.Appearance.FontData.Bold = Infragistics.Win.DefaultableBoolean.True;

                if ((theAsset.LastAudit != DateTime.MinValue) && theAsset.Auditable)
                {
                    //
                    item                          = assetListView.Items.Add(AWMiscStrings.ApplicationsNode, "Applications");
                    item.Group                    = group;
                    item.Appearance.Image         = Properties.Resources.application_72;
                    item.Appearance.FontData.Bold = Infragistics.Win.DefaultableBoolean.True;
                    //
                    item                          = assetListView.Items.Add(AWMiscStrings.HardwareNode, "Hardware");
                    item.Group                    = group;
                    item.Appearance.Image         = Properties.Resources.hardware;
                    item.Appearance.FontData.Bold = Infragistics.Win.DefaultableBoolean.True;
                    //
                    item                          = assetListView.Items.Add(AWMiscStrings.InternetNode, "Internet");
                    item.Group                    = group;
                    item.Appearance.Image         = Properties.Resources.internet_explorer_32;
                    item.Appearance.FontData.Bold = Infragistics.Win.DefaultableBoolean.True;
                    //
                    item                          = assetListView.Items.Add(AWMiscStrings.FileSystem, "File System");
                    item.Group                    = group;
                    item.Appearance.Image         = Properties.Resources.filesystem_32;
                    item.Appearance.FontData.Bold = Infragistics.Win.DefaultableBoolean.True;
                    //
                    item                          = assetListView.Items.Add(AWMiscStrings.HistoryNode, "History");
                    item.Group                    = group;
                    item.Appearance.Image         = Properties.Resources.history;
                    item.Appearance.FontData.Bold = Infragistics.Win.DefaultableBoolean.True;
                    //
                    item                          = assetListView.Items.Add(AWMiscStrings.SystemNode, "System");
                    item.Group                    = group;
                    item.Appearance.Image         = Properties.Resources.system_72;
                    item.Appearance.FontData.Bold = Infragistics.Win.DefaultableBoolean.True;

                    // Add on the User Defined Data Categories (if any)
                    NetworkWorkItemController wiController   = WorkItem.Controller as NetworkWorkItemController;
                    UserDataCategoryList      listCategories = new UserDataCategoryList(UserDataCategory.SCOPE.Asset);
                    listCategories.Populate();
                    foreach (UserDataCategory category in listCategories)
                    {
                        // Is this category restricted to a specific asset category or type?
                        if (wiController.CategoryAppliesTo(category, theAsset))
                        {
                            item                          = assetListView.Items.Add(AWMiscStrings.UserDataNode + "|" + category.Name, category.Name);
                            item.Group                    = group;
                            item.Appearance.Image         = IconMapping.LoadIcon(category.Icon, IconMapping.Iconsize.Large);
                            item.Appearance.FontData.Bold = Infragistics.Win.DefaultableBoolean.True;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Failed to add list view item, reason: " + ex.Message);
            }

            // Set the resize for the columns
            //this.assetListView.MainColumn.PerformAutoResize(ColumnAutoSizeMode.Header | ColumnAutoSizeMode.AllItems);
        }
Пример #11
0
 /// <summary>
 /// </summary>
 /// <param name="name">Name of the icon map.</param>
 /// /// <param name="mappings">Icon mappings to be created for the icon map.</param>
 public Update(string name, IconMapping[] mappings)
     : base(name)
 {
     this.mappings = mappings;
 }
Пример #12
0
        /// <summary>
        /// Add a new tab to the tab control for the specified category and add controls to the tab
        /// for the fields within the category
        /// </summary>
        /// <param name="category"></param>
        protected void AddCategory(UserDataCategory category)
        {
            UltraTab selectedTab = dataTabControl.SelectedTab;

            // Create the objects required to add a tab
            UltraTab newTab = new UltraTab();

            newTab.Tag              = category;
            newTab.Key              = "UDD:" + category.Name;
            newTab.Text             = category.Name;
            newTab.ToolTipText      = "Display User Defined Data for " + category.Name;
            newTab.Appearance.Image = IconMapping.LoadIcon(category.Icon, IconMapping.Iconsize.Small);

            // Add the new tab to the control
            dataTabControl.Tabs.Add(newTab);



            if (selectedTab != null)
            {
                foreach (UltraTab tab in dataTabControl.Tabs)
                {
                    if (tab.Key != selectedTab.Key)
                    {
                        continue;
                    }

                    dataTabControl.SelectedTab = tab;
                    break;
                }
            }

            // Create a Table Layout Panel which will fit on the tab
            TableLayoutPanel tableLayoutPanel = new TableLayoutPanel();

            tableLayoutPanel.Anchor   = ((AnchorStyles.Top | AnchorStyles.Bottom) | AnchorStyles.Left) | AnchorStyles.Right;
            tableLayoutPanel.Location = new Point(10, 10);
            tableLayoutPanel.Padding  = new Padding(10);
            tableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Absolute, 30F));
            tableLayoutPanel.TabIndex    = 0;
            tableLayoutPanel.RowCount    = 12;
            tableLayoutPanel.ColumnCount = 2;
            tableLayoutPanel.Dock        = DockStyle.Fill;

            GroupBox gb = new GroupBox
            {
                Text     = category.Name,
                Location = new Point(12, 20),
                Size     = new Size(800, 400),
                Padding  = new Padding(15, 15, 15, 15)
            };

            gb.Controls.Add(tableLayoutPanel);
            newTab.TabPage.Controls.Add(gb);

            Size containerSize = newTab.TabPage.Size;
            Size tableSize     = new Size(containerSize.Width - 20, containerSize.Height - 20);

            tableLayoutPanel.Size       = tableSize;
            tableLayoutPanel.AutoScroll = true;

            // Get the list of fields which form this category
            List <Control> listControls = new List <Control>();

            foreach (UserDataField dataField in category)
            {
                Label   label;
                Control control;

                switch ((int)dataField.Type)
                {
                case (int)UserDataField.FieldType.Number:
                    CreateNumberField(dataField, out label, out control);
                    break;

                case (int)UserDataField.FieldType.Picklist:
                    CreatePicklistField(dataField, out label, out control);
                    break;

                case (int)UserDataField.FieldType.Date:
                    CreateDateField(dataField, out label, out control);
                    break;

                case (int)UserDataField.FieldType.Currency:
                    CreateCurrencyField(dataField, out label, out control);
                    break;

                case (int)UserDataField.FieldType.Registry:
                    CreateEnvironmentOrRegistryField(dataField, out label, out control);
                    break;

                case (int)UserDataField.FieldType.Environment:
                    CreateEnvironmentOrRegistryField(dataField, out label, out control);
                    break;

                default:
                    CreateTextField(dataField, out label, out control);
                    break;
                }

                // Add the controls to the panel
                listControls.Add(label);
                control.Tag = dataField;
                listControls.Add(control);

                // Ensure that the user data field knows about its display control
                dataField.Tag = control;
            }

            // Suspend Layout of the table as we add the rows
            tableLayoutPanel.SuspendLayout();

            // Now add the controls as pairs to the table
            int row    = 0;
            int column = 0;

            for (int isub = 0; isub < listControls.Count; isub += 2)
            {
                // Get the controls
                Label   label   = (Label)listControls[isub];
                Control control = listControls[isub + 1];

                // Ensure that the controls will align at the top, left of their cell
                label.Anchor     = AnchorStyles.Left | AnchorStyles.None;
                label.Location   = new Point(0, 0);
                label.TextAlign  = ContentAlignment.MiddleCenter;
                label.Padding    = new Padding(5);
                control.Anchor   = AnchorStyles.Left | AnchorStyles.None;
                control.Padding  = new Padding(5);
                control.Location = new Point(0, 0);

                // Are we at the end of the rows?  If so reset to row 0 but now start at column 3
                if (row >= tableLayoutPanel.RowCount)
                {
                    row    = 0;
                    column = 3;
                }

                // Add the data to the row
                tableLayoutPanel.Controls.Add(label, column, row);
                tableLayoutPanel.Controls.Add(control, column + 1, row);

                // next row
                row++;
            }

            // Resume and perform the layout
            tableLayoutPanel.ResumeLayout();
            tableLayoutPanel.PerformLayout();
        }
Пример #13
0
        /// <summary>
        /// Add a new tab to the tab control for the specified category and add controls to the tab
        /// for the fields within the category
        /// </summary>
        /// <param name="category"></param>
        protected void AddCategory(UserDataCategory category)
        {
            // Create the objects required to add a tab
            UltraTab newTab = new UltraTab();

            newTab.Tag = category;
            Infragistics.Win.Appearance newAppearance = new Infragistics.Win.Appearance();

            // Add the new tab to the control
            this.dataTabControl.Tabs.Add(newTab);

            // Set the tab appearance
            newAppearance.Image = IconMapping.LoadIcon(category.Icon, IconMapping.Iconsize.Small);
            newTab.Appearance   = newAppearance;
            newTab.Text         = category.Name;

            // Create a Table Layout Panel which will fit on the tab
            TableLayoutPanel tableLayoutPanel = new TableLayoutPanel();

            //
            // tableLayoutPanel
            //
            tableLayoutPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                                                                             | System.Windows.Forms.AnchorStyles.Left)
                                                                            | System.Windows.Forms.AnchorStyles.Right)));
            //tableLayoutPanel.CellBorderStyle = System.Windows.Forms.TableLayoutPanelCellBorderStyle.Single;
            tableLayoutPanel.Location = new System.Drawing.Point(10, 10);
            tableLayoutPanel.Padding  = new System.Windows.Forms.Padding(5);
            tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 30F));
            tableLayoutPanel.TabIndex = 0;

            // How many rows do we need?  We will try and limit to 12 rows but we may need to increase this depending on
            // how many fields there are.
            if (category.Count > 30)
            {
                tableLayoutPanel.RowCount = (category.Count / 2);
            }
            else
            {
                tableLayoutPanel.RowCount = 12;
            }

            // Either one or two sets of columns
            if (tableLayoutPanel.RowCount <= 12)
            {
                tableLayoutPanel.ColumnCount = 2;
                tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 30F));
                tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 70F));
            }
            else
            {
                tableLayoutPanel.ColumnCount = 5;
                tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 15F));
                tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 30F));
                tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 10F));
                tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 15F));
                tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 30F));
            }


            // Add this to the tab
            newTab.TabPage.Controls.Add(tableLayoutPanel);
            Size containerSize = newTab.TabPage.Size;
            Size tableSize     = new Size(containerSize.Width - 20, containerSize.Height - 20);

            tableLayoutPanel.Size = tableSize;


            // Get the list of fields which form this category
            List <Control> listControls = new List <Control>();

            foreach (UserDataField dataField in category)
            {
                Label   label   = null;
                Control control = null;

                switch ((int)dataField.Type)
                {
                //case (int)UserDataField.FieldType.boolean:
                //	CreateBooleanField(dataField, out label, out control);
                //	break;

                //case (int)UserDataField.FieldType.date:
                //	CreateDateField(dataField, out label, out control);
                //	break;

                case (int)UserDataField.FieldType.Number:
                    CreateNumberField(dataField, out label, out control);
                    break;

                case (int)UserDataField.FieldType.Picklist:
                    CreatePicklistField(dataField, out label, out control);
                    break;

                case (int)UserDataField.FieldType.Text:
                    CreateTextField(dataField, out label, out control);
                    break;

                default:
                    CreateTextField(dataField, out label, out control);
                    break;
                }

                // Add the controls to the panel
                listControls.Add(label);
                control.Tag = dataField;
                listControls.Add(control);

                // Ensure that the user data field knows about its display control
                dataField.Tag = control;
            }

            // Suspend Layout of the table as we add the rows
            tableLayoutPanel.SuspendLayout();

            // Now add the controls as pairs to the table
            int row    = 0;
            int column = 0;

            for (int isub = 0; isub < listControls.Count; isub += 2)
            {
                // Get the controls
                Label   label   = (Label)listControls[isub];
                Control control = listControls[isub + 1];

                // Ensure that the controls will align at the top, left of their cell
                label.Anchor     = AnchorStyles.Left | AnchorStyles.Top;
                label.Location   = new Point(0, 0);
                control.Anchor   = AnchorStyles.Left | AnchorStyles.Top;
                control.Location = new Point(0, 0);

                // Are we at the end of the rows?  If so reset to row 0 but now start at column 3
                if (row >= tableLayoutPanel.RowCount)
                {
                    row    = 0;
                    column = 3;
                }

                // Add the data to the row
                tableLayoutPanel.Controls.Add(label, column, row);
                tableLayoutPanel.Controls.Add(control, column + 1, row);

                // next row
                row++;
            }

            // Resume and perform the layout
            tableLayoutPanel.ResumeLayout();
            tableLayoutPanel.PerformLayout();
        }