Esempio n. 1
0
        /// <summary>
        /// 构造函数。
        /// </summary>
        /// <param name="sp">表示采样管理信息的实体对象。</param>
        public SampViewContent(SampManage sp)
            : base()
        {
            if (null != sp && sp.SpName.Length > 0)
            {
                this.TitleName = StringParser.Parse("${res:FanHai.Hemera.Addins.EDC.SampViewContent}") + "_" + sp.SpName;
            }
            else
            {
                this.TitleName = StringParser.Parse("${res:FanHai.Hemera.Addins.EDC.SampViewContent}");
            }

            Panel panel = new Panel();

            //set panel dock style
            panel.Dock = DockStyle.Fill;
            //set panel BorderStyle
            panel.BorderStyle = BorderStyle.FixedSingle;

            sampManageCtl = new SampManageCtl(sp);

            sampManageCtl.Dock = DockStyle.Fill;

            //add control to panle
            panel.Controls.Add(sampManageCtl);
            //set panel to view content
            this.control = panel;
        }
Esempio n. 2
0
        /// <summary>
        /// Construct function
        /// </summary>
        public SampManageCtl(SampManage sp)
        {
            InitializeComponent();
            afterStateChanged += new AfterStateChanged(this.OnAfterStateChanged);

            _sp = sp;

            if (null == _sp || _sp.SpName.Length < 1)
            {
                CtrlState = ControlState.New;
            }
            else
            {
                if (_sp.Status == EntityStatus.InActive)
                {
                    CtrlState = ControlState.Edit;
                }
                else
                {
                    CtrlState = ControlState.ReadOnly;
                }

                MapSampToControls();
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Control state change method
        /// </summary>
        /// <param name="state">Control state</param>
        private void OnAfterStateChanged(ControlState state)
        {
            switch (state)
            {
                #region case state of editer
            case ControlState.Edit:
                toolbarSave.Enabled   = true;
                toolbarDelete.Enabled = true;
                toolbarStatus.Enabled = true;

                txtSpName.Properties.ReadOnly = true;
                break;
                #endregion

                #region case state of New
            case ControlState.New:
                txtSpName.Properties.ReadOnly = false;
                //txtSpSize.Properties.ReadOnly = false;
                txtSpVersion.Properties.ReadOnly = false;
                //txtSpMaxSize.Properties.ReadOnly = false;
                txtSpUnitSize.Properties.ReadOnly = false;

                lpSampMode.Properties.ReadOnly = false;
                lpUnitMode.Properties.ReadOnly = false;
                //cbxSpPercentFlag.Enabled = true;

                mmSpDescription.Properties.ReadOnly = false;

                toolbarSave.Enabled   = true;
                toolbarStatus.Enabled = false;
                toolbarDelete.Enabled = false;

                _sp = new SampManage();
                MapSampToControls();
                break;
                #endregion

                #region case state of ReadOnly
            case ControlState.ReadOnly:
                txtSpName.Properties.ReadOnly = true;
                //txtSpSize.Properties.ReadOnly = true;
                txtSpVersion.Properties.ReadOnly = true;
                //txtSpMaxSize.Properties.ReadOnly = true;
                txtSpUnitSize.Properties.ReadOnly = true;

                lpSampMode.Properties.ReadOnly = true;
                lpUnitMode.Properties.ReadOnly = true;
                //cbxSpPercentFlag.Enabled = false;

                mmSpDescription.Properties.ReadOnly = true;

                toolbarSave.Enabled   = false;
                toolbarDelete.Enabled = false;
                break;
                #endregion
            }
            toolbarNew.Enabled   = true;
            toolbarQuery.Enabled = true;
        }