コード例 #1
0
ファイル: ReaderSearchForm.cs プロジェクト: paopaofeng/dp2
        // 将记录装载到读者窗
        // parameters:
        //      strIdType   标识类型 "barcode" "recpath" "auto"
        //      strOpenStyle 打开窗口的方式 "new" "exist"
        void LoadRecordToReaderInfoForm(string strOpenStyle,
            string strIdType)
        {

            if (this.listView_records.SelectedItems.Count == 0)
            {
                MessageBox.Show(this, "尚未选定要装入读者窗的事项");
                return;
            }

            string strBarcodeOrRecPath = "";

            if (strIdType == "auto")
            {
                strBarcodeOrRecPath = ListViewUtil.GetItemText(this.listView_records.SelectedItems[0], 1);  // this.listView_records.SelectedItems[0].SubItems[1].Text;

                // 如果条码号为空
                if (String.IsNullOrEmpty(strBarcodeOrRecPath) == true)
                {
                    strBarcodeOrRecPath = this.listView_records.SelectedItems[0].SubItems[0].Text;
                    strIdType = "recpath";
                }
                else
                {
                    strIdType = "barcode";
                }

                Debug.Assert(strIdType != "auto", "auto类型后面不能用了");
            }
            else if (strIdType == "barcode")
                strBarcodeOrRecPath = this.listView_records.SelectedItems[0].SubItems[1].Text;
            else
            {
                Debug.Assert(strIdType == "recpath", "");
                strBarcodeOrRecPath = this.listView_records.SelectedItems[0].SubItems[0].Text;
            }

            ReaderInfoForm form = null;

            if (strOpenStyle == "exist")
            {
                form = MainForm.GetTopChildWindow<ReaderInfoForm>();
                if (form != null)
                    Global.Activate(form);
            }

            if (form == null)
            {
                form = new ReaderInfoForm();

                form.MdiParent = this.MainForm;

                form.MainForm = this.MainForm;
                form.Show();
            }

            if (strIdType == "barcode")
            {
                form.LoadRecord(strBarcodeOrRecPath, false); // 发生重复条码时,不强行装入,起到警告工作人员的作用
                // form.AsyncLoadRecord(strBarcodeOrRecPath);
            }
            else
            {
                Debug.Assert(strIdType == "recpath", "");

                // form.LoadRecord("@path:" + strRecPath, false);   // 这个办法有问题,ReaderInfoForm.ReaderBarcode有误
                form.LoadRecordByRecPath(strBarcodeOrRecPath, "");
            }
        }
コード例 #2
0
ファイル: ReaderSearchForm.cs プロジェクト: paopaofeng/dp2
        // (根据记录路径)装入到读者窗
        void menu_loadReaderInfoByRecPath_Click(object sender, EventArgs e)
        {
            if (this.listView_records.SelectedItems.Count == 0)
            {
                MessageBox.Show(this, "尚未选定要装入读者窗的事项");
                return;
            }
            string strRecPath = this.listView_records.SelectedItems[0].SubItems[0].Text;

            ReaderInfoForm form = new ReaderInfoForm();

            form.MdiParent = this.MainForm;

            form.MainForm = this.MainForm;
            form.Show();

            // form.LoadRecord("@path:" + strRecPath, false);   // 这个办法有问题,ReaderInfoForm.ReaderBarcode有误

            form.LoadRecordByRecPath(strRecPath, "");
        }