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

📄 form1.cs

📁 pc连接mobile手机发短信
💻 CS
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace PcSms
{
    public partial class Form1 : Form
    {
        OpenNETCF.Desktop.Communication.RAPI api;
        public Form1()
        {
            api = new OpenNETCF.Desktop.Communication.RAPI();
            InitializeComponent();
        }



        private void button1_Click(object sender, EventArgs e)
        {
            try
            {

                if (!api.Connected)
                {
                    api.Connect();
                }
                string prucpath = System.Configuration.ConfigurationSettings.AppSettings["winMobSmsPath"];

                api.CreateProcess(prucpath, this.textBox1.Text.Trim() + " " + textBox2.Text.Trim());

                if (api.Connected)
                {
                    api.Disconnect();
                }

            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.Message);

            }
        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            textBox1.Text = System.Text.RegularExpressions.Regex.Replace(textBox1.Text, @"\D", "");
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            AddTel();
        }

        private void AddTel()
        {
            try
            {
                string telpath = System.Configuration.ConfigurationSettings.AppSettings["telPath"];
                if (!System.IO.File.Exists(telpath)) return;
                string[] tels = System.IO.File.ReadAllLines(telpath, System.Text.Encoding.Default);
                this.listBox1.DataSource = tels;
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.Message);

            }

        }

        private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            textBox1.Text = listBox1.SelectedValue as string;
        }
    }
}

⌨️ 快捷键说明

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