📄 extapi.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace ExTapi
{
#region Header Information
/**********************************************************\
|* ExTapi - APAX *|
|* Copyright (c) TurboPower Software 2002 *|
|* All rights reserved. *|
|**********************************************************|
|**********************Description*************************|
|* An example of testing TAPI and the events generated. *|
\**********************************************************/
#endregion
public class Form1 : System.Windows.Forms.Form
{
public System.Windows.Forms.GroupBox Frame1;
public System.Windows.Forms.CheckBox chkTapiStatusDisplay;
public System.Windows.Forms.Button cmdCancel;
public System.Windows.Forms.Button cmdDial;
public System.Windows.Forms.Button cmdAnswer;
public System.Windows.Forms.Button cmdConfig;
public System.Windows.Forms.Button cmdSelect;
public System.Windows.Forms.GroupBox Frame2;
public System.Windows.Forms.TextBox txtSilenceThreshold;
public System.Windows.Forms.TextBox txtTrimSeconds;
public System.Windows.Forms.TextBox txtMaxMessageLength;
public System.Windows.Forms.TextBox txtRetryWait;
public System.Windows.Forms.TextBox txtMaxAttempts;
public System.Windows.Forms.TextBox txtAnswerOnRing;
public System.Windows.Forms.CheckBox chkUseSoundCard;
public System.Windows.Forms.CheckBox chkInterruptWave;
public System.Windows.Forms.CheckBox chkEnableVoice;
public System.Windows.Forms.Label Label6;
public System.Windows.Forms.Label Label5;
public System.Windows.Forms.Label Label4;
public System.Windows.Forms.Label Label3;
public System.Windows.Forms.Label Label2;
public System.Windows.Forms.Label Label1;
public System.Windows.Forms.GroupBox Frame3;
public System.Windows.Forms.CheckBox chkOverwrite;
public System.Windows.Forms.Button cmdStop;
public System.Windows.Forms.Button cmdRecord;
public System.Windows.Forms.Button cmdDTMF;
public System.Windows.Forms.Button cmdPlay;
public System.Windows.Forms.TextBox txtWavDirectory;
public System.Windows.Forms.Label Label7;
public System.Windows.Forms.ListBox lstTapiStatus;
private System.Windows.Forms.Label label8;
private AxMSComDlg.AxCommonDialog cdCommonDialog;
private System.Windows.Forms.HelpProvider helpProvider1;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.TextBox txtDTMF;
private AxAPAX1.AxApax axApax1;
/// <summary>
/// Required designer variable.
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private System.ComponentModel.Container components = null;
public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1));
this.Frame1 = new System.Windows.Forms.GroupBox();
this.axApax1 = new AxAPAX1.AxApax();
this.chkTapiStatusDisplay = new System.Windows.Forms.CheckBox();
this.cmdCancel = new System.Windows.Forms.Button();
this.cmdAnswer = new System.Windows.Forms.Button();
this.cmdConfig = new System.Windows.Forms.Button();
this.cmdSelect = new System.Windows.Forms.Button();
this.cmdDial = new System.Windows.Forms.Button();
this.Frame2 = new System.Windows.Forms.GroupBox();
this.txtSilenceThreshold = new System.Windows.Forms.TextBox();
this.txtTrimSeconds = new System.Windows.Forms.TextBox();
this.txtMaxMessageLength = new System.Windows.Forms.TextBox();
this.txtRetryWait = new System.Windows.Forms.TextBox();
this.txtMaxAttempts = new System.Windows.Forms.TextBox();
this.txtAnswerOnRing = new System.Windows.Forms.TextBox();
this.chkUseSoundCard = new System.Windows.Forms.CheckBox();
this.chkInterruptWave = new System.Windows.Forms.CheckBox();
this.chkEnableVoice = new System.Windows.Forms.CheckBox();
this.Label6 = new System.Windows.Forms.Label();
this.Label5 = new System.Windows.Forms.Label();
this.Label4 = new System.Windows.Forms.Label();
this.Label3 = new System.Windows.Forms.Label();
this.Label2 = new System.Windows.Forms.Label();
this.Label1 = new System.Windows.Forms.Label();
this.Frame3 = new System.Windows.Forms.GroupBox();
this.cdCommonDialog = new AxMSComDlg.AxCommonDialog();
this.chkOverwrite = new System.Windows.Forms.CheckBox();
this.cmdStop = new System.Windows.Forms.Button();
this.cmdRecord = new System.Windows.Forms.Button();
this.cmdDTMF = new System.Windows.Forms.Button();
this.cmdPlay = new System.Windows.Forms.Button();
this.txtWavDirectory = new System.Windows.Forms.TextBox();
this.Label7 = new System.Windows.Forms.Label();
this.lstTapiStatus = new System.Windows.Forms.ListBox();
this.label8 = new System.Windows.Forms.Label();
this.helpProvider1 = new System.Windows.Forms.HelpProvider();
this.label9 = new System.Windows.Forms.Label();
this.txtDTMF = new System.Windows.Forms.TextBox();
this.Frame1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.axApax1)).BeginInit();
this.Frame2.SuspendLayout();
this.Frame3.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.cdCommonDialog)).BeginInit();
this.SuspendLayout();
//
// Frame1
//
this.Frame1.BackColor = System.Drawing.SystemColors.Control;
this.Frame1.Controls.AddRange(new System.Windows.Forms.Control[] {
this.axApax1,
this.chkTapiStatusDisplay,
this.cmdCancel,
this.cmdAnswer,
this.cmdConfig,
this.cmdSelect,
this.cmdDial});
this.Frame1.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.Frame1.ForeColor = System.Drawing.SystemColors.ControlText;
this.Frame1.Location = new System.Drawing.Point(8, 8);
this.Frame1.Name = "Frame1";
this.Frame1.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.Frame1.Size = new System.Drawing.Size(321, 97);
this.Frame1.TabIndex = 1;
this.Frame1.TabStop = false;
this.Frame1.Text = " Tapi device connection ";
this.Frame1.Enter += new System.EventHandler(this.Frame1_Enter);
//
// axApax1
//
this.axApax1.ContainingControl = this;
this.axApax1.Location = new System.Drawing.Point(264, 16);
this.axApax1.Name = "axApax1";
this.axApax1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axApax1.OcxState")));
this.axApax1.Size = new System.Drawing.Size(48, 32);
this.axApax1.TabIndex = 7;
this.axApax1.OnTapiDTMF += new AxAPAX1.IApaxEvents_OnTapiDTMFEventHandler(this.axApax1_OnTapiDTMF);
this.axApax1.OnTapiConnect += new System.EventHandler(this.axApax1_OnTapiConnect);
this.axApax1.OnTapiCallerID += new AxAPAX1.IApaxEvents_OnTapiCallerIDEventHandler(this.axApax1_OnTapiCallerID);
//
// chkTapiStatusDisplay
//
this.chkTapiStatusDisplay.BackColor = System.Drawing.SystemColors.Control;
this.chkTapiStatusDisplay.Cursor = System.Windows.Forms.Cursors.Default;
this.chkTapiStatusDisplay.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.chkTapiStatusDisplay.ForeColor = System.Drawing.SystemColors.ControlText;
this.chkTapiStatusDisplay.Location = new System.Drawing.Point(192, 56);
this.chkTapiStatusDisplay.Name = "chkTapiStatusDisplay";
this.chkTapiStatusDisplay.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.chkTapiStatusDisplay.Size = new System.Drawing.Size(113, 33);
this.chkTapiStatusDisplay.TabIndex = 6;
this.chkTapiStatusDisplay.Text = "Show status dialog";
//
// cmdCancel
//
this.cmdCancel.BackColor = System.Drawing.SystemColors.Control;
this.cmdCancel.Cursor = System.Windows.Forms.Cursors.Default;
this.cmdCancel.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.cmdCancel.ForeColor = System.Drawing.SystemColors.ControlText;
this.cmdCancel.Location = new System.Drawing.Point(184, 24);
this.cmdCancel.Name = "cmdCancel";
this.cmdCancel.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.cmdCancel.Size = new System.Drawing.Size(76, 29);
this.cmdCancel.TabIndex = 5;
this.cmdCancel.Text = "Cancel";
this.cmdCancel.Click += new System.EventHandler(this.cmdCancel_Click);
//
// cmdAnswer
//
this.cmdAnswer.BackColor = System.Drawing.SystemColors.Control;
this.cmdAnswer.Cursor = System.Windows.Forms.Cursors.Default;
this.cmdAnswer.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.cmdAnswer.ForeColor = System.Drawing.SystemColors.ControlText;
this.cmdAnswer.Location = new System.Drawing.Point(24, 24);
this.cmdAnswer.Name = "cmdAnswer";
this.cmdAnswer.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.cmdAnswer.Size = new System.Drawing.Size(76, 29);
this.cmdAnswer.TabIndex = 3;
this.cmdAnswer.Text = "Answer";
this.cmdAnswer.Click += new System.EventHandler(this.cmdAnswer_Click);
//
// cmdConfig
//
this.cmdConfig.BackColor = System.Drawing.SystemColors.Control;
this.cmdConfig.Cursor = System.Windows.Forms.Cursors.Default;
this.cmdConfig.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.cmdConfig.ForeColor = System.Drawing.SystemColors.ControlText;
this.cmdConfig.Location = new System.Drawing.Point(104, 56);
this.cmdConfig.Name = "cmdConfig";
this.cmdConfig.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.cmdConfig.Size = new System.Drawing.Size(76, 29);
this.cmdConfig.TabIndex = 2;
this.cmdConfig.Text = "Config...";
this.cmdConfig.Click += new System.EventHandler(this.cmdConfig_Click);
//
// cmdSelect
//
this.cmdSelect.BackColor = System.Drawing.SystemColors.Control;
this.cmdSelect.Cursor = System.Windows.Forms.Cursors.Default;
this.cmdSelect.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.cmdSelect.ForeColor = System.Drawing.SystemColors.ControlText;
this.cmdSelect.Location = new System.Drawing.Point(24, 56);
this.cmdSelect.Name = "cmdSelect";
this.cmdSelect.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.cmdSelect.Size = new System.Drawing.Size(76, 29);
this.cmdSelect.TabIndex = 1;
this.cmdSelect.Text = "Select...";
this.cmdSelect.Click += new System.EventHandler(this.cmdSelect_Click);
//
// cmdDial
//
this.cmdDial.BackColor = System.Drawing.SystemColors.Control;
this.cmdDial.Cursor = System.Windows.Forms.Cursors.Default;
this.cmdDial.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.cmdDial.ForeColor = System.Drawing.SystemColors.ControlText;
this.cmdDial.Location = new System.Drawing.Point(104, 24);
this.cmdDial.Name = "cmdDial";
this.cmdDial.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.cmdDial.Size = new System.Drawing.Size(76, 29);
this.cmdDial.TabIndex = 4;
this.cmdDial.Text = "Dial...";
this.cmdDial.Click += new System.EventHandler(this.cmdDial_Click);
//
// Frame2
//
this.Frame2.BackColor = System.Drawing.SystemColors.Control;
this.Frame2.Controls.AddRange(new System.Windows.Forms.Control[] {
this.txtSilenceThreshold,
this.txtTrimSeconds,
this.txtMaxMessageLength,
this.txtRetryWait,
this.txtMaxAttempts,
this.txtAnswerOnRing,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -