Ejemplo n.º 1
0
        private void btnUse_Click(object sender, EventArgs e)
        {
            if (line != null)
            {
                line = null;
                if (cn != 0) tapi.UnregisterNotifications(cn);
            }
            foreach (TAPI3Lib.ITAddress ad in (tapi.Addresses as TAPI3Lib.ITCollection))
            {
                if (ad.AddressName == cbProviders.Text)
                {
                    line = ad;
                    break;
                }
            }
            if (line != null)
            {
                try
                {
                    cn = tapi.RegisterCallNotifications(line, true, true, TAPI3Lib.TapiConstants.TAPIMEDIATYPE_AUDIO, 2);
                    cbProviders.Enabled = false;
                    btnUse.Enabled = false;
                }
                catch (System.Runtime.InteropServices.COMException eCOM)
                {
                    MessageBox.Show(eCOM.Message, "Error has occured in TAPI3Lib", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                catch (Exception eX)
                {
                    MessageBox.Show(eX.Message, "Error has occured in TAPI3Lib", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

            }
        }
Ejemplo n.º 2
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (line != null)
     {
         line = null;
         if (cn != 0)
         {
             tapi.UnregisterNotifications(cn);
         }
     }
     foreach (TAPI3Lib.ITAddress ad in (tapi.Addresses as TAPI3Lib.ITCollection))
     {
         if (ad.AddressName == cbLines.Text)
         {
             line = ad;
             break;
         }
     }
     if (line != null)
     {
         cn = tapi.RegisterCallNotifications(line, true, true, TAPI3Lib.TapiConstants.TAPIMEDIATYPE_AUDIO, 2);
     }
 }