Esempio n. 1
0
        void LinkEntityLine(EditLine line)
        {
            if (line == null)
            {
                return;
            }

            this.BaseForm.DisableWizardControl();
            {
                this.label_name.Text    = line.Caption;
                this.textBox_input.Text = line.Content;

                this._currentValueList = this._currentEntityControl.GetLineValueList(line);

                line.ActiveState = true;
                this.BaseForm.EnsureEntityVisible(line.EditControl);
                // 把加号按钮修改为一般状态
                PlusButton plus = this.BaseForm.GetEntityPlusButton();
                if (plus != null)
                {
                    plus.Active = false;
                }
            }
            this.BaseForm.EnableWizardControl();
        }
Esempio n. 2
0
        // return:
        //      false   出错
        //      true    成功
        public bool SetStep(Step step, string strStyle = "")
        {
            int nRet = 0;

            Step save = this._step;

REDO_SETSTEP:

            this._step = step;

            this.DisplayInfo(Step.None);

            if (step == Step.None)
            {
                SetTarget("None");
                this.EnableInput(false);
                return(true);
            }

            // 准备检索书目
            if (step == Step.PrepareSearchBiblio)
            {
                this.label_name.Text = "请输入检索词";

                this._currenBiblioLine     = null;
                this._currentEntityControl = null;
                this._currentEntityLine    = null;

                this.EnableInput(true);

                if (StringUtil.IsInList("dont_clear", strStyle) == false)
                {
                    this.textBox_input.Text = "";

                    // 操作前要确保各种修改已经自动保存,以免出现提示保存的对话框导致破坏流畅性
                    // return:
                    //      -1      保存过程出错
                    //      0       成功
                    nRet = this.BaseForm.ReStart();
                    if (nRet == -1)
                    {
                        this.DisplayError("操作出错");
                        this._step = save;
                        return(false);
                    }
                }

                if (StringUtil.IsInList("dont_hilight", strStyle) == false)
                {
                    this.EnableInput(true);

                    this.textBox_input.SelectAll();
                    this.textBox_input.Focus(); // 将输入焦点切换回来
                }
                SetTarget("QueryWord");
                DisplayInfo(step);
                return(true);
            }

            if (step == Step.SearchingBiblio)
            {
                this.SetTarget("ResultList");
                DisplayInfo(step);
                return(true);
            }

            if (step == Step.SearchBiblioCompleted)
            {
                this.EnableInput(true);

                this.SetTarget("ResultList");
                DisplayInfo(step);
                return(true);
            }

            if (step == Step.SearchBiblioError)
            {
                this.SetTarget("ResultList");
                this.DisplayInfo(Step.SearchBiblioError);
                return(true);
            }

            if (step == Step.SearchBiblioNotFound)
            {
                this.EnableInput(true);

                this.SetTarget("ResultList");
                this.DisplayInfo(Step.SearchBiblioNotFound);
                return(true);
            }

            // 在书目命中多条结果中选择
            if (step == Step.SelectSearchResult)
            {
                this.label_name.Text = "请输入命中事项的序号";

                this.EnableInput(true);

                this.textBox_input.SelectAll();
                this.SetTarget("ResultList");
                DisplayInfo(step);
                return(true);
            }

            // 编辑书目记录
            if (step == Step.EditBiblio)
            {
                this.textBox_input.SelectAll();
                this.SetTarget("MarcEdit");

                if (StringUtil.IsInList("dont_hilight", strStyle) == false)
                {
#if NO
                    EasyLine start_line = _currenBiblioLine;
REDO:
                    EasyLine line = this.BaseForm.GetNextBiblioLine(start_line);
                    if (line != null && string.IsNullOrEmpty(line.Content) == false && line.Content.IndexOf("?") == -1)
                    {
                        start_line = line;
                        goto REDO; // 直到找到一个内容为空或者有问号的字段
                    }
#endif
                    EasyLine line = GetNextBiblioLine(_currenBiblioLine);
                    if (line != null)
                    {
#if NO
                        string strCaption = line.Caption;
                        if (line is SubfieldLine)
                        {
                            strCaption = line.Caption + " - " + line.Container.GetFieldLine(line as SubfieldLine).Caption;
                        }
                        this.label_name.Text    = strCaption;
                        this.textBox_input.Text = line.Content;
                        line.Container.SelectItem(line, true, false);
                        line.EnsureVisible();
#endif
                        LinkBiblioField(line);
                        this.EnableInput(true);
                    }
                    else
                    {
                        // 全部字段都已经有内容了,要转为编辑册记录
                        if (_currenBiblioLine != null)
                        {
                            this.BaseForm.DisableWizardControl();
                            _currenBiblioLine.Container.SelectItem(null, true, false);
                            this.BaseForm.EnableWizardControl();
                        }

                        _currenBiblioLine       = null;
                        this.textBox_input.Text = "";
                        // this.BeginInvoke(new Action<Step, string>(SetStep), Step.EditEntity, "");
                        step = Step.EditEntity;
                        goto REDO_SETSTEP;
                    }
                    _currenBiblioLine = line;
                }
                else
                {
                    // 定位到当前字段上
                    if (this._currenBiblioLine != null)
                    {
                        LinkBiblioField(this._currenBiblioLine);
                        this.EnableInput(true);
                    }
                    else
                    {
                        this.textBox_input.Text = "";
                        this.EnableInput(false);
                    }
                }

                DisplayInfo(step);
                return(true);
            }

            // 增加新的册记录
            if (step == Step.EditEntity)
            {
                this.label_name.Text   = "册条码号";
                this._currenBiblioLine = null;

                this.EnableInput(true);

                if (this._currentEntityControl == null)
                {
                    this.textBox_input.Text = "";
                    PlusButton plus = this.BaseForm.GetEntityPlusButton();
                    if (plus != null)
                    {
                        this.BaseForm.EnsurePlusButtonVisible();

                        this.BaseForm.DisableWizardControl();
                        plus.Active = true;
                        this.BaseForm.EnableWizardControl();
                    }
                    else
                    {
                        ////
                        ////Debug.Assert(false, "");
                    }
                    DisplayInfo(step);

                    this.textBox_input.SelectAll();
                    this.SetTarget("Entities");

                    return(true);
                }

                this.textBox_input.SelectAll();
                this.SetTarget("Entities");
                if (StringUtil.IsInList("dont_hilight", strStyle) == false)
                {
                    if (this._currentEntityControl != null)
                    {
#if NO
                        EditLine start_line = this._currentEntityLine;
REDO:
                        EditLine line = this.BaseForm.GetNextEntityLine(this._currentEntityControl, start_line);
#endif
                        EditLine line = GetNextEntityLine(this._currentEntityLine);
                        if (line != null)
                        {
#if NO
                            this.label_name.Text    = line.Caption;
                            this.textBox_input.Text = line.Content;

                            this._currentValueList = this._currentEntityControl.GetLineValueList(line);

                            line.ActiveState = true;
                            this.BaseForm.EnsureEntityVisible(line.EditControl);
                            // 把加号按钮修改为一般状态
                            PlusButton plus = this.BaseForm.GetEntityPlusButton();
                            if (plus != null)
                            {
                                plus.Active = false;
                            }
#endif
                            LinkEntityLine(line);
                            this.EnableInput(true);
                        }
                        else
                        {
                            if (this._currentEntityControl != null)
                            {
                                this.BaseForm.DisableWizardControl();
                                this._currentEntityControl.ClearActiveState();
                                this.BaseForm.EnableWizardControl();
                            }
                            this._currentEntityControl = null;
                            this._currentEntityLine    = null;
                            this.textBox_input.Text    = "";
                            // this.BeginInvoke(new Action<Step, string>(SetStep), Step.EditEntity, "");
                            step = Step.EditEntity;
                            goto REDO_SETSTEP;
                        }
                        _currentEntityLine = line;
                    }
                }
                else
                {
                    // 定位到当前字段上
                    if (this._currentEntityControl != null &&
                        this._currentEntityLine != null)
                    {
                        LinkEntityLine(this._currentEntityLine);
                        this.EnableInput(true);
                    }
                    else
                    {
                        this.textBox_input.Text = "";
                        this.EnableInput(true); // 准备新增一条册记录
                    }
                }

                DisplayInfo(step);
                return(true);
            }

            return(true);
        }
Esempio n. 3
0
 void AddPlusEvents(PlusButton button_plus, bool bAdd)
 {
     if (bAdd)
     {
         button_plus.Click += button_plus_Click;
         button_plus.MouseUp += button_plus_MouseUp;
         //button_plus.Paint += button_plus_Paint;
         button_plus.Enter += button_plus_Enter;
     }
     else
     {
         button_plus.Click -= button_plus_Click;
         button_plus.MouseUp -= button_plus_MouseUp;
         //button_plus.Paint += button_plus_Paint;
         button_plus.Enter -= button_plus_Enter;
     }
 }
Esempio n. 4
0
 void SetControlColor(PlusButton control)
 {
     control.BackColor = _entityBackColor;
     control.ForeColor = this.flowLayoutPanel1.ForeColor;  // SystemColors.GrayText;
 }
Esempio n. 5
0
        public void AddPlus()
        {
            PlusButton button_plus = new PlusButton();

            SetControlColor(button_plus);

            button_plus.Size = new Size(100, 100);
            button_plus.AutoSize = false;
            button_plus.Margin = new Padding(8, 8, 8, 8);
            button_plus.FlatStyle = FlatStyle.Flat;

            AddPlusEvents(button_plus, true);

            this.flowLayoutPanel1.Controls.Add(button_plus);
        }