Ejemplo n.º 1
0
        /// <summary>
        /// Initialize the reader.
        /// </summary>
        private void InitAudio()
        {
            Symbol.Audio.Device MyAudioDevice = (Symbol.Audio.Device)SelectDevice.Select(
                Symbol.Audio.Controller.Title,
                Symbol.Audio.Device.AvailableDevices);

            if (MyAudioDevice == null)
            {
                throw new SymbolRFGunException("Unable to initialize audio device.");
            }

            //check the device type
            switch (MyAudioDevice.AudioType)
            {
            //if standard device
            case Symbol.Audio.AudioType.StandardAudio:
                MyAudioController = new Symbol.Audio.StandardAudio(MyAudioDevice);
                break;

            //if simulated device
            case Symbol.Audio.AudioType.SimulatedAudio:
                MyAudioController = new Symbol.Audio.SimulatedAudio(MyAudioDevice);
                break;

            default:
                throw new SymbolRFGunException("Unknown Device Type");
            }
        }
Ejemplo n.º 2
0
        private void ScanToLocationViewLoad(object sender, EventArgs e)
        {
            uxLabelOperatorCode.Text = OperatorCode;

            try
            {
                _myRFGun         = new SymbolRFGun.SymbolRFGun();
                _myRFGun.RFScan += MyRFGunRFScan;
            }
            catch (SymbolRFGunException ex)
            {
                MessageBox.Show(ex.Message);
                Close();
            }

            try
            {
                //Select Device from device list
                Debug.Assert(Device.AvailableDevices != null, "Device.AvailableDevices != null");
                var myDevice = (Device)SelectDevice.Select(
                    Controller.Title,
                    Device.AvailableDevices);

                if (myDevice == null)
                {
                    MessageBox.Show("No Device Selected", "SelectDevice");

                    //close the form
                    Close();

                    return;
                }

                //check the device type
                switch (myDevice.AudioType)
                {
                //if standard device
                case AudioType.StandardAudio:
                    _myAudioController = new StandardAudio(myDevice);
                    break;

                //if simulated device
                case AudioType.SimulatedAudio:
                    _myAudioController = new SimulatedAudio(myDevice);
                    break;

                default:
                    throw new InvalidDataTypeException("Unknown Device Type");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            try
            {
                using (var racksDT = new RackListTableAdapter().GetRackList(Plant))
                {
                    RackSelection.DataSource    = racksDT;
                    RackSelection.DisplayMember = "Rack";
                    RackSelection.Text          = BeginPhysicalRack;
                }
                using (var shelvesDT = new ShelfListTableAdapter().GetShelfList(Plant))
                {
                    ShelfSelection.DataSource    = shelvesDT;
                    ShelfSelection.DisplayMember = "Shelf";
                    ShelfSelection.Text          = BeginPhysicalShelf;
                }
                using (var positionsDT = new PositionListTableAdapter().GetPositionList(Plant))
                {
                    PositionSelection.DataSource    = positionsDT;
                    PositionSelection.DisplayMember = "Position";
                    PositionSelection.Text          = BeginPhysicalPosition;
                }
            }
            catch (SqlException ex)
            {
                foreach (SqlError sqlErr in ex.Errors)
                {
                    MessageBox.Show(sqlErr.Message);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            RefreshProgress();
        }