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

📄 sms.cs

📁 串口发送短信
💻 CS
📖 第 1 页 / 共 2 页
字号:


namespace SMSTest
{
	#region 命名空间
	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 SMS.CommBase;
	using SMS.PDUEncoder;

	#endregion

	

	/// <summary>
	/// SMS 的摘要说明。
	/// </summary>
	public class FormSMS : System.Windows.Forms.Form
	{
		#region 私有成员

		private System.Windows.Forms.Label lblName;
		private System.Windows.Forms.Label lblPhone;
		private System.Windows.Forms.Label label3;
		private System.Windows.Forms.Label label4;
		private System.Windows.Forms.Label lblMessage;
		private System.Windows.Forms.GroupBox groupBox1;
		private System.Windows.Forms.Button btnAdd;
		private System.Windows.Forms.GroupBox groupBox2;
		private System.Windows.Forms.Button btnCancel;
		private System.Windows.Forms.TextBox txtName;
		private System.Windows.Forms.TextBox txtPhone;
		private System.Windows.Forms.TextBox textBoxName;
		private System.Windows.Forms.Button btnQuery;
		private System.Windows.Forms.TextBox textBoxPhone;
		private System.Windows.Forms.TextBox txtMessage;
		private System.Windows.Forms.Button btnSend;
		private System.Windows.Forms.Button btnCan;
		private SMSTest.CustomerDataSet customerData;

		private SMSTest.Business business;
		private System.Windows.Forms.Button btnClear;
		

		private System.Windows.Forms.Label lblCenter;
		private System.Windows.Forms.TextBox txtCenter;
		private System.Windows.Forms.Button btnOpen;
		private System.Windows.Forms.Button btnClose;
		private System.Windows.Forms.Button btnExit;
		private System.Windows.Forms.Button button1;
		private System.Windows.Forms.Label lblState;


		static SMS.CommBase.CommPort myComm;
		private SMS.PDUEncoder.PDUEncoder encoder;
		#endregion
		private System.Windows.Forms.TextBox txtState;


		/// <summary>
		/// 必需的设计器变量。
		/// </summary>
		private System.ComponentModel.Container components = null;

		public FormSMS()
		{
			//
			// Windows 窗体设计器支持所必需的
			//
			InitializeComponent();

			business = new Business();

			myComm = new CommPort();
			this.encoder = new PDUEncoder();

		}

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

		#region Windows 窗体设计器生成的代码
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{
			this.lblName = new System.Windows.Forms.Label();
			this.lblPhone = new System.Windows.Forms.Label();
			this.label3 = new System.Windows.Forms.Label();
			this.label4 = new System.Windows.Forms.Label();
			this.lblMessage = new System.Windows.Forms.Label();
			this.groupBox1 = new System.Windows.Forms.GroupBox();
			this.txtPhone = new System.Windows.Forms.TextBox();
			this.txtName = new System.Windows.Forms.TextBox();
			this.btnCancel = new System.Windows.Forms.Button();
			this.btnAdd = new System.Windows.Forms.Button();
			this.groupBox2 = new System.Windows.Forms.GroupBox();
			this.btnClear = new System.Windows.Forms.Button();
			this.textBoxPhone = new System.Windows.Forms.TextBox();
			this.btnQuery = new System.Windows.Forms.Button();
			this.textBoxName = new System.Windows.Forms.TextBox();
			this.txtMessage = new System.Windows.Forms.TextBox();
			this.btnSend = new System.Windows.Forms.Button();
			this.btnCan = new System.Windows.Forms.Button();
			this.customerData = new SMSTest.CustomerDataSet();
			this.lblCenter = new System.Windows.Forms.Label();
			this.txtCenter = new System.Windows.Forms.TextBox();
			this.btnOpen = new System.Windows.Forms.Button();
			this.btnClose = new System.Windows.Forms.Button();
			this.btnExit = new System.Windows.Forms.Button();
			this.button1 = new System.Windows.Forms.Button();
			this.lblState = new System.Windows.Forms.Label();
			this.txtState = new System.Windows.Forms.TextBox();
			this.groupBox1.SuspendLayout();
			this.groupBox2.SuspendLayout();
			((System.ComponentModel.ISupportInitialize)(this.customerData)).BeginInit();
			this.SuspendLayout();
			// 
			// lblName
			// 
			this.lblName.Location = new System.Drawing.Point(8, 24);
			this.lblName.Name = "lblName";
			this.lblName.Size = new System.Drawing.Size(64, 24);
			this.lblName.TabIndex = 0;
			this.lblName.Text = "姓名:";
			// 
			// lblPhone
			// 
			this.lblPhone.Location = new System.Drawing.Point(8, 72);
			this.lblPhone.Name = "lblPhone";
			this.lblPhone.Size = new System.Drawing.Size(64, 24);
			this.lblPhone.TabIndex = 1;
			this.lblPhone.Text = "手机:";
			// 
			// label3
			// 
			this.label3.Location = new System.Drawing.Point(16, 24);
			this.label3.Name = "label3";
			this.label3.Size = new System.Drawing.Size(56, 24);
			this.label3.TabIndex = 2;
			this.label3.Text = "姓名:";
			// 
			// label4
			// 
			this.label4.Location = new System.Drawing.Point(16, 72);
			this.label4.Name = "label4";
			this.label4.Size = new System.Drawing.Size(48, 24);
			this.label4.TabIndex = 3;
			this.label4.Text = "手机:";
			// 
			// lblMessage
			// 
			this.lblMessage.Location = new System.Drawing.Point(16, 208);
			this.lblMessage.Name = "lblMessage";
			this.lblMessage.Size = new System.Drawing.Size(88, 24);
			this.lblMessage.TabIndex = 4;
			this.lblMessage.Text = "发送信息:";
			// 
			// groupBox1
			// 
			this.groupBox1.Controls.Add(this.txtPhone);
			this.groupBox1.Controls.Add(this.txtName);
			this.groupBox1.Controls.Add(this.btnCancel);
			this.groupBox1.Controls.Add(this.btnAdd);
			this.groupBox1.Controls.Add(this.lblName);
			this.groupBox1.Controls.Add(this.lblPhone);
			this.groupBox1.Location = new System.Drawing.Point(16, 24);
			this.groupBox1.Name = "groupBox1";
			this.groupBox1.Size = new System.Drawing.Size(216, 168);
			this.groupBox1.TabIndex = 5;
			this.groupBox1.TabStop = false;
			this.groupBox1.Text = "添加";
			// 
			// txtPhone
			// 
			this.txtPhone.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
			this.txtPhone.Location = new System.Drawing.Point(72, 72);
			this.txtPhone.MaxLength = 20;
			this.txtPhone.Name = "txtPhone";
			this.txtPhone.Size = new System.Drawing.Size(120, 21);
			this.txtPhone.TabIndex = 5;
			this.txtPhone.Text = "";
			// 
			// txtName
			// 
			this.txtName.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
			this.txtName.Location = new System.Drawing.Point(72, 24);
			this.txtName.Name = "txtName";
			this.txtName.Size = new System.Drawing.Size(120, 21);
			this.txtName.TabIndex = 4;
			this.txtName.Text = "";
			// 
			// btnCancel
			// 
			this.btnCancel.Location = new System.Drawing.Point(120, 120);
			this.btnCancel.Name = "btnCancel";
			this.btnCancel.Size = new System.Drawing.Size(48, 32);
			this.btnCancel.TabIndex = 3;
			this.btnCancel.Text = "重置";
			this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
			// 
			// btnAdd
			// 
			this.btnAdd.Location = new System.Drawing.Point(32, 120);
			this.btnAdd.Name = "btnAdd";
			this.btnAdd.Size = new System.Drawing.Size(56, 32);
			this.btnAdd.TabIndex = 2;
			this.btnAdd.Text = "添加";
			this.btnAdd.Click += new System.EventHandler(this.btnAdd_Click);
			// 
			// groupBox2
			// 
			this.groupBox2.Controls.Add(this.btnClear);
			this.groupBox2.Controls.Add(this.textBoxPhone);
			this.groupBox2.Controls.Add(this.btnQuery);
			this.groupBox2.Controls.Add(this.textBoxName);
			this.groupBox2.Controls.Add(this.label3);
			this.groupBox2.Controls.Add(this.label4);
			this.groupBox2.Location = new System.Drawing.Point(264, 24);
			this.groupBox2.Name = "groupBox2";
			this.groupBox2.Size = new System.Drawing.Size(272, 112);
			this.groupBox2.TabIndex = 6;
			this.groupBox2.TabStop = false;
			this.groupBox2.Text = "按姓名查询";
			// 
			// btnClear
			// 
			this.btnClear.Location = new System.Drawing.Point(208, 72);
			this.btnClear.Name = "btnClear";
			this.btnClear.Size = new System.Drawing.Size(48, 23);
			this.btnClear.TabIndex = 7;
			this.btnClear.Text = "重置";
			this.btnClear.Click += new System.EventHandler(this.btnClear_Click);
			// 
			// textBoxPhone
			// 
			this.textBoxPhone.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
			this.textBoxPhone.Location = new System.Drawing.Point(72, 72);
			this.textBoxPhone.Name = "textBoxPhone";
			this.textBoxPhone.Size = new System.Drawing.Size(120, 21);
			this.textBoxPhone.TabIndex = 6;
			this.textBoxPhone.Text = "13813299494";
			// 
			// btnQuery
			// 
			this.btnQuery.Location = new System.Drawing.Point(208, 24);
			this.btnQuery.Name = "btnQuery";
			this.btnQuery.Size = new System.Drawing.Size(48, 24);
			this.btnQuery.TabIndex = 2;
			this.btnQuery.Text = "查询";
			this.btnQuery.Click += new System.EventHandler(this.btnQuery_Click);
			// 
			// textBoxName
			// 
			this.textBoxName.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
			this.textBoxName.Location = new System.Drawing.Point(72, 24);
			this.textBoxName.Name = "textBoxName";
			this.textBoxName.Size = new System.Drawing.Size(120, 21);
			this.textBoxName.TabIndex = 1;
			this.textBoxName.Text = "";
			// 
			// txtMessage
			// 
			this.txtMessage.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
			this.txtMessage.Location = new System.Drawing.Point(120, 208);
			this.txtMessage.MaxLength = 160;
			this.txtMessage.Multiline = true;
			this.txtMessage.Name = "txtMessage";
			this.txtMessage.Size = new System.Drawing.Size(416, 56);
			this.txtMessage.TabIndex = 7;
			this.txtMessage.Text = "";
			// 
			// btnSend
			// 
			this.btnSend.Location = new System.Drawing.Point(248, 288);
			this.btnSend.Name = "btnSend";
			this.btnSend.Size = new System.Drawing.Size(64, 24);
			this.btnSend.TabIndex = 8;
			this.btnSend.Text = "发送";
			this.btnSend.Click += new System.EventHandler(this.btnSend_Click);
			// 
			// btnCan
			// 
			this.btnCan.Location = new System.Drawing.Point(352, 288);
			this.btnCan.Name = "btnCan";
			this.btnCan.Size = new System.Drawing.Size(64, 24);
			this.btnCan.TabIndex = 9;
			this.btnCan.Text = "读取";
			this.btnCan.Click += new System.EventHandler(this.btnCan_Click);
			// 
			// customerData
			// 
			this.customerData.DataSetName = "CustomerDataSet";
			this.customerData.Locale = new System.Globalization.CultureInfo("zh-CN");
			// 
			// lblCenter
			// 
			this.lblCenter.Location = new System.Drawing.Point(264, 160);
			this.lblCenter.Name = "lblCenter";
			this.lblCenter.Size = new System.Drawing.Size(104, 16);
			this.lblCenter.TabIndex = 10;
			this.lblCenter.Text = "短信中心号码:";
			// 
			// txtCenter
			// 
			this.txtCenter.Location = new System.Drawing.Point(368, 156);
			this.txtCenter.Name = "txtCenter";
			this.txtCenter.Size = new System.Drawing.Size(168, 21);
			this.txtCenter.TabIndex = 11;
			this.txtCenter.Text = "8613800516500";
			// 
			// btnOpen
			// 
			this.btnOpen.Location = new System.Drawing.Point(40, 288);
			this.btnOpen.Name = "btnOpen";
			this.btnOpen.Size = new System.Drawing.Size(64, 24);
			this.btnOpen.TabIndex = 12;
			this.btnOpen.Text = "连接";
			this.btnOpen.Click += new System.EventHandler(this.btnOpen_Click);
			// 
			// btnClose
			// 
			this.btnClose.Location = new System.Drawing.Point(144, 288);
			this.btnClose.Name = "btnClose";
			this.btnClose.Size = new System.Drawing.Size(64, 24);
			this.btnClose.TabIndex = 13;
			this.btnClose.Text = "关闭端口";
			this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
			// 
			// btnExit
			// 
			this.btnExit.Location = new System.Drawing.Point(456, 288);
			this.btnExit.Name = "btnExit";
			this.btnExit.Size = new System.Drawing.Size(64, 24);
			this.btnExit.TabIndex = 14;
			this.btnExit.Text = "退出";
			this.btnExit.Click += new System.EventHandler(this.btnExit_Click);
			// 
			// button1
			// 
			this.button1.Location = new System.Drawing.Point(40, 248);
			this.button1.Name = "button1";
			this.button1.Size = new System.Drawing.Size(64, 24);
			this.button1.TabIndex = 15;
			this.button1.Text = "测试";

⌨️ 快捷键说明

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