private void frmScanToLocation_Load(object sender, EventArgs e) { try { MyRFGun = new SymbolRFGun.SymbolRFGun(); MyRFGun.RFScan += new RFScanEventHandler(MyRFGun_RFScan); } catch (SymbolRFGunException ex) { MessageBox.Show(ex.Message); this.Close(); } try { //Select Device from device list Symbol.Audio.Device MyDevice = (Symbol.Audio.Device)Symbol.StandardForms.SelectDevice.Select( Symbol.Audio.Controller.Title, Symbol.Audio.Device.AvailableDevices); if (MyDevice == null) { MessageBox.Show("No Device Selected", "SelectDevice"); //close the form this.Close(); return; } //check the device type switch (MyDevice.AudioType) { //if standard device case Symbol.Audio.AudioType.StandardAudio: MyAudioController = new Symbol.Audio.StandardAudio(MyDevice); break; //if simulated device case Symbol.Audio.AudioType.SimulatedAudio: MyAudioController = new Symbol.Audio.SimulatedAudio(MyDevice); break; default: throw new Symbol.Exceptions.InvalidDataTypeException("Unknown Device Type"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } try { Exception ex = null; dsPhysicalInventory = (DataSetPhysicalInventory)cache.RetrieveObject(CacheAddress.PhysicalInventoryData); taEmployee = (EmployeeTableAdapter)cache.RetrieveObject(CacheAddress.EmployeeTableAdapter); taPhysicalProgress = (PhysicalProgressTableAdapter)cache.RetrieveObject(CacheAddress.PhysicalProgressTableAdapter); taPhysicalProgressSummary = (PhysicalProgressSummaryTableAdapter)cache.RetrieveObject(CacheAddress.PhysicalProgressSummaryTableAdapter); taWarehouseInventory = (WarehouseInventoryTableAdapter)cache.RetrieveObject(CacheAddress.WarehouseInventoryTableAdapter); switch (dsPhysicalInventory.Employee.Rows.Count) { case 1: OperatorCode = dsPhysicalInventory.Employee[0].OperatorCode; uxLabelOperatorCode.Text = OperatorCode; break; case 0: ex = new Exception("Invalid password."); throw ex; default: ex = new Exception("Unknown error validating password."); throw ex; } PutAwayAisle = (string)cache.RetrieveObject(CacheAddress.BeginPhysicalAisle); BeginPhysicalShelf = (Int32)cache.RetrieveObject(CacheAddress.BeginPhysicalShelf); BeginPhysicalSubshelf = (Int32)cache.RetrieveObject(CacheAddress.BeginPhysicalSubshelf); uxCBAisle.Items.Add(PutAwayAisle); uxCBAisle.SelectedIndex = 0; if (BeginPhysicalShelf == 0) { uxCBShelf.Items.Add("1"); uxCBShelf.Items.Add("2"); uxCBShelf.Items.Add("3"); uxCBShelf.Items.Add("4"); PutAwayShelf = 1; } else { uxCBShelf.Items.Add(BeginPhysicalShelf.ToString()); PutAwayShelf = BeginPhysicalShelf; } uxCBShelf.SelectedIndex = 0; if (BeginPhysicalSubshelf == 0) { uxCBSubshelf.Items.Add("1"); uxCBSubshelf.Items.Add("2"); uxCBSubshelf.Items.Add("3"); uxCBSubshelf.Items.Add("4"); uxCBSubshelf.Items.Add("5"); uxCBSubshelf.Items.Add("6"); uxCBSubshelf.Items.Add("7"); uxCBSubshelf.Items.Add("8"); uxCBSubshelf.Items.Add("9"); uxCBSubshelf.Items.Add("10"); uxCBSubshelf.Items.Add("11"); uxCBSubshelf.Items.Add("12"); PutAwaySubshelf = 1; } else { uxCBSubshelf.Items.Add(BeginPhysicalSubshelf.ToString()); PutAwaySubshelf = BeginPhysicalSubshelf; } uxCBSubshelf.SelectedIndex = 0; RefreshProgress(); } catch (SqlException ex) { foreach (SqlError SQLErr in ex.Errors) { MessageBox.Show(SQLErr.Message); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
internal bool isBackground = false; //The flag used to track whether the application is in background or not (in foreground). /// <summary> /// Initialize the reader. /// </summary> public bool InitReader() { // If the reader is already initialized then fail the initialization. if (myReader != null) { return(false); } else // Else initialize the reader. { try { // Get the device selected by the user. Symbol.Generic.Device MyDevice = Symbol.StandardForms.SelectDevice.Select( Symbol.Barcode.Device.Title, Symbol.Barcode.Device.AvailableDevices); //Select Device from device list Symbol.Audio.Device audioDevice = (Symbol.Audio.Device)Symbol.StandardForms.SelectDevice.Select( Symbol.Audio.Controller.Title, Symbol.Audio.Device.AvailableDevices); if (MyDevice == null) { MessageBox.Show(Resources.GetString("NoDeviceSelected"), Resources.GetString("SelectDevice")); return(false); } // Create the reader, based on selected device. myReader = new Symbol.Barcode.Reader(MyDevice); // Create the reader data. myReaderData = new Symbol.Barcode.ReaderData( Symbol.Barcode.ReaderDataTypes.Text, Symbol.Barcode.ReaderDataLengths.MaximumLabel); // Enable the Reader. myReader.Actions.Enable(); // In this sample, we are setting the aim type to trigger. switch (myReader.ReaderParameters.ReaderType) { case Symbol.Barcode.READER_TYPE.READER_TYPE_IMAGER: myReader.ReaderParameters.ReaderSpecific.ImagerSpecific.AimType = Symbol.Barcode.AIM_TYPE.AIM_TYPE_TRIGGER; break; case Symbol.Barcode.READER_TYPE.READER_TYPE_LASER: myReader.ReaderParameters.ReaderSpecific.LaserSpecific.AimType = Symbol.Barcode.AIM_TYPE.AIM_TYPE_TRIGGER; break; case Symbol.Barcode.READER_TYPE.READER_TYPE_CONTACT: // AimType is not supported by the contact readers. break; } myReader.Actions.SetParameters(); //check the device type switch (audioDevice.AudioType) { //if standard device case Symbol.Audio.AudioType.StandardAudio: myAudioController = new Symbol.Audio.StandardAudio(audioDevice); break; //if simulated device case Symbol.Audio.AudioType.SimulatedAudio: myAudioController = new Symbol.Audio.SimulatedAudio(audioDevice); break; default: throw new Symbol.Exceptions.InvalidDataTypeException("Unknown Device Type"); } myAudioController.BeeperVolume = 0; } catch (Symbol.Exceptions.OperationFailureException ex) { MessageBox.Show(Resources.GetString("InitReader") + "\n" + Resources.GetString("OperationFailure") + "\n" + ex.Message + "\n" + Resources.GetString("Result") + " = " + (Symbol.Results)((uint)ex.Result) ); return(false); } catch (Symbol.Exceptions.InvalidRequestException ex) { MessageBox.Show(Resources.GetString("InitReader") + "\n" + Resources.GetString("InvalidRequest") + "\n" + ex.Message); return(false); } catch (Symbol.Exceptions.InvalidIndexerException ex) { MessageBox.Show(Resources.GetString("InitReader") + "\n" + Resources.GetString("InvalidIndexer") + "\n" + ex.Message); return(false); }; return(true); } }