public Source_MacRegion(
     rfid.Constants.MacRegion r_macRegion
 )
     : base()
 {
     this.macRegion = r_macRegion;
 }
 public Source_MacRegion
 (
     rfid.Constants.MacRegion r_macRegion
 )
     :
     base()
 {
     this.macRegion = r_macRegion;
 }
 public void Copy(Source_MacRegion from)
 {
     this.macRegion = from.macRegion;
 }
Beispiel #4
0
        private void btn_SetRegion_Click(object sender, EventArgs e)
        {
            rfid.Constants.MacRegion SelectMacRegion = rfid.Constants.MacRegion.UNKNOWN;

            if (strCustomerRegion != null && regionComboBox.Text == strCustomerRegion)
            {
                SelectMacRegion = rfid.Constants.MacRegion.CUSTOMER;
            }
            else
            {
                if (Enum.IsDefined(typeof(rfid.Constants.MacRegion), regionComboBox.SelectedItem))
                {
                    SelectMacRegion = (rfid.Constants.MacRegion)regionComboBox.SelectedItem;
                }
                else
                {
                    SelectMacRegion = rfid.Constants.MacRegion.UNKNOWN;
                }
            }



            //Check
            if
            (
                SelectMacRegion == this.macRegion.MacRegion   //Choose the same region
                ||
                SelectMacRegion == rfid.Constants.MacRegion.UNKNOWN
            )
            {
                return;
            }


            //if
            // (
            //     (rfid.Constants.MacRegion)regionComboBox.SelectedItem ==
            //     rfid.Constants.MacRegion.UNKNOWN

            // )
            // {
            //     regionComboBox.SelectedIndex = regionComboBox.Items.IndexOf(this.macRegion.MacRegion);

            //     return;
            // }



            if
            (
                MessageBox.Show("If you change the setting, Explorer will be closed.\nAre you sure?",
                                "Reader - Set Region",
                                MessageBoxButtons.YesNo,
                                MessageBoxIcon.Question)

                ==

                DialogResult.Yes
            )
            {
                this.macRegion.MacRegion = SelectMacRegion;

                rfid.Constants.Result result =
                    this.macRegion.store(LakeChabotReader.MANAGED_ACCESS, this.reader.ReaderHandle);

                if (rfid.Constants.Result.OK != result)
                {
                    MessageBox.Show("Set region unsuccessfully",
                                    "Reader - Set region",
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Error);
                    return;
                }


                if (rfid.Constants.Result.OK != reader.API_ControlSoftReset())
                {
                    MessageBox.Show("Reset reader unsuccessfully",
                                    "Reader - Reset reader",
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Error);
                    return;
                }

                Application.Exit();
            }//if
        }
 public void Copy(Source_MacRegion from)
 {
     this.macRegion = from.macRegion;
 }
        private void btn_SetRegion_Click(object sender, EventArgs e)
        {
            rfid.Constants.MacRegion SelectMacRegion = rfid.Constants.MacRegion.UNKNOWN;

            //Get Region
            try
            {
                SelectMacRegion = (rfid.Constants.MacRegion)Int32.Parse(regionComboBox.SelectedValue.ToString());
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error",
                                "Reader - Set Region",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
                return;
            }



            //Check
            if
            (
                SelectMacRegion == this.macRegion.MacRegion   //Choose the same region
                ||
                SelectMacRegion == rfid.Constants.MacRegion.UNKNOWN
            )
            {
                return;
            }


            if
            (
                MessageBox.Show("If you change the setting, Explorer will be closed.\nAre you sure?",
                                "Reader - Set Region",
                                MessageBoxButtons.YesNo,
                                MessageBoxIcon.Question)

                ==

                DialogResult.Yes
            )
            {
                this.macRegion.MacRegion = SelectMacRegion;

                rfid.Constants.Result result =
                    this.macRegion.store(LakeChabotReader.MANAGED_ACCESS, this.reader.ReaderHandle);

                if (rfid.Constants.Result.OK != result)
                {
                    MessageBox.Show("Set region unsuccessfully",
                                    "Reader - Set region",
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Error);
                    return;
                }


                if (rfid.Constants.Result.OK != reader.API_ControlSoftReset())
                {
                    MessageBox.Show("Reset reader unsuccessfully",
                                    "Reader - Reset reader",
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Error);
                    return;
                }

                Application.Exit();
            }//if
        }