Exemple #1
0
        private void button_test_Click(object sender, EventArgs e)
        {
            SelectItemDialog dlg = new SelectItemDialog();

            dlg.MainForm = this.MainForm;
            dlg.ShowDialog(this);
        }
Exemple #2
0
        // return:
        //      -1  error
        //      0   放弃
        //      1   成功
        internal int SelectOneItem(
            FuncState func,
            string strText,
            out string strItemBarcode,
            out string strError)
        {
            strError = "";
            strItemBarcode = "";

            if (this.InvokeRequired)
            {
                Delegate_SelectOneItem d = new Delegate_SelectOneItem(SelectOneItem);
                object[] args = new object[4];
                args[0] = func;
                args[1] = strText;
                args[2] = strItemBarcode;
                args[3] = strError;
                int result = (int)this.Invoke(d, args);

                // 取出out参数值
                strItemBarcode = (string)args[2];
                strError = (string)args[3];
                return result;
            }

            SelectItemDialog dlg = new SelectItemDialog();

            MainForm.SetControlFont(dlg, this.Font, false);
            if (func == dp2Circulation.FuncState.Borrow
                || func == dp2Circulation.FuncState.ContinueBorrow)
            {
                dlg.FunctionType = "borrow";
                dlg.Text = "请选择要借阅的册";
            }
            else if (func == dp2Circulation.FuncState.VerifyRenew)
            {
                dlg.FunctionType = "renew";
                dlg.Text = "请选择要续借的册";
            }
            else if (func == dp2Circulation.FuncState.Return || func == dp2Circulation.FuncState.Lost)
            {
                dlg.FunctionType = "return";
                dlg.Text = "请选择要还回的册";
            }
            else if (func == dp2Circulation.FuncState.VerifyReturn || func == dp2Circulation.FuncState.VerifyLost)
            {
                dlg.FunctionType = "return";
                dlg.VerifyBorrower = this.textBox_readerBarcode.Text;
                dlg.Text = "请选择要(验证)还回的册";
            }

            dlg.AutoOperSingleItem = this.AutoOperSingleItem;
            dlg.AutoSearch = true;
            dlg.MainForm = this.MainForm;
            dlg.From = "ISBN";
            dlg.QueryWord = strText;

            dlg.UiState = this.MainForm.AppInfo.GetString(
        "ChargingForm",
        "SelectItemDialog_uiState",
        "");

            // TODO: 保存窗口内的尺寸状态
            this.MainForm.AppInfo.LinkFormState(dlg, "ChargingForm_SelectItemDialog_state");
            dlg.ShowDialog(this);
            this.MainForm.AppInfo.UnlinkFormState(dlg);

            this.MainForm.AppInfo.SetString(
"ChargingForm",
"SelectItemDialog_uiState",
dlg.UiState);

            if (dlg.DialogResult == System.Windows.Forms.DialogResult.Cancel)
                return 0;

            Debug.Assert(string.IsNullOrEmpty(dlg.SelectedItemBarcode) == false, "");
            strItemBarcode = dlg.SelectedItemBarcode;
            return 1;
        }
Exemple #3
0
        // return:
        //      -1  error
        //      0   放弃
        //      1   成功
        internal int SelectOneItem(
            FuncState func,
            string strText,
            out string strItemBarcode,
            out string strError)
        {
            strError = "";
            strItemBarcode = "";

            if (this.IsDisposed)
                return 0;

            if (this.InvokeRequired)
            {
                Delegate_SelectOneItem d = new Delegate_SelectOneItem(SelectOneItem);
                object[] args = new object[4];
                args[0] = func;
                args[1] = strText;
                args[2] = strItemBarcode;
                args[3] = strError;
                int result = (int)this.Invoke(d, args);

                // 取出out参数值
                strItemBarcode = (string)args[2];
                strError = (string)args[3];
                return result;
            }

            SelectItemDialog dlg = new SelectItemDialog();

            MainForm.SetControlFont(dlg, this.Font, false);
            if (func == dp2Circulation.FuncState.Borrow
                || func == dp2Circulation.FuncState.ContinueBorrow)
            {
                dlg.FunctionType = "borrow";
                dlg.Text = "请选择要借阅的册";
            }
            else if (func == dp2Circulation.FuncState.Renew)
            {
                dlg.FunctionType = "renew";
                dlg.Text = "请选择要续借的册";
            }
            else if (func == dp2Circulation.FuncState.VerifyRenew)
            {
                dlg.FunctionType = "renew";
                dlg.VerifyBorrower = this._taskList.CurrentReaderBarcode;
                dlg.Text = "请选择要(验证)续借的册";
            }
            else if (func == dp2Circulation.FuncState.Return || func == dp2Circulation.FuncState.Lost)
            {
                dlg.FunctionType = "return";
                dlg.Text = "请选择要还回的册";
            }
            else if (func == dp2Circulation.FuncState.VerifyReturn || func == dp2Circulation.FuncState.VerifyLost)
            {
                dlg.FunctionType = "return";
                dlg.VerifyBorrower = this._taskList.CurrentReaderBarcode;
                dlg.Text = "请选择要(验证)还回的册";
            }
            else if (func == dp2Circulation.FuncState.InventoryBook)
            {
                dlg.FunctionType = "inventory";
                dlg.Text = "请选择要盘点的册";
            }
            else if (func == dp2Circulation.FuncState.Read)
            {
                dlg.FunctionType = "read";
                dlg.VerifyBorrower = this._taskList.CurrentReaderBarcode;
                dlg.Text = "请选择要读过的册";
            }

            dlg.AutoOperSingleItem = this.AutoOperSingleItem;
            dlg.AutoSearch = true;
            dlg.MainForm = this.MainForm;
            dlg.From = "ISBN";
            dlg.QueryWord = strText;

            string strUiState = this.MainForm.AppInfo.GetString(
        "QuickChargingForm",
        "SelectItemDialog_uiState",
        "");
            dlg.UiState = strUiState;

            if (string.IsNullOrEmpty(strUiState) == false
                || this.MainForm.PanelFixedVisible == true)
                this.MainForm.AppInfo.LinkFormState(dlg, "QuickChargingForm_SelectItemDialog_state");
            else
            {
                dlg.Size = this.MainForm.panel_fixed.Size;
                dlg.StartPosition = FormStartPosition.Manual;
                dlg.Location = this.MainForm.PointToScreen(this.MainForm.panel_fixed.Location);
            }

            dlg.ShowDialog(this.SafeWindow);

            if (string.IsNullOrEmpty(strUiState) == false
                || this.MainForm.PanelFixedVisible == true)
                this.MainForm.AppInfo.UnlinkFormState(dlg);

            this.MainForm.AppInfo.SetString(
"QuickChargingForm",
"SelectItemDialog_uiState",
dlg.UiState);

            if (dlg.DialogResult == System.Windows.Forms.DialogResult.Cancel)
                return 0;

            Debug.Assert(string.IsNullOrEmpty(dlg.SelectedItemBarcode) == false, "");
            strItemBarcode = dlg.SelectedItemBarcode;
            return 1;
        }