예제 #1
0
        /// <summary>
        /// 转到指定的Css主面板
        /// </summary>
        /// <param name="listBoxValue"></param>
        /// <returns></returns>
        private void GotoMainControl(string listBoxValue)
        {
            ///找到将要显示的新主面板
            CssMainControl willGotoMainControl = _mainControls[listBoxValue];

            ///若新的和原来的是一个,则不执行
            if (CurrentMainControl == willGotoMainControl)
            {
                return;
            }

            ///退出原主面板
            if (CurrentMainControl != null)
            {
                ///验证失败,则不进入新主面板
                bool result = CurrentMainControl.LeaveValidate();
                if (!result)
                {
                    listBoxLeftType.SelectedItem = _oldListBoxLeftTypeValue;
                    return;
                }
                CurrentMainControl.Visible = false;
            }

            ///进入新主面板
            willGotoMainControl.EnterLoad();
            willGotoMainControl.Visible = true;
            CurrentMainControl          = willGotoMainControl;
            _oldListBoxLeftTypeValue    = listBoxValue;
        }
예제 #2
0
        public CssSettingForm(string css)
        {
            _cssSection = CssSection.Parse(css);

            InitializeComponent();

            ///初始化时便生成所有面板
            foreach (object item in listBoxLeftType.Items)
            {
                CssMainControl newMainControl = CssMainControl.Create(item.ToString(), _cssSection);
                this.splitContainerUI.Panel2.Controls.Add(newMainControl);
                newMainControl.Visible = false;

                _mainControls.Add(item.ToString(), newMainControl);
            }

            ///显示第一个Css主面板
            listBoxLeftType.SelectedIndex = 0;
        }