📄 form1.cs
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Reflection;
namespace VoiceCall
{
public partial class Form1 : Form
{
private Telephony t = new Telephony();
public Form1()
{
InitializeComponent();
}
private void btnCall_Click(object sender, EventArgs e)
{
Chapter9.Phone.MakeCall(txtPhoneNumber.Text, true);
}
private void chkFlight_CheckStateChanged(object sender, EventArgs e)
{
t.PhoneEnabled = !chkFlight.Checked;
}
private void btnRasConnections_Click(object sender, EventArgs e)
{
foreach (string connectionName in Chapter9.Ras.Entries)
{
MessageBox.Show(connectionName);
}
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void Form1_Closing(object sender, CancelEventArgs e)
{
t.Dispose();
}
Chapter9.RasConnection rc;
private void btnRas_Click(object sender, EventArgs e)
{
try
{
rc = Chapter9.Ras.Dial(txtRas.Text, null, null, null);
}
catch(System.ComponentModel.Win32Exception we)
{
MessageBox.Show(we.Message + " : " + we.NativeErrorCode.ToString("X"));
}
}
private void btnHangup_Click(object sender, EventArgs e)
{
if (rc != null)
{
rc.HangUp();
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -