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; } } }
private void InitializeTapi() { try { if (tTapi.Initialize() == 0) { MessageBox.Show("No TAPI devices available."); this.Close(); } tTapi.TE_CALLSTATE += new EventHandler <TapiCallStateEventArgs>(tapi_TE_CALLSTATE); // Add all the voice-capable lines. comboBox1.Items.AddRange( Array.FindAll(tTapi.Addresses, delegate(TAddress addr) { return((addr.MediaTypes & TAPIMEDIATYPES.AUDIO) != 0); })); if (comboBox1.Items.Count > 0) { comboBox1.SelectedIndex = 0; selectedAddress = (TAddress)comboBox1.SelectedItem; } } catch (Exception e) { MessageBox.Show(e.ToString()); } }
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); } }
private static void InitializeTAPI() { tapi.Initialize(); }