⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form1.cs

📁 vs2005 c# wince 查询取得电话状态
💻 CS
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Microsoft.WindowsMobile.Status;
using System.Threading;

namespace PhoneState
{
    public partial class Form1 : Form
    {
        private SystemState callState, callCount;

        public Form1()
        {
            InitializeComponent();
            ListenCall();
        }


        public void ListenCall()
        {
            callState = new SystemState(SystemProperty.PhoneCallTalking);
            callCount = new SystemState(SystemProperty.PhoneActiveCallCount);

            callState.Changed += new ChangeEventHandler(callState_Changed);
            callCount.Changed += new ChangeEventHandler(callCount_Changed);
        }

        void callCount_Changed(object sender, ChangeEventArgs args)
        {
            if (args.NewValue != null && (int)args.NewValue !=0)
             MessageBox.Show("Call Incoming...");
        }

        void callState_Changed(object sender, ChangeEventArgs args)
        {
            if (args.NewValue != null)
            {
                String state = ((int)args.NewValue) == 1 ? "talking..." : "hang up";
                MessageBox.Show(state);
            }
        }








    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -