public RFChannelEditForm( LakeChabotReader reader, Source_FrequencyBand channel ) { this.reader = reader; this.channelMaster = channel; this.channelActive = new Source_FrequencyBand( channel ); InitializeComponent( ); channelSlotNumber.Text = String.Format( "RF Channel Slot {0}", this.channelActive.Band ); foreach (Source_FrequencyBand.BandState item in Enum.GetValues(typeof(Source_FrequencyBand.BandState))) { this.state.Items.Add(item); } this.state.Items.Remove(Source_FrequencyBand.BandState.UNKNOWN); state.SelectedIndex = channelActive.State == Source_FrequencyBand.BandState.DISABLED ? 0 : 1; state.SelectedValueChanged += state_SelectedValueChanged; this.multiplyRatio.DataBindings.Add( "Value", this.channelActive, "MultiplyRatio" ); this.divideRatio.DataBindings.Add( "Value", this.channelActive, "DivideRatio" ); this.minimumDAC.DataBindings.Add( "Value", this.channelActive, "MinimumDACBand" ); this.affinityBand.DataBindings.Add( "Value", this.channelActive, "AffinityBand" ); this.maximumDAC.DataBindings.Add( "Value", this.channelActive, "MaximumDACBand" ); this.guardBand.DataBindings.Add( "Value", this.channelActive, "GuardBand" ); }
private void okButton_Click( object sender, EventArgs e ) { rfid.Constants.Result result = rfid.Constants.Result.OK; try { result = this.channelActive.store( LakeChabotReader.MANAGED_ACCESS, this.reader.ReaderHandle ); } catch ( Exception exp ) { MessageBox.Show( "Reader Error.\n\nAn error occurred while updating the frequency channel settings.\n\nThe follow error occurred: " + exp.Message, "RF Frequency Band Error", MessageBoxButtons.OK, MessageBoxIcon.Error ); return; } if ( rfid.Constants.Result.OK != result ) { MessageBox.Show( "Reader Error.\n\nThe Reader was unable to configure the specified frequency channel settings.\n\nThe follow error occurred: " + result.ToString( ), "RF Frequency Band Error", MessageBoxButtons.OK, MessageBoxIcon.Error ); return; } // Need to retrieve the affinityBand value since potentially // modified by the radio during set operation(s) Source_FrequencyBand channelUpdated = new Source_FrequencyBand( channelActive.Band ); try { result = channelUpdated.load( LakeChabotReader.MANAGED_ACCESS, this.reader.ReaderHandle ); } catch ( Exception exp ) { MessageBox.Show( "Reader Error.\n\nAn error occurred while retrieving updated frequency channel information.\n\nThe follow error occurred: " + exp.Message, "RF Frequency Band Error", MessageBoxButtons.OK, MessageBoxIcon.Error ); return; } if ( rfid.Constants.Result.OK != result ) { MessageBox.Show( "Reader Error.\n\nThe Reader was unable to configure the specified frequency channel settings.\n\nThe follow error occurred: " + result.ToString( ), "RF Frequency Band Error", MessageBoxButtons.OK, MessageBoxIcon.Error ); return; } this.channelMaster.Copy( this.channelActive ); DialogResult = DialogResult.OK; }