// 2009/6/2 public static string Show(ChargingInfoHost host, string strText, InfoColor infocolor, string strCaption, double delayOpacity, bool bPassword, Font font = null) { ChargingInfoDlg dlg = new ChargingInfoDlg(); if (font != null) { MainForm.SetControlFont(dlg, font, false); } dlg.Host = host; dlg.DelayOpacity = delayOpacity; dlg.InfoColor = infocolor; dlg.MessageText = strText; if (strCaption != null) { dlg.Text = strCaption; } dlg.Password = bPassword; dlg.StartPosition = FormStartPosition.CenterScreen; host.ap.LinkFormState(dlg, "ChargingInfoDlg_state"); dlg.ShowDialog(host.window); host.ap.UnlinkFormState(dlg); return(dlg.FastInputText); }
// 原始版本 static string Show(IWin32Window owner, string strText, InfoColor infocolor, string strCaption, double delayOpacity, Font font = null) { ChargingInfoDlg dlg = new ChargingInfoDlg(); if (font != null) { MainForm.SetControlFont(dlg, font, false); } dlg.DelayOpacity = delayOpacity; dlg.InfoColor = infocolor; dlg.MessageText = strText; if (strCaption != null) { dlg.Text = strCaption; } dlg.StartPosition = FormStartPosition.CenterScreen; dlg.ShowDialog(owner); return(dlg.FastInputText); }
private void button_itemAction_Click(object sender, EventArgs e) { string strError = ""; int nRet = 0; if (this.textBox_itemBarcode.Text == "") { strError = "册条码号不能为空。"; goto ERROR1; } if (this.DoubleItemInputAsEnd == true) { // 取出上次输入的最后一个条码,和目前输入的条码比较,看是否一样。 if (this.m_itemBarcodes.Count > 0) { string strLastItemBarcode = this.m_itemBarcodes[m_itemBarcodes.Count - 1].Barcode; TimeSpan delta = DateTime.Now - this.m_itemBarcodes[m_itemBarcodes.Count - 1].Time; // MessageBox.Show(this, delta.TotalMilliseconds.ToString()); if (strLastItemBarcode == this.textBox_itemBarcode.Text && delta.TotalMilliseconds < 5000) // 5秒以内 { // 清除册条码号输入域 this.textBox_itemBarcode.Text = ""; // 清除读者证条码号输入域 this.textBox_readerBarcode.Text = "请输入下一个读者的证条码号..."; this.SwitchFocus(READER_BARCODE, null); return; } } BarcodeAndTime barcodetime = new BarcodeAndTime(); barcodetime.Barcode = this.textBox_itemBarcode.Text; barcodetime.Time = DateTime.Now; this.m_itemBarcodes.Add(barcodetime); // 仅仅保持一个条码就可以了 while (this.m_itemBarcodes.Count > 1) { this.m_itemBarcodes.RemoveAt(0); } } if (this.FuncState == FuncState.Borrow) { if (this.textBox_readerBarcode.Text == "") { strError = "读者证条码号不能为空。"; goto ERROR1; } nRet = this.WriteLogFile("borrow", this.textBox_readerBarcode.Text, this.textBox_itemBarcode.Text, out strError); if (nRet == -1) { goto ERROR1; } string strFastInputText = ChargingInfoDlg.Show(this.CharingInfoHost, "读者 " + this.textBox_readerBarcode.Text + " 借阅册 " + this.textBox_itemBarcode.Text + " 成功。", InfoColor.Green, "caption", this.InfoDlgOpacity, this.MainForm.DefaultFont); this.SwitchFocus(ITEM_BARCODE, strFastInputText); } if (this.FuncState == FuncState.Return) { nRet = this.WriteLogFile("return", this.textBox_readerBarcode.Text, this.textBox_itemBarcode.Text, out strError); if (nRet == -1) { goto ERROR1; } string strFastInputText = ChargingInfoDlg.Show(this.CharingInfoHost, " 册 " + this.textBox_itemBarcode.Text + " 还回成功。", InfoColor.Green, "caption", this.InfoDlgOpacity, this.MainForm.DefaultFont); this.SwitchFocus(ITEM_BARCODE, strFastInputText); } if (this.FuncState == FuncState.VerifyReturn) { if (this.textBox_readerBarcode.Text == "") { strError = "读者证条码号不能为空。"; goto ERROR1; } nRet = this.WriteLogFile("return", this.textBox_readerBarcode.Text, this.textBox_itemBarcode.Text, out strError); if (nRet == -1) { goto ERROR1; } string strFastInputText = ChargingInfoDlg.Show(this.CharingInfoHost, "读者 " + this.textBox_readerBarcode.Text + " 还回册 " + this.textBox_itemBarcode.Text + " 成功。", InfoColor.Green, "caption", this.InfoDlgOpacity, this.MainForm.DefaultFont); this.SwitchFocus(ITEM_BARCODE, strFastInputText); } return; ERROR1: MessageBox.Show(this, strError); }
// 2009/6/2 public static string Show(ChargingInfoHost host, string strText, InfoColor infocolor, string strCaption, double delayOpacity, bool bPassword, Font font = null) { ChargingInfoDlg dlg = new ChargingInfoDlg(); if (font != null) MainForm.SetControlFont(dlg, font, false); dlg.Host = host; dlg.DelayOpacity = delayOpacity; dlg.InfoColor = infocolor; dlg.MessageText = strText; if (strCaption != null) dlg.Text = strCaption; dlg.Password = bPassword; dlg.StartPosition = FormStartPosition.CenterScreen; host.ap.LinkFormState(dlg, "ChargingInfoDlg_state"); dlg.ShowDialog(host.window); host.ap.UnlinkFormState(dlg); return dlg.FastInputText; }
// 原始版本 static string Show(IWin32Window owner, string strText, InfoColor infocolor, string strCaption, double delayOpacity, Font font = null) { ChargingInfoDlg dlg = new ChargingInfoDlg(); if (font != null) MainForm.SetControlFont(dlg, font, false); dlg.DelayOpacity = delayOpacity; dlg.InfoColor = infocolor; dlg.MessageText = strText; if (strCaption != null) dlg.Text = strCaption; dlg.StartPosition = FormStartPosition.CenterScreen; dlg.ShowDialog(owner); return dlg.FastInputText; }