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

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

?? form1.cs

?? 使用C#發送短信
?? 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 調用后添加任何構造函數代碼
			//
		}

		/// <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 = "短信發送狀態";
			// 
			// 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 = "發送";
			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#版 ---- 天極網";
			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>
		/// 發送短信
		/// </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 = "發送成功!";
			}
			else
			{
				SendState = "發送失敗";
			}

			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一区二区三区免费野_久草精品视频
不卡视频免费播放| 亚洲视频资源在线| 国产在线精品一区二区 | a在线欧美一区| ●精品国产综合乱码久久久久| www.成人在线| 亚洲第一福利视频在线| 日韩精品专区在线影院重磅| 国产盗摄女厕一区二区三区| 亚洲同性gay激情无套| 欧美调教femdomvk| 蜜臂av日日欢夜夜爽一区| 国产三级一区二区三区| 97se狠狠狠综合亚洲狠狠| 亚洲国产精品久久久久婷婷884| 欧美伦理电影网| 国产一区二三区| 中文字幕中文字幕在线一区| 欧美日韩在线播放三区四区| 精品在线播放免费| 亚洲女女做受ⅹxx高潮| 日韩精品中午字幕| 91蜜桃传媒精品久久久一区二区| 日韩影院免费视频| 中文字幕第一区二区| 欧美日韩色一区| 国产成人综合自拍| 亚洲444eee在线观看| 久久久久亚洲综合| 欧美性欧美巨大黑白大战| 久草中文综合在线| 亚洲人午夜精品天堂一二香蕉| 欧美电视剧免费全集观看| 91丨porny丨中文| 国产毛片精品视频| 亚洲国产欧美在线人成| 欧美经典一区二区| 91精品蜜臀在线一区尤物| 成人深夜在线观看| 看片的网站亚洲| 亚洲综合丝袜美腿| 国产精品久久久久精k8 | 日韩毛片一二三区| 精品国产3级a| 8x福利精品第一导航| 丁香婷婷综合色啪| 久久99热狠狠色一区二区| 亚洲一区二区三区爽爽爽爽爽| 国产精品私人影院| 亚洲精品一区二区三区精华液| 欧美区在线观看| 日本韩国一区二区| 成人av在线电影| 国产美女在线精品| 久久精品国产精品亚洲精品| 亚洲成人av福利| 亚洲精品大片www| 亚洲婷婷综合色高清在线| 国产精品视频看| 国产午夜亚洲精品不卡| 精品日韩一区二区| 日韩欧美国产一区二区三区| 91精品久久久久久蜜臀| 欧美久久高跟鞋激| 欧美午夜影院一区| 欧美在线三级电影| 在线视频中文字幕一区二区| 99精品黄色片免费大全| 不卡的av网站| 99v久久综合狠狠综合久久| 99热在这里有精品免费| 成年人午夜久久久| 99久久国产综合精品麻豆| www.亚洲激情.com| 97久久超碰精品国产| 99国产精品99久久久久久| 色一情一伦一子一伦一区| 91老司机福利 在线| 色系网站成人免费| 91论坛在线播放| 欧美中文字幕久久| 欧美系列日韩一区| 欧美一区二区三区视频在线| 欧美一区二区三区成人| 欧美一级淫片007| 欧美xxxx老人做受| 国产三级一区二区| 成人欧美一区二区三区| 亚洲一区欧美一区| 日韩成人精品在线| 国产精品69毛片高清亚洲| 成人h动漫精品一区二区| 色女孩综合影院| 欧美久久久久久久久中文字幕| 欧美成人三级电影在线| 国产亚洲午夜高清国产拍精品| 国产精品美女一区二区| 亚洲综合清纯丝袜自拍| 狂野欧美性猛交blacked| 成人午夜看片网址| 欧美中文一区二区三区| 欧美大肚乱孕交hd孕妇| 国产精品理论在线观看| 亚洲国产sm捆绑调教视频 | 国产成人av电影在线| 色综合久久99| 欧美r级在线观看| 亚洲欧美另类在线| 麻豆精品久久精品色综合| 国产精品99久久久久久宅男| 日本丶国产丶欧美色综合| 日韩欧美一区二区久久婷婷| 国产精品嫩草久久久久| 婷婷夜色潮精品综合在线| 国产成人亚洲综合a∨婷婷| 欧美在线视频你懂得| 国产亚洲欧美日韩在线一区| 亚洲午夜在线电影| 国产高清精品在线| 欧美精品在线视频| 亚洲成人资源在线| 国产精品影视天天线| 在线亚洲人成电影网站色www| 精品久久久久av影院| 夜夜嗨av一区二区三区中文字幕| 国产自产高清不卡| 欧美婷婷六月丁香综合色| 国产精品久久影院| 久久av中文字幕片| 欧美性猛交一区二区三区精品| 国产亚洲女人久久久久毛片| www一区二区| 久久综合狠狠综合久久综合88 | 成人av免费网站| 欧美电影免费观看高清完整版在线 | 久久综合色综合88| 性久久久久久久久| 成人高清伦理免费影院在线观看| 日韩亚洲欧美一区二区三区| 一区二区久久久久| 成人国产精品免费网站| 久久天天做天天爱综合色| 午夜精品久久久久久久久| 一本色道**综合亚洲精品蜜桃冫| 久久奇米777| 久久国产综合精品| 欧美欧美欧美欧美首页| 亚洲免费观看高清完整版在线| 成人免费毛片aaaaa**| 久久精品一级爱片| 久久99久久久久久久久久久| 欧美美女一区二区| 亚洲午夜影视影院在线观看| 91久久精品一区二区二区| 国产精品久久久久一区二区三区| 国产一区二区三区美女| 精品久久久久久久久久久久久久久久久| 偷窥少妇高潮呻吟av久久免费| 欧美日韩中文另类| 亚洲图片自拍偷拍| 欧美性色aⅴ视频一区日韩精品| 亚洲男帅同性gay1069| 91麻豆国产香蕉久久精品| 亚洲日穴在线视频| 一本到不卡精品视频在线观看| 亚洲人午夜精品天堂一二香蕉| 99re这里都是精品| 一区二区三区四区高清精品免费观看| 99久久综合精品| 最新日韩av在线| 一本久久综合亚洲鲁鲁五月天| 一区二区三区四区乱视频| 色悠久久久久综合欧美99| 亚洲香肠在线观看| 91麻豆精品国产91久久久资源速度| 午夜免费久久看| 日韩欧美国产综合| 国产一区二区三区精品欧美日韩一区二区三区 | 欧洲精品在线观看| 一区二区不卡在线播放| 欧美亚洲国产一区二区三区| 午夜精品久久久久久久蜜桃app| 欧美一级免费大片| 国产一区二区三区免费播放| 亚洲欧洲av一区二区三区久久| 99国产精品久久久久| 亚洲午夜三级在线| 日韩一区二区三区电影在线观看| 国产精品亚洲а∨天堂免在线| 国产精品高潮呻吟| 欧美日韩国产综合草草| 久久精品国产久精国产爱| 中文字幕成人av| 在线视频一区二区免费| 美女视频黄 久久| 中文字幕在线不卡一区二区三区| 91国模大尺度私拍在线视频| 日韩成人伦理电影在线观看| 国产欧美日韩一区二区三区在线观看| 色婷婷久久久久swag精品|