private void importButton_Click(object sender, EventArgs e) { Cursor priorCursor = null; RFID_Explorer.mainForm.CommonDialogSupport dlg = new mainForm.CommonDialogSupport(mainForm.CommonDialogSupport.DialogType.OpenAntenna); if (dlg.ShowDialog( ) == DialogResult.OK) { try { this.Capture = true; priorCursor = Cursor.Current; Cursor.Current = Cursors.WaitCursor; try { Source_AntennaList loadedAntennaList = RFID_Explorer.ExcelExport.ImportAntennaConfig(this.reader, dlg.FileName); rfid.Constants.Result result = loadedAntennaList.store(LakeChabotReader.MANAGED_ACCESS, this.reader.ReaderHandle); if (rfid.Constants.Result.OK != result) { throw new Exception(result.ToString( )); } this.antennaList.Clear( ); this.antennaList.AddRange(loadedAntennaList); view.Refresh( ); } catch (Exception e2) { MessageBox.Show(String.Format("Error importing antenna settings.\n\nThe import file contains this.errors and cannot be used until corrected.\n\n{0}", e2.Message), "Invalid import file", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } finally { if (priorCursor != null) { Cursor.Current = priorCursor; } this.Capture = false; } } }
private void importButton_Click(object sender, EventArgs e) { Cursor priorCursor = null; RFID_Explorer.mainForm.CommonDialogSupport dlg = new mainForm.CommonDialogSupport(mainForm.CommonDialogSupport.DialogType.OpenChannel); if (dlg.ShowDialog( ) == DialogResult.OK) { try { this.Capture = true; priorCursor = Cursor.Current; Cursor.Current = Cursors.WaitCursor; try { this.bindingSource.DataSource = this.channelList = RFID_Explorer.ExcelExport.ImportRFChannelConfig(this.reader, dlg.FileName); rfid.Constants.Result result = this.channelList.store(LakeChabotReader.MANAGED_ACCESS, this.reader.ReaderHandle); if (rfid.Constants.Result.OK != result) { throw new Exception(result.ToString( )); } this.view.Refresh( ); } catch (Exception e2) { MessageBox.Show(String.Format("Error importing RF channel settings.\n\n{0}", e2.Message), "Invalid import file", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } finally { if (priorCursor != null) { Cursor.Current = priorCursor; } this.Capture = false; } } }
private void importButton_Click( object sender, EventArgs e ) { Cursor priorCursor = null; RFID_Explorer.mainForm.CommonDialogSupport dlg = new mainForm.CommonDialogSupport( mainForm.CommonDialogSupport.DialogType.OpenAntenna ); if ( dlg.ShowDialog( ) == DialogResult.OK ) { try { this.Capture = true; priorCursor = Cursor.Current; Cursor.Current = Cursors.WaitCursor; try { Source_AntennaList loadedAntennaList = RFID_Explorer.ExcelExport.ImportAntennaConfig( this.reader, dlg.FileName ); rfid.Constants.Result result = loadedAntennaList.store( LakeChabotReader.MANAGED_ACCESS, this.reader.ReaderHandle ); if ( rfid.Constants.Result.OK != result ) { throw new Exception( result.ToString( ) ); } this.antennaList.Clear( ); this.antennaList.AddRange( loadedAntennaList ); view.Refresh( ); } catch ( Exception e2 ) { MessageBox.Show( String.Format( "Error importing antenna settings.\n\nThe import file contains this.errors and cannot be used until corrected.\n\n{0}", e2.Message ), "Invalid import file", MessageBoxButtons.OK, MessageBoxIcon.Error ); return; } } finally { if ( priorCursor != null ) { Cursor.Current = priorCursor; } this.Capture = false; } } }