亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? form1.cs

?? C#通過計算機讀取手機的短信列表,發(fā)送短信,發(fā)送測試AT命令的DEMO
?? CS
字號:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Threading;
using System.Text;
using JustinIO;
using SMS;
using System.IO;


namespace smsForCsharp
{
	/// <summary>
	/// Form1 的摘要說明。
	/// </summary>
	public class Form1 : System.Windows.Forms.Form
	{
		static  JustinIO.CommPort ss_port = new JustinIO.CommPort();
		PDUdecoding sms = new SMS.PDUdecoding();
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.Label label2;
		private System.Windows.Forms.GroupBox groupBox1;
		private System.Windows.Forms.GroupBox groupBox2;
		private System.Windows.Forms.TextBox targetNumber;
		private System.Windows.Forms.TextBox CenterNumber;
		private System.Windows.Forms.Label label3;
		private System.Windows.Forms.Label label4;
		private System.Windows.Forms.Label ConnectState;
		private System.Windows.Forms.GroupBox groupBox3;
		private System.Windows.Forms.Button btnSend;
		private System.Windows.Forms.Button btnConnect;
		private System.Windows.Forms.Button btnExit;
		private System.Windows.Forms.TextBox smsState;
		private System.Windows.Forms.TextBox smsContent;
		private System.Windows.Forms.ComboBox ConnectPort;
		private System.Windows.Forms.ComboBox ConnectBaudRate;
		private System.Windows.Forms.Button about;
		
		/// <summary>
		/// 必需的設計器變量。
		/// </summary>
		private System.ComponentModel.Container components = null;

		public Form1()
		{
			//
			// Windows 窗體設計器支持所必需的
			//
			InitializeComponent();

			//
			// TODO: 在 InitializeComponent 調用后添加任何構造函數(shù)代碼
			//
		}

		/// <summary>
		/// 清理所有正在使用的資源。
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if (components != null) 
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		/// <summary>
		/// 設計器支持所需的方法 - 不要使用代碼編輯器修改
		/// 此方法的內容。
		/// </summary>
		private void InitializeComponent()
		{
			this.label1 = new System.Windows.Forms.Label();
			this.label2 = new System.Windows.Forms.Label();
			this.groupBox1 = new System.Windows.Forms.GroupBox();
			this.smsState = new System.Windows.Forms.TextBox();
			this.groupBox2 = new System.Windows.Forms.GroupBox();
			this.smsContent = new System.Windows.Forms.TextBox();
			this.targetNumber = new System.Windows.Forms.TextBox();
			this.CenterNumber = new System.Windows.Forms.TextBox();
			this.label3 = new System.Windows.Forms.Label();
			this.label4 = new System.Windows.Forms.Label();
			this.ConnectState = new System.Windows.Forms.Label();
			this.groupBox3 = new System.Windows.Forms.GroupBox();
			this.ConnectBaudRate = new System.Windows.Forms.ComboBox();
			this.ConnectPort = new System.Windows.Forms.ComboBox();
			this.btnSend = new System.Windows.Forms.Button();
			this.btnConnect = new System.Windows.Forms.Button();
			this.btnExit = new System.Windows.Forms.Button();
			this.about = new System.Windows.Forms.Button();
			this.groupBox1.SuspendLayout();
			this.groupBox2.SuspendLayout();
			this.groupBox3.SuspendLayout();
			this.SuspendLayout();
			// 
			// label1
			// 
			this.label1.Location = new System.Drawing.Point(0, 8);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(72, 16);
			this.label1.TabIndex = 0;
			this.label1.Text = "對方手機號:";
			// 
			// label2
			// 
			this.label2.Location = new System.Drawing.Point(272, 8);
			this.label2.Name = "label2";
			this.label2.Size = new System.Drawing.Size(72, 16);
			this.label2.TabIndex = 1;
			this.label2.Text = "短信中心號:";
			// 
			// groupBox1
			// 
			this.groupBox1.Controls.AddRange(new System.Windows.Forms.Control[] {
																					this.smsState});
			this.groupBox1.Location = new System.Drawing.Point(0, 32);
			this.groupBox1.Name = "groupBox1";
			this.groupBox1.Size = new System.Drawing.Size(496, 136);
			this.groupBox1.TabIndex = 3;
			this.groupBox1.TabStop = false;
			this.groupBox1.Text = "短信發(fā)送狀態(tài)";
			// 
			// smsState
			// 
			this.smsState.Location = new System.Drawing.Point(8, 16);
			this.smsState.Multiline = true;
			this.smsState.Name = "smsState";
			this.smsState.ReadOnly = true;
			this.smsState.ScrollBars = System.Windows.Forms.ScrollBars.Horizontal;
			this.smsState.Size = new System.Drawing.Size(480, 112);
			this.smsState.TabIndex = 0;
			this.smsState.Text = "";
			// 
			// groupBox2
			// 
			this.groupBox2.Controls.AddRange(new System.Windows.Forms.Control[] {
																					this.smsContent});
			this.groupBox2.Location = new System.Drawing.Point(0, 176);
			this.groupBox2.Name = "groupBox2";
			this.groupBox2.Size = new System.Drawing.Size(248, 152);
			this.groupBox2.TabIndex = 4;
			this.groupBox2.TabStop = false;
			this.groupBox2.Text = "短信內容";
			// 
			// smsContent
			// 
			this.smsContent.Location = new System.Drawing.Point(8, 17);
			this.smsContent.Multiline = true;
			this.smsContent.Name = "smsContent";
			this.smsContent.Size = new System.Drawing.Size(229, 127);
			this.smsContent.TabIndex = 0;
			this.smsContent.Text = "";
			// 
			// targetNumber
			// 
			this.targetNumber.Location = new System.Drawing.Point(72, 8);
			this.targetNumber.Name = "targetNumber";
			this.targetNumber.TabIndex = 5;
			this.targetNumber.Text = "";
			// 
			// CenterNumber
			// 
			this.CenterNumber.Location = new System.Drawing.Point(344, 8);
			this.CenterNumber.Name = "CenterNumber";
			this.CenterNumber.TabIndex = 6;
			this.CenterNumber.Text = "";
			// 
			// label3
			// 
			this.label3.AutoSize = true;
			this.label3.Location = new System.Drawing.Point(24, 24);
			this.label3.Name = "label3";
			this.label3.Size = new System.Drawing.Size(66, 14);
			this.label3.TabIndex = 7;
			this.label3.Text = "通信端口:";
			// 
			// label4
			// 
			this.label4.AutoSize = true;
			this.label4.Location = new System.Drawing.Point(24, 56);
			this.label4.Name = "label4";
			this.label4.Size = new System.Drawing.Size(66, 14);
			this.label4.TabIndex = 8;
			this.label4.Text = "波 特 率:";
			// 
			// ConnectState
			// 
			this.ConnectState.BackColor = System.Drawing.SystemColors.Control;
			this.ConnectState.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
			this.ConnectState.ForeColor = System.Drawing.Color.Red;
			this.ConnectState.Location = new System.Drawing.Point(8, 80);
			this.ConnectState.Name = "ConnectState";
			this.ConnectState.Size = new System.Drawing.Size(224, 16);
			this.ConnectState.TabIndex = 10;
			this.ConnectState.Text = "尚未與任何設備連接";
			// 
			// groupBox3
			// 
			this.groupBox3.Controls.AddRange(new System.Windows.Forms.Control[] {
																					this.ConnectBaudRate,
																					this.ConnectPort,
																					this.ConnectState,
																					this.label3,
																					this.label4});
			this.groupBox3.Location = new System.Drawing.Point(248, 176);
			this.groupBox3.Name = "groupBox3";
			this.groupBox3.Size = new System.Drawing.Size(240, 104);
			this.groupBox3.TabIndex = 0;
			this.groupBox3.TabStop = false;
			this.groupBox3.Text = "端口設置";
			// 
			// ConnectBaudRate
			// 
			this.ConnectBaudRate.Items.AddRange(new object[] {
																 "9600",
																 "14400",
																 "19200",
																 "57600"});
			this.ConnectBaudRate.Location = new System.Drawing.Point(120, 56);
			this.ConnectBaudRate.Name = "ConnectBaudRate";
			this.ConnectBaudRate.Size = new System.Drawing.Size(80, 20);
			this.ConnectBaudRate.TabIndex = 12;
			this.ConnectBaudRate.Text = "19200";
			// 
			// ConnectPort
			// 
			this.ConnectPort.Items.AddRange(new object[] {
															 "COM1",
															 "COM2",
															 "COM3",
															 "COM4"});
			this.ConnectPort.Location = new System.Drawing.Point(120, 24);
			this.ConnectPort.Name = "ConnectPort";
			this.ConnectPort.Size = new System.Drawing.Size(80, 20);
			this.ConnectPort.TabIndex = 11;
			this.ConnectPort.Text = "COM1";
			// 
			// btnSend
			// 
			this.btnSend.Enabled = false;
			this.btnSend.Location = new System.Drawing.Point(256, 288);
			this.btnSend.Name = "btnSend";
			this.btnSend.Size = new System.Drawing.Size(48, 32);
			this.btnSend.TabIndex = 0;
			this.btnSend.Text = "發(fā)送";
			this.btnSend.Click += new System.EventHandler(this.btnSend_Click);
			// 
			// btnConnect
			// 
			this.btnConnect.Location = new System.Drawing.Point(312, 288);
			this.btnConnect.Name = "btnConnect";
			this.btnConnect.Size = new System.Drawing.Size(48, 32);
			this.btnConnect.TabIndex = 1;
			this.btnConnect.Text = "連接";
			this.btnConnect.Click += new System.EventHandler(this.btnConnect_Click);
			// 
			// btnExit
			// 
			this.btnExit.Location = new System.Drawing.Point(438, 288);
			this.btnExit.Name = "btnExit";
			this.btnExit.Size = new System.Drawing.Size(48, 32);
			this.btnExit.TabIndex = 3;
			this.btnExit.Text = "退出";
			this.btnExit.Click += new System.EventHandler(this.btnExit_Click);
			// 
			// about
			// 
			this.about.Location = new System.Drawing.Point(376, 288);
			this.about.Name = "about";
			this.about.Size = new System.Drawing.Size(48, 32);
			this.about.TabIndex = 7;
			this.about.Text = "說明";
			this.about.Click += new System.EventHandler(this.about_Click);
			// 
			// Form1
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(504, 333);
			this.Controls.AddRange(new System.Windows.Forms.Control[] {
																		  this.about,
																		  this.CenterNumber,
																		  this.targetNumber,
																		  this.groupBox2,
																		  this.groupBox1,
																		  this.label2,
																		  this.label1,
																		  this.groupBox3,
																		  this.btnExit,
																		  this.btnConnect,
																		  this.btnSend});
			this.Name = "Form1";
			this.Text = "終端短信C#版 ---- 天極網(wǎng)";
			this.groupBox1.ResumeLayout(false);
			this.groupBox2.ResumeLayout(false);
			this.groupBox3.ResumeLayout(false);
			this.ResumeLayout(false);

		}
		#endregion

		/// <summary>
		/// 應用程序的主入口點。
		/// </summary>
		[STAThread]
		static void Main() 
		{
			Application.Run(new Form1());
		}

		/// <summary>
		/// 初始化串口
		/// </summary>
		public bool InitCom(string m_port, int m_baudrate)
		{
			ss_port.PortNum = m_port;
			ss_port.BaudRate = m_baudrate;
			ss_port.ByteSize = 8;
			ss_port.Parity = 0;
			ss_port.StopBits = 1;
			ss_port.ReadTimeout = 1000;
			try
			{
				if (ss_port.Opened)
				{
					ss_port.Close();
					ss_port.Open();
				}
				else
				{
					ss_port.Open();//打開串口
				}
				return true;
			}
			catch
				(Exception e) 
			{
				MessageBox.Show("錯誤:" + e.Message);
				return false;
			}
		}

		/// <summary>
		/// 初始化代碼,并獲取手機相關信息
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void btnConnect_Click(object sender, System.EventArgs e)
		{
			bool opened = InitCom(ConnectPort.SelectedItem.ToString(),Convert.ToInt32(ConnectBaudRate.SelectedItem.ToString()));
			bool Connected = false;
			if (opened)
			{
				ss_port.Write(Encoding.ASCII.GetBytes("AT+CGMI\r")); //獲取手機品牌
				string response = Encoding.ASCII.GetString(ss_port.Read(128));
				if (response.Length > 0)
				{
					ConnectState.Text = response.Substring(10,7);
					Connected = true;
				}
			else
				 {
					ConnectState.Text = "與手機連接不成功";
					Connected = false;
				 }
				ss_port.Write(Encoding.ASCII.GetBytes("AT+CGMM\r"));//獲取手機型號
				response = Encoding.ASCII.GetString(ss_port.Read(128));
				if(response.Length > 0)
				{
					ConnectState.Text =ConnectState.Text+ " " + response.Substring(10,5) + "  連接中......";
					Connected = true;
				}
				else
				{
					ConnectState.Text = "與手機連接不成功";
					Connected = false;
				}
				ss_port.Write(Encoding.ASCII.GetBytes("AT+CSCA?\r"));//獲取手機短信中心號
                response = Encoding.ASCII.GetString(ss_port.Read(128));
				if(response.Length > 0)
				{
					CenterNumber.Text = response.Substring(20,13);
					Connected = true;
				}
				else
				{
					Connected = false;
				}
				if (Connected == true)
				{
					btnConnect.Enabled = false;
					btnSend.Enabled = true;
				}
				else
				{
					btnConnect.Enabled = true;
					btnSend.Enabled = false;
				}
			}
		}

		/// <summary>
		/// 發(fā)送短信
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void btnSend_Click(object sender, System.EventArgs e)
		{
			string decodedSMS = sms.smsDecodedsms(CenterNumber.Text,targetNumber.Text,smsContent.Text);
			byte[] buf =Encoding.ASCII.GetBytes(String.Format("AT+CMGS={0}\r",sms.nLength));
			ss_port.Write(buf);
			string response = Encoding.ASCII.GetString(ss_port.Read(128));
			string SendState = "";
			if( response.Length > 0 && response.EndsWith("> "))
			{
				ss_port.Write(Encoding.ASCII.GetBytes(String.Format("{0}\x01a",decodedSMS)));
				SendState = "發(fā)送成功!";
			}
			else
			{
				SendState = "發(fā)送失敗";
			}

			string Result = String.Format("{0},{1},{2}。\n\r",targetNumber.Text,smsContent.Text,SendState);
			smsState.Text += Result;
		}

		/// <summary>
		/// 關閉串口,退出程序
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void btnExit_Click(object sender, System.EventArgs e)
		{
			ss_port.Close();
			Application.Exit();
		}

		private void about_Click(object sender, System.EventArgs e)
		{
			Form about = new about();
			about.ShowDialog();
		}
	}
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91精品国产91久久久久久最新毛片| 最新热久久免费视频| 亚洲天堂福利av| 久久国产日韩欧美精品| 91欧美一区二区| 国产日本欧美一区二区| 免费观看日韩av| 欧美在线免费视屏| 国产精品视频一二三| 久久精品国产免费| 欧美男生操女生| 亚洲自拍偷拍综合| 91在线一区二区| 国产日韩精品一区二区浪潮av| 丝袜美腿一区二区三区| 欧美在线免费观看亚洲| 亚洲丝袜制服诱惑| jlzzjlzz国产精品久久| 中国色在线观看另类| 国产精品996| 国产亚洲午夜高清国产拍精品| 美女网站一区二区| 日韩三级在线免费观看| 奇米色一区二区| 欧美一区二区黄色| 免费在线观看一区二区三区| 91精品福利在线一区二区三区 | 97se亚洲国产综合自在线观| 久久久亚洲精品石原莉奈| 国模少妇一区二区三区| 精品福利二区三区| 国产成人午夜精品5599| 国产视频在线观看一区二区三区 | 91麻豆高清视频| 综合久久给合久久狠狠狠97色| 99精品欧美一区二区蜜桃免费 | av在线不卡免费看| 最新欧美精品一区二区三区| 97精品久久久久中文字幕 | 97久久超碰国产精品| 亚洲欧美日韩在线不卡| 欧美午夜精品久久久| 亚洲国产综合视频在线观看| 欧美猛男超大videosgay| 美国欧美日韩国产在线播放| 精品久久久影院| 激情文学综合丁香| 中文字幕中文在线不卡住| 91蜜桃传媒精品久久久一区二区| 亚洲免费观看高清| 欧美一区二区三区精品| 九色porny丨国产精品| 中文乱码免费一区二区| 在线视频欧美精品| 久久精品国产精品亚洲精品| 中文字幕av一区二区三区免费看 | 国产伦精品一区二区三区视频青涩| 久久久激情视频| 色拍拍在线精品视频8848| 亚洲一区二区av在线| 精品国产欧美一区二区| av电影天堂一区二区在线| 亚洲成a人片在线不卡一二三区| 欧美一级片在线观看| 粉嫩aⅴ一区二区三区四区| 亚洲一区二区三区在线看| 精品久久久三级丝袜| 色欧美片视频在线观看| 国产一区二区在线观看视频| 亚洲欧美日韩成人高清在线一区| 337p亚洲精品色噜噜噜| av电影天堂一区二区在线观看| 日韩福利视频导航| 亚洲丝袜美腿综合| 久久久影视传媒| 欧美片网站yy| 色综合天天综合狠狠| 精品一区二区三区免费| 一区av在线播放| xf在线a精品一区二区视频网站| 色8久久人人97超碰香蕉987| 国产一区二区三区观看| 婷婷六月综合亚洲| 日韩美女视频19| 久久日韩精品一区二区五区| 欧美人动与zoxxxx乱| 92精品国产成人观看免费| 国产成人一区在线| 蜜臀av性久久久久蜜臀aⅴ四虎 | 久久 天天综合| 亚洲国产欧美在线| 亚洲婷婷综合久久一本伊一区| 2020国产精品自拍| 欧美大片一区二区| 91精品一区二区三区久久久久久 | 99re6这里只有精品视频在线观看| 久久99久久精品| 青青草一区二区三区| 亚洲第一福利视频在线| 亚洲精品日日夜夜| 亚洲天堂免费看| 亚洲天堂久久久久久久| 国产精品美女久久久久久久久久久| 26uuu精品一区二区| 精品国产自在久精品国产| 日韩欧美一卡二卡| 日韩欧美国产小视频| 欧美va天堂va视频va在线| 欧美一级二级三级蜜桃| 337p亚洲精品色噜噜噜| 欧美一区二区在线不卡| 制服丝袜国产精品| 91精品午夜视频| 精品国产青草久久久久福利| 久久综合色天天久久综合图片| 精品国产三级a在线观看| 2022国产精品视频| 国产欧美va欧美不卡在线| 中文字幕精品三区| 亚洲三级理论片| 一区二区三区在线免费| 亚洲二区在线观看| 天堂va蜜桃一区二区三区| 久久国产精品免费| 国产91对白在线观看九色| 成人美女视频在线观看18| 91在线观看地址| 欧美日韩激情在线| 欧美一区二区三区白人| 精品国产91乱码一区二区三区| 久久久精品黄色| 亚洲蜜臀av乱码久久精品 | 国产麻豆一精品一av一免费| 国产成人精品免费| 97久久精品人人澡人人爽| 欧美专区在线观看一区| 日韩三级av在线播放| 国产欧美日韩另类一区| 最新高清无码专区| 日一区二区三区| 国产成人在线网站| 欧美在线看片a免费观看| 日韩一二三区视频| 中文字幕va一区二区三区| 亚洲大片在线观看| 国产盗摄女厕一区二区三区| 色噜噜狠狠色综合欧洲selulu| 制服丝袜一区二区三区| 国产精品久久久久久久久久免费看 | 日韩欧美一级二级三级| 国产免费成人在线视频| 一区二区三区四区激情| 精品一区二区三区免费毛片爱| 成人免费黄色在线| 91精品视频网| 国产精品久久久爽爽爽麻豆色哟哟 | 在线综合亚洲欧美在线视频| 国产欧美日韩亚州综合| 日韩在线观看一区二区| 成人免费毛片app| 日韩一级视频免费观看在线| 国产精品福利一区| 国产一区欧美一区| 欧美日韩午夜影院| 中文字幕av资源一区| 久久精品国产久精国产| 欧美日韩在线三级| 中文字幕在线不卡| 国产米奇在线777精品观看| 欧美精品一二三四| 亚洲码国产岛国毛片在线| 国产综合久久久久影院| 91精品国产综合久久蜜臀| 亚洲精选视频免费看| 成人毛片在线观看| 久久久亚洲精品石原莉奈| 日本视频中文字幕一区二区三区| 91网站在线观看视频| 欧美国产丝袜视频| 精品在线一区二区三区| 在线播放/欧美激情| 亚洲综合在线视频| 91蝌蚪porny九色| 国产精品不卡视频| 成人免费毛片高清视频| 国产欧美在线观看一区| 激情av综合网| 精品欧美久久久| 蜜桃免费网站一区二区三区| 制服丝袜日韩国产| 免费成人在线播放| 欧美一三区三区四区免费在线看 | 国产电影一区二区三区| 久久亚洲私人国产精品va媚药| 美女久久久精品| 日韩精品中文字幕在线一区| 青娱乐精品视频在线| 日韩一级黄色大片| 激情伊人五月天久久综合| 精品福利一区二区三区|