Ejemplo n.º 1
0
        /// <remarks>Cannot add the same tab more than once. Cannot add a tab with the same name as
        /// an existing tab.</remarks>
        public void AddTab(Tab tab)
        {
            if (tab == null)
            {
                throw new ArgumentNullException("tab");
            }
            if (_itemAreas.Keys.Where(existingTab => existingTab.Name == tab.Name).Count() > 0)
            {
                throw new ArgumentException("cannot add a tab with the same name as an existing tab");
            }

            var tabButton = new OutlookBarButton
            {
                Name    = tab.Name,
                Text    = tab.Text,
                Image   = tab.Icon,
                Enabled = tab.Enabled,
                Tag     = tab
            };

            _tabArea.Buttons.Add(tabButton);
            tab.UnderlyingWidget = tabButton;

            IItemArea itemArea;

            switch (ItemAreaStyle)
            {
            case SidePaneItemAreaStyle.StripList:
                itemArea = new StripListItemArea();
                break;

            case SidePaneItemAreaStyle.List:
                itemArea = new ListViewItemArea();
                break;

            case SidePaneItemAreaStyle.Buttons:
            default:
                itemArea = new OutlookButtonPanelItemArea
                {
                    Dock = DockStyle.Fill
                };
                break;
            }
            itemArea.ItemClicked += HandleClickFromItemArea;
            _itemAreas.Add(tab, itemArea);
            _itemAreaContainer.Controls.Add(itemArea.AsControl());

            // Expand tab area to show this tab
            _tabArea.ShowAnotherButton();
        }
Ejemplo n.º 2
0
		/// <remarks>Cannot add the same tab more than once. Cannot add a tab with the same name as
		/// an existing tab.</remarks>
		public void AddTab(Tab tab)
		{
			if (tab == null)
				throw new ArgumentNullException("tab");
			if (_itemAreas.Keys.Where(existingTab => existingTab.Name == tab.Name).Count() > 0)
				throw new ArgumentException("cannot add a tab with the same name as an existing tab");

			var tabButton = new OutlookBarButton
				{
			Name = tab.Name,
			Text = tab.Text,
			Image = tab.Icon,
			Enabled = tab.Enabled,
			Tag = tab
				};
			_tabArea.Buttons.Add(tabButton);
			tab.UnderlyingWidget = tabButton;

			IItemArea itemArea;
			switch (ItemAreaStyle)
			{
				case SidePaneItemAreaStyle.StripList:
					itemArea = new StripListItemArea();
					break;

				case SidePaneItemAreaStyle.List:
					itemArea = new ListViewItemArea();
					break;

				case SidePaneItemAreaStyle.Buttons:
				default:
					itemArea = new OutlookButtonPanelItemArea
						{
							Dock = DockStyle.Fill
						};
					break;
			}
			itemArea.ItemClicked += HandleClickFromItemArea;
			_itemAreas.Add(tab, itemArea);
			_itemAreaContainer.Controls.Add(itemArea.AsControl());

			// Expand tab area to show this tab
			_tabArea.ShowAnotherButton();
		}