예제 #1
0
        private void ChooseAddressViewLoad(object sender, EventArgs e)
        {
            try
            {
                _plant = RFGlobals.GetInstance().Plant;

                using (var racksDT = new RackListTableAdapter().GetRackList(_plant))
                {
                    RackSelection.DataSource    = racksDT;
                    RackSelection.DisplayMember = "Rack";
                }
                using (var shelvesDT = new ShelfListTableAdapter().GetShelfList(_plant))
                {
                    ShelfSelection.DataSource    = shelvesDT;
                    ShelfSelection.DisplayMember = "Shelf";
                }
                using (var positionsDT = new PositionListTableAdapter().GetPositionList(_plant))
                {
                    PositionSelection.DataSource    = positionsDT;
                    PositionSelection.DisplayMember = "Position";
                }
            }
            catch (SqlException ex)
            {
                foreach (SqlError sqlErr in ex.Errors)
                {
                    MessageBox.Show(sqlErr.Message);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
예제 #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();
        }