private void button_scan_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(this.textBox_barcode.Text) == true) { MessageBox.Show(this, "请输入条码号"); goto END1; } if (this.BarcodeScaned != null) { ScanedEventArgs e1 = new ScanedEventArgs(); e1.Barcode = this.textBox_barcode.Text; if (this.checkBox_autoUppercaseBarcode.Checked == true) { e1.Barcode = e1.Barcode.ToUpper(); } this.BarcodeScaned(this, e1); } END1: this.textBox_barcode.SelectAll(); this.textBox_barcode.Focus(); }
private void button_scan_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(this.textBox_barcode.Text) == true) { MessageBox.Show(this, "请输入条码号"); goto END1; } if (this.BarcodeScaned != null) { ScanedEventArgs e1 = new ScanedEventArgs(); e1.Barcode = this.textBox_barcode.Text; if (this.checkBox_autoUppercaseBarcode.Checked == true) e1.Barcode = e1.Barcode.ToUpper(); this.BarcodeScaned(this, e1); } END1: this.textBox_barcode.SelectAll(); this.textBox_barcode.Focus(); }
void _scanBarcodeForm_BarcodeScaned(object sender, ScanedEventArgs e) { string strError = ""; int nRet = 0; if (string.IsNullOrEmpty(e.Barcode) == true) { Console.Beep(); return; } // 自动切换到 登记 属性页,避免操作者看不到扫入了什么内容 if (this.tabControl_main.SelectedTab != this.tabPage_register) { this.tabControl_main.SelectedTab = this.tabPage_register; } // 清除浮动的错误信息 this._floatingMessage.Text = ""; // 把册条码号直接加入行中,然后等待专门的线程来装载刷新 // 要查重 #if NO ListViewItem dup = ListViewUtil.FindItem(this.listView_in, e.Barcode, COLUMN_BARCODE); if (dup != null) { Console.Beep(); ListViewUtil.SelectLine(dup, true); MessageBox.Show(this, "您扫入的册条码号 ‘" + e.Barcode + "’ 在列表中已经存在了,请注意不要重复扫入"); this._scanBarcodeForm.Activate(); return; } ListViewItem item = new ListViewItem(); ListViewUtil.ChangeItemText(item, COLUMN_BARCODE, e.Barcode); this.listView_in.Items.Add(item); ListViewUtil.SelectLine(item, true); item.EnsureVisible(); #endif string strText = e.Barcode; // 如果是 ISBN,则新装入一个书目记录 // TODO: 装入前需要对整个 list 进行查重,如果前面已经有同样 ISBN 的书目,要提醒 if (QuickChargingForm.IsISBN(ref strText) == true) { #if NO RegisterLine line = new RegisterLine(this.entityRegisterControl1); line.BiblioBarcode = strText; this.entityRegisterControl1.InsertNewLine(0, line, true); line.label_color.Focus(); this.entityRegisterControl1.SetColorList(); this.entityRegisterControl1.AddTask(line, "search_biblio"); // 选定刚新增的事项 this.entityRegisterControl1.SelectItem(line, true); // 确保事项可见 this.entityRegisterControl1.EnsureVisible(line); #endif this.entityRegisterControl1.AddNewBiblio(strText); } else { // 当作册条码号进入 nRet = this.entityRegisterControl1.AddNewEntity(strText, out strError); if (nRet == -1) { goto ERROR1; } } // this.entityRegisterControl1.ActivateThread(); return; ERROR1: MessageBox.Show(this, strError); this._scanBarcodeForm.Focus(); }
void _scanBarcodeForm_BarcodeScaned(object sender, ScanedEventArgs e) { if (string.IsNullOrEmpty(e.Barcode) == true) { Console.Beep(); return; } // 把册条码号直接加入行中,然后等待专门的线程来装载刷新 // 要查重 ListViewItem dup = ListViewUtil.FindItem(this.listView_in, e.Barcode, COLUMN_BARCODE); if (dup != null) { Console.Beep(); ListViewUtil.SelectLine(dup, true); MessageBox.Show(this, "您扫入的册条码号 ‘" + e.Barcode + "’ 在列表中已经存在了,请注意不要重复扫入"); this._scanBarcodeForm.Activate(); return; } ListViewItem item = new ListViewItem(); ListViewUtil.ChangeItemText(item, COLUMN_BARCODE, e.Barcode); this.listView_in.Items.Add(item); ListViewUtil.SelectLine(item, true); item.EnsureVisible(); if (this._fillThread != null) this._fillThread.Activate(); }
void _scanBarcodeForm_BarcodeScaned(object sender, ScanedEventArgs e) { string strError = ""; int nRet = 0; if (string.IsNullOrEmpty(e.Barcode) == true) { Console.Beep(); return; } // 自动切换到 登记 属性页,避免操作者看不到扫入了什么内容 if (this.tabControl_main.SelectedTab != this.tabPage_register) this.tabControl_main.SelectedTab = this.tabPage_register; // 清除浮动的错误信息 this._floatingMessage.Text = ""; // 把册条码号直接加入行中,然后等待专门的线程来装载刷新 // 要查重 #if NO ListViewItem dup = ListViewUtil.FindItem(this.listView_in, e.Barcode, COLUMN_BARCODE); if (dup != null) { Console.Beep(); ListViewUtil.SelectLine(dup, true); MessageBox.Show(this, "您扫入的册条码号 ‘" + e.Barcode + "’ 在列表中已经存在了,请注意不要重复扫入"); this._scanBarcodeForm.Activate(); return; } ListViewItem item = new ListViewItem(); ListViewUtil.ChangeItemText(item, COLUMN_BARCODE, e.Barcode); this.listView_in.Items.Add(item); ListViewUtil.SelectLine(item, true); item.EnsureVisible(); #endif string strText = e.Barcode; // 如果是 ISBN,则新装入一个书目记录 // TODO: 装入前需要对整个 list 进行查重,如果前面已经有同样 ISBN 的书目,要提醒 if (QuickChargingForm.IsISBN(ref strText) == true) { #if NO RegisterLine line = new RegisterLine(this.entityRegisterControl1); line.BiblioBarcode = strText; this.entityRegisterControl1.InsertNewLine(0, line, true); line.label_color.Focus(); this.entityRegisterControl1.SetColorList(); this.entityRegisterControl1.AddTask(line, "search_biblio"); // 选定刚新增的事项 this.entityRegisterControl1.SelectItem(line, true); // 确保事项可见 this.entityRegisterControl1.EnsureVisible(line); #endif this.entityRegisterControl1.AddNewBiblio(strText); } else { // 当作册条码号进入 nRet = this.entityRegisterControl1.AddNewEntity(strText, out strError); if (nRet == -1) goto ERROR1; } // this.entityRegisterControl1.ActivateThread(); return; ERROR1: MessageBox.Show(this, strError); this._scanBarcodeForm.Focus(); }