📄 extapi.cs
字号:
this.chkOverwrite.BackColor = System.Drawing.SystemColors.Control;
this.chkOverwrite.Cursor = System.Windows.Forms.Cursors.Default;
this.chkOverwrite.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.chkOverwrite.ForeColor = System.Drawing.SystemColors.ControlText;
this.chkOverwrite.Location = new System.Drawing.Point(200, 64);
this.chkOverwrite.Name = "chkOverwrite";
this.chkOverwrite.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.chkOverwrite.Size = new System.Drawing.Size(81, 33);
this.chkOverwrite.TabIndex = 24;
this.chkOverwrite.Text = "Overwrite";
//
// cmdStop
//
this.cmdStop.BackColor = System.Drawing.SystemColors.Control;
this.cmdStop.Cursor = System.Windows.Forms.Cursors.Default;
this.cmdStop.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.cmdStop.ForeColor = System.Drawing.SystemColors.ControlText;
this.cmdStop.Location = new System.Drawing.Point(112, 96);
this.cmdStop.Name = "cmdStop";
this.cmdStop.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.cmdStop.Size = new System.Drawing.Size(76, 29);
this.cmdStop.TabIndex = 23;
this.cmdStop.Text = "Stop";
this.cmdStop.Click += new System.EventHandler(this.cmdStop_Click);
//
// cmdRecord
//
this.cmdRecord.BackColor = System.Drawing.SystemColors.Control;
this.cmdRecord.Cursor = System.Windows.Forms.Cursors.Default;
this.cmdRecord.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.cmdRecord.ForeColor = System.Drawing.SystemColors.ControlText;
this.cmdRecord.Location = new System.Drawing.Point(112, 64);
this.cmdRecord.Name = "cmdRecord";
this.cmdRecord.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.cmdRecord.Size = new System.Drawing.Size(76, 29);
this.cmdRecord.TabIndex = 22;
this.cmdRecord.Text = "Record...";
this.cmdRecord.Click += new System.EventHandler(this.cmdRecord_Click);
//
// cmdDTMF
//
this.cmdDTMF.BackColor = System.Drawing.SystemColors.Control;
this.cmdDTMF.Cursor = System.Windows.Forms.Cursors.Default;
this.cmdDTMF.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.cmdDTMF.ForeColor = System.Drawing.SystemColors.ControlText;
this.cmdDTMF.Location = new System.Drawing.Point(24, 96);
this.cmdDTMF.Name = "cmdDTMF";
this.cmdDTMF.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.cmdDTMF.Size = new System.Drawing.Size(76, 29);
this.cmdDTMF.TabIndex = 21;
this.cmdDTMF.Text = "DTMF...";
this.cmdDTMF.Click += new System.EventHandler(this.cmdDTMF_Click);
//
// cmdPlay
//
this.cmdPlay.BackColor = System.Drawing.SystemColors.Control;
this.cmdPlay.Cursor = System.Windows.Forms.Cursors.Default;
this.cmdPlay.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.cmdPlay.ForeColor = System.Drawing.SystemColors.ControlText;
this.cmdPlay.Location = new System.Drawing.Point(24, 64);
this.cmdPlay.Name = "cmdPlay";
this.cmdPlay.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.cmdPlay.Size = new System.Drawing.Size(76, 29);
this.cmdPlay.TabIndex = 20;
this.cmdPlay.Text = "Play...";
this.cmdPlay.Click += new System.EventHandler(this.cmdPlay_Click);
//
// txtWavDirectory
//
this.txtWavDirectory.AcceptsReturn = true;
this.txtWavDirectory.AutoSize = false;
this.txtWavDirectory.BackColor = System.Drawing.SystemColors.Window;
this.txtWavDirectory.Cursor = System.Windows.Forms.Cursors.IBeam;
this.txtWavDirectory.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.txtWavDirectory.ForeColor = System.Drawing.SystemColors.WindowText;
this.txtWavDirectory.Location = new System.Drawing.Point(104, 24);
this.txtWavDirectory.MaxLength = 0;
this.txtWavDirectory.Name = "txtWavDirectory";
this.txtWavDirectory.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.txtWavDirectory.Size = new System.Drawing.Size(193, 25);
this.txtWavDirectory.TabIndex = 19;
this.txtWavDirectory.Text = "\\apax\\examples";
//
// Label7
//
this.Label7.AutoSize = true;
this.Label7.BackColor = System.Drawing.SystemColors.Control;
this.Label7.Cursor = System.Windows.Forms.Cursors.Default;
this.Label7.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.Label7.ForeColor = System.Drawing.SystemColors.ControlText;
this.Label7.Location = new System.Drawing.Point(24, 28);
this.Label7.Name = "Label7";
this.Label7.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.Label7.Size = new System.Drawing.Size(73, 13);
this.Label7.TabIndex = 18;
this.Label7.Text = "Wav Directory";
//
// lstTapiStatus
//
this.lstTapiStatus.BackColor = System.Drawing.SystemColors.Window;
this.lstTapiStatus.Cursor = System.Windows.Forms.Cursors.Default;
this.lstTapiStatus.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.lstTapiStatus.ForeColor = System.Drawing.SystemColors.WindowText;
this.lstTapiStatus.ItemHeight = 14;
this.lstTapiStatus.Location = new System.Drawing.Point(336, 16);
this.lstTapiStatus.Name = "lstTapiStatus";
this.lstTapiStatus.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.lstTapiStatus.Size = new System.Drawing.Size(265, 382);
this.lstTapiStatus.TabIndex = 26;
//
// label8
//
this.label8.Location = new System.Drawing.Point(336, 0);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(120, 16);
this.label8.TabIndex = 27;
this.label8.Text = "Tapi Status";
//
// label9
//
this.label9.Location = new System.Drawing.Point(8, 128);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(72, 16);
this.label9.TabIndex = 26;
this.label9.Text = "Send Tones";
//
// txtDTMF
//
this.txtDTMF.Location = new System.Drawing.Point(80, 128);
this.txtDTMF.Name = "txtDTMF";
this.txtDTMF.Size = new System.Drawing.Size(160, 20);
this.txtDTMF.TabIndex = 27;
this.txtDTMF.Text = "";
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(608, 422);
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.label8,
this.lstTapiStatus,
this.Frame3,
this.Frame2,
this.Frame1});
this.Name = "Form1";
this.Text = "Form1";
this.Activated += new System.EventHandler(this.Form1_Activated);
this.Frame1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.axApax1)).EndInit();
this.Frame2.ResumeLayout(false);
this.Frame3.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.cdCommonDialog)).EndInit();
this.ResumeLayout(false);
}
#endregion
private void cmdAnswer_Click(object sender, System.EventArgs e)
{
lstTapiStatus.Items.Add(axApax1.TapiState.ToString());
axApax1.TapiAutoAnswer();
lstTapiStatus.Items.Add(axApax1.TapiState.ToString());
}
private void Frame1_Enter(object sender, System.EventArgs e)
{
}
private void cmdDial_Click(object sender, System.EventArgs e)
{
axApax1.TapiDial();
lstTapiStatus.Items.Add(axApax1.TapiState.ToString());
}
private void cmdCancel_Click(object sender, System.EventArgs e)
{
axApax1.TapiCancelCall();
lstTapiStatus.Items.Add(axApax1.TapiState.ToString());
}
private void cmdSelect_Click(object sender, System.EventArgs e)
{
axApax1.Select();
//axApax1.SelectedDevice();
}
private void cmdConfig_Click(object sender, System.EventArgs e)
{
axApax1.TapiShowConfigDialog(true);
}
private void cmdPlay_Click(object sender, System.EventArgs e)
{
cdCommonDialog.FileName = txtWavDirectory.Text;
if (cdCommonDialog.FileName != "")
{
lstTapiStatus.Items.Add("Playing wave file");
axApax1.TapiPlayWaveFile(cdCommonDialog.FileName);
}
}
private void cmdRecord_Click(object sender, System.EventArgs e)
{
bool OverWriteBool;
cdCommonDialog.DialogTitle = "Record Wav File";
cdCommonDialog.InitDir = txtWavDirectory.Text;
cdCommonDialog.ShowSave();
OverWriteBool = chkOverwrite.Checked;
lstTapiStatus.Items.Add("Recording wave file )" + cdCommonDialog.FileName + ")");
axApax1.TapiRecordWaveFile(cdCommonDialog.FileName, true);
}
private void cmdStop_Click(object sender, System.EventArgs e)
{
axApax1.TapiStopWaveFile();
lstTapiStatus.Items.Add("Stop wave file");
}
private void cmdDTMF_Click(object sender, System.EventArgs e)
{
string S;
S = txtDTMF.Text;
if (S != "")
{
lstTapiStatus.Items.Add("SendTone (" + S + ")");
axApax1.TapiSendTone(S);
}
else
lstTapiStatus.Items.Add("No tones to send");
}
private void Form1_Activated(object sender, System.EventArgs e)
{
axApax1.Visible = false;
txtAnswerOnRing.Text = axApax1.AnswerOnRing.ToString();
txtMaxAttempts.Text = axApax1.MaxAttempts.ToString();
txtRetryWait.Text = axApax1.TapiRetryWait.ToString();
txtMaxMessageLength.Text = axApax1.MaxMessageLength.ToString();
txtTrimSeconds.Text = axApax1.TrimSeconds.ToString();
txtSilenceThreshold.Text = axApax1.SilenceThreshold.ToString();
chkEnableVoice.Checked = axApax1.EnableVoice;
chkInterruptWave.Checked = axApax1.InterruptWave;
chkUseSoundCard.Checked = axApax1.UseSoundCard;
chkTapiStatusDisplay.Checked = axApax1.TapiStatusDisplay;
}
private void txtAnswerOnRing_TextChanged(object sender, System.EventArgs e)
{
axApax1.AnswerOnRing = Int32.Parse(txtAnswerOnRing.Text);
}
private void axApax1_OnTapiConnect(object sender, System.EventArgs e)
{
lstTapiStatus.Items.Add("OnTapiConnect fired");
lstTapiStatus.Items.Add(axApax1.TapiState.ToString());
if (axApax1.EnableVoice)
axApax1.TapiPlayWaveFile(txtWavDirectory.Text);
}
private void axApax1_OnTapiCallerID(object sender, AxAPAX1.IApaxEvents_OnTapiCallerIDEvent e)
{
lstTapiStatus.Items.Add("Caller ID = " + e.iD);
lstTapiStatus.Items.Add("Name = " + e.iDName);
}
private void axApax1_OnTapiDTMF(object sender, AxAPAX1.IApaxEvents_OnTapiDTMFEvent e)
{
lstTapiStatus.Items.Add("OnTapiDTMF:" + e.digit);
lstTapiStatus.Items.Add(axApax1.TapiState.ToString());
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -