📄 form1.cs
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Reflection;
using System.Text;
using System.Windows.Forms;
using Microsoft.WindowsMobile.PocketOutlook;
using Microsoft.WindowsMobile.PocketOutlook.MessageInterception;
using Microsoft.WindowsMobile.Telephony;
namespace Chapter9
{
public partial class Form1 : Form
{
private MessageInterceptor mi;
public Form1()
{
InitializeComponent();
//setup the sms interceptor
if (MessageInterceptor.IsApplicationLauncherEnabled("Chapter9"))
{
//load existing settings
mi = new MessageInterceptor("Chapter9");
}
else
{
//setup rule and register with application id "Chapter9"
mi = new MessageInterceptor(InterceptionAction.NotifyAndDelete);
mi.MessageCondition = new MessageCondition(MessageProperty.Body, MessagePropertyComparisonType.StartsWith, "Chapter9");
string appPath = Assembly.GetExecutingAssembly().GetName().CodeBase;
mi.EnableApplicationLauncher("Chapter9", appPath);
}
mi.MessageReceived += new MessageInterceptorEventHandler(mi_MessageReceived);
}
void mi_MessageReceived(object sender, MessageInterceptorEventArgs e)
{
MessageBox.Show(((SmsMessage)e.Message).Body, "SMS Received");
}
private void mnuCall_Click(object sender, EventArgs e)
{
Phone p = new Phone();
p.Talk(txtNumber.Text, true);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -