public SelectTAPIForm( string lineToUse = "" ) { InitializeComponent(); WasCancelled = false; LineToUse = lineToUse; log.Info( "Searching for TAPI devices…" ); TTapi tapi = new TTapi(); int foundDevices = tapi.Initialize(); log.Info( String.Format( "{0} devices found", foundDevices ) ); if( 0 == foundDevices ) { MessageBox.Show( "No available TAPI lines found.", "TAPI Error", MessageBoxButtons.OK, MessageBoxIcon.Error ); Close(); } else { foreach( TAddress addr in tapi.Addresses ) { log.Info( String.Format( "\t{0}", addr.AddressName ) ); tapiSelectBox.Items.Add( addr.AddressName ); // If this is the previously selected line, select it in the UI as well. if( addr.AddressName == lineToUse ) { tapiSelectBox.SelectedItem = addr.AddressName; } } // Select first item if nothing else is selected. if( tapiSelectBox.SelectedIndex < 0 ) { tapiSelectBox.SelectedIndex = 0; } } }
public SelectTAPIForm() { InitializeComponent(); TTapi tapi = new TTapi(); int foundDevices = tapi.Initialize(); log.Info("Searching for TAPI devices..."); log.Info(String.Format("{0} devices found", foundDevices)); foreach (TAddress addr in tapi.Addresses) { log.Info(String.Format("\t{0}", addr.AddressName)); comboBox1.Items.Add(addr.AddressName); } }