Esempio n. 1
0
        private void InitializeSettingView()
        {
            _vistaMenuCtrl = new VistaMenuControl();

            this.panelLeft.Controls.Add(_vistaMenuCtrl);
            _vistaMenuCtrl.MaximumSize = new Size(0, 0);
            _vistaMenuCtrl.MinimumSize = new Size(panelLeft.Width - (panelLeft.Padding.Left + panelLeft.Padding.Right),
                                                  panelLeft.Height - (panelLeft.Padding.Top + panelLeft.Padding.Bottom));
            _vistaMenuCtrl.Dock = DockStyle.Fill;

            _vistaMenuCtrl.SideBar              = false;
            _vistaMenuCtrl.SideBarCaption       = Resources.FormSettingMenuSidebar_Caption;
            _vistaMenuCtrl.SideBarEndGradient   = Color.FromArgb(81, 69, 59);
            _vistaMenuCtrl.SideBarStartGradient = Color.DarkOrange;
            _vistaMenuCtrl.SideBarFontColor     = Color.Black;

            _vistaMenuCtrl.MenuStartColor = Color.FromArgb(239, 239, 239);
            _vistaMenuCtrl.MenuEndColor   = Color.FromArgb(202, 202, 202);

            _vistaMenuCtrl.MenuInnerBorderColor = Color.FromArgb(167, 162, 158);
            _vistaMenuCtrl.MenuOuterBorderColor = Color.FromArgb(47, 37, 28);

            _vistaMenuCtrl.RenderSeparators = false;
            _vistaMenuCtrl.CheckOnClick     = true;
            _vistaMenuCtrl.ItemHeight       = 48;
            _vistaMenuCtrl.ItemWidth        = 48;
            _vistaMenuCtrl.BackImageAlign   = System.Drawing.ContentAlignment.TopRight;
            _vistaMenuCtrl.MenuOrientation  = VistaMenuControl.VistaMenuOrientation.Vertical;
            _vistaMenuCtrl.SelectedItem     = -1;
            _vistaMenuCtrl.SideBarFont      = new System.Drawing.Font("Microsoft Sans Serif", 12F);
            _vistaMenuCtrl.SideBarFontColor = System.Drawing.Color.White;

            VistaMenuItem         menuItem    = CreateSettingMenuItem(eMenuSettings_Icon.Connection);
            CtrlListItemContainer settingPage = CreateSettingCtrlPage(menuItem);

            settingPage.BorderStyle = BorderStyle.None;
            settingPage.Dock        = DockStyle.Fill;
            _vistaMenuCtrl.Items.Add(menuItem);
            this.panelRight.Controls.Add(settingPage);

            menuItem                = CreateSettingMenuItem(eMenuSettings_Icon.SyncItems);
            settingPage             = CreateSettingCtrlPage(menuItem);
            settingPage.BorderStyle = BorderStyle.None;
            settingPage.Dock        = DockStyle.Fill;
            _vistaMenuCtrl.Items.Add(menuItem);
            this.panelRight.Controls.Add(settingPage);

            _vistaMenuCtrl.VistaMenuItemClick += vistaMenuCtrl_itemclick;

            this._minHeight = this.panelLeft.Height;
        }
Esempio n. 2
0
        private void SetCurrentSettingPage(VistaMenuItem menuItem)
        {
            if (_settingPagesMapping == null)
            {
                throw new ArgumentNullException("not initialized");
            }

            foreach (KeyValuePair <VistaMenuItem, Control> pageSettingMap in _settingPagesMapping)
            {
                bool selected = pageSettingMap.Key == menuItem;
                //Меняем высоту в соотв с содержимым
                if (pageSettingMap.Key == menuItem)
                {
                    CtrlListItemContainer container = pageSettingMap.Value as CtrlListItemContainer;
                    if (container != null)
                    {
                        int newHeight = Math.Max(this.panel3.Height + container.ItemsHeight, _minHeight);
                        int delta     = newHeight - this.panel1.Height;
                        this.Height += delta;
                    }
                }
                pageSettingMap.Value.Visible = selected;
            }
        }
Esempio n. 3
0
        private CtrlListItemContainer CreateSettingCtrlPage(VistaMenuItem menuItem)
        {
            CtrlListItemContainer retVal = new CtrlListItemContainer();

            switch ((eMenuSettings_Icon)menuItem.ItemTag)
            {
            case eMenuSettings_Icon.Connection:
                CtrlSyncConnection ctrSettingConnection = new CtrlSyncConnection(imageList32);
                ctrSettingConnection.Header.Caption = Resources.FormSetting_Connection_Caption;
                retVal.AddItem(ctrSettingConnection);
                break;

            case eMenuSettings_Icon.SyncItems:
                foreach (Outlook.OlItemType itemType in AvailSettingTypes)
                {
                    CtrlExtendedListItemBase listItem = CreateSyncItemSetting(itemType);
                    if (listItem != null)
                    {
                        retVal.AddItem(listItem);
                        retVal.SelectedItem = listItem;
                    }
                }
                break;
            }

            if (retVal != null)
            {
                if (_settingPagesMapping == null)
                {
                    _settingPagesMapping = new Dictionary <VistaMenuItem, Control>();
                }
                _settingPagesMapping.Add(menuItem, retVal);
            }

            return(retVal);
        }