public override bool Initialize(Form parent) { try { USIClass.PromptMessage = true; USIClass.ErrorMessage = true; usi = new USIClass(parent); usi.DataReady +=new USIClass.USIEventHandler(usi_DataReady); if (!usi.SetTerminator(USIClass.TerminatorType.TERMINATOR_NONE)) { throw new Exception(P.USI_PONIŠTENJE_TERMINATORA); } if (!usi.SetWorkingMode(USIClass.WorkingMode.SWM_BARCODE)) { throw new Exception(P.USI_POSTAVLJANJE_ČITAČA); } if (!usi.EnableScanner(true)) { throw new Exception(P.USI_SKENER_NIJE_POKRENUT); } } catch (Exception) { usi = null; throw; } return true; }
/// <summary> /// Konstruktor. /// Pri (prvom) pokretanju Glavne forme pokreæe punjenje svih popisa korištenih u MobTrenisu /// te èita MAC adresu ureðaja. Ako je punjenje popisa uspjelo, prikazuje se prijavna kontrola. /// </summary> public GlavnaForma() { InitializeComponent(); try { Skener.ProcitajMAC(); this.Text = this.Text + "-" + Config.Settings["Server"]; Popisi.NapuniPopise(); USIClass.PromptMessage = true; USIClass.ErrorMessage = true; usi = new USIClass(this); usi.DataReady += new USIClass.USIEventHandler(usi_DataReady); if (!usi.SetTerminator(USIClass.TerminatorType.TERMINATOR_NONE)) { throw new Exception(Poruke.USI_PONIŠTENJE_TERMINATORA); } if (!usi.SetWorkingMode(USIClass.WorkingMode.SWM_BARCODE)) { throw new Exception(Poruke.USI_POSTAVLJANJE_ÈITAÈA); } if (!usi.EnableScanner(true)) { throw new Exception(Poruke.USI_SKENER_NIJE_POKRENUT); } } catch (Exception ex) { usi = null; Poruke.SvirajGresku(); MessageBox.Show(Poruke.PrijavaPokretanjeGreska + ex.Message); } if (Popisi.Napunjeni) { PrikaziPrijavu(false); } }
public Form1() { InitializeComponent(); //We don't want to show USI working information popup windows USIClass.PromptMessage = false; //But we want to show USI error popup windows USIClass.ErrorMessage = true; //Wire up events on the USICF component myUSI = new USIClass(this); myUSI.DataReady += new USIClass.USIEventHandler(myUSI_DataReady); cboCmd.Items.Add(EMPTY); cboCmd.Items.Add(SCAN_ENABLE); cboCmd.Items.Add(SCAN_DISABLE); cboCmd.Items.Add(GET_TERMINATOR); cboCmd.Items.Add(SET_TERMINATOR_NONE); cboCmd.Items.Add(SET_TERMINATOR); cboCmd.Items.Add(START_AUTOSCAN); cboCmd.Items.Add(STOP_AUTOSCAN); cboCmd.Items.Add(IS_AUTOSCANNING); cboCmd.Items.Add(DISABLE_UPCE); cboCmd.Items.Add(ENABLE_UPCE); cboCmd.Items.Add(SEND_UPCE_CHECK_DIGIT); cboCmd.Items.Add(DONOT_SEND_UPCE_CHECK_DIGIT); cboCmd.Items.Add(SAVE_SETTINGS_TO_FILE); cboCmd.Items.Add(LOAD_SETTINGS_FROM_FILE); cboCmd.Items.Add(GET_SCANNER_SOUND); cboCmd.Items.Add(NO_SCANNER_SOUND); cboCmd.Items.Add(USE_BEEP_SOUND); cboCmd.Items.Add(USE_WAV_SOUND); cboCmd.Items.Add(USI_RESET); cboCmd.Items.Add(CLEAR_SCREEN); cboCmd.SelectedIndex = 1; cboTerminator.Items.Add(Convert.ToString(USIClass.TerminatorType.TERMINATOR_ENTER).Substring(11)); cboTerminator.Items.Add(Convert.ToString(USIClass.TerminatorType.TERMINATOR_RETURN).Substring(11)); cboTerminator.Items.Add(Convert.ToString(USIClass.TerminatorType.TERMINATOR_LINEFEED).Substring(11)); cboTerminator.Items.Add(Convert.ToString(USIClass.TerminatorType.TERMINATOR_NONE).Substring(11)); cboTerminator.Items.Add(Convert.ToString(USIClass.TerminatorType.TERMINATOR_ENTERENTER).Substring(11)); cboTerminator.SelectedIndex = 0; lblMilliSeconds.Visible = false; txtMilliSeconds.Visible = false; cboTerminator.Visible = false; myUSI.SetWorkingMode(USIClass.WorkingMode.SWM_BARCODE); }