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

📄 demomain.cs

📁 网络通信 数据存取 源码 增加分类 压缩文件有密码
💻 CS
📖 第 1 页 / 共 2 页
字号:
using System;
using System.IO;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using ImApiDotNet;

namespace NetDemo
{
	/// <summary>
	/// Form1 的摘要说明。
	/// </summary>
	public class FrmDemo : System.Windows.Forms.Form
	{
		private ImApiDotNet.APIClient apiclient;
		private System.Windows.Forms.TextBox textUrl;
		private System.Windows.Forms.Button btnExit;
		private System.Windows.Forms.Button btnRecvRpt;
		private System.Windows.Forms.Button btnRecvSM;
		private System.Windows.Forms.Button btnSend;
		private System.Windows.Forms.Button btnRelease;
		private System.Windows.Forms.Button btnInit;
		private System.Windows.Forms.TextBox textPassword;
		private System.Windows.Forms.Label lblPws;
		private System.Windows.Forms.TextBox textUsername;
		private System.Windows.Forms.Label lblUser;
		private System.Windows.Forms.TextBox textCode;
		private System.Windows.Forms.Label lblCode;
		private System.Windows.Forms.TextBox textIp;
		private System.Windows.Forms.Label lblIP;
		private System.Windows.Forms.TextBox textSmId;
		private System.Windows.Forms.Label lblSMID;
		private System.Windows.Forms.TextBox textContext;
		private System.Windows.Forms.Label lblContent;
		private System.Windows.Forms.TextBox textMobile;
		private System.Windows.Forms.Label lblMobile;
		private String[] retunvalues=new String[]{"初始化成功","连接数据库出错","数据库关闭失败","数据库插入错误","数据库删除错误","数据库查询错误","参数错误","API标识非法","消息内容太长","没有初始化或初始化失败","API接口处于暂停(失效)状态","短信网关未连接"};
		private String[] initvalues = new String[]{"成功","连接失败","用户名或密码错误","密码错误","接口编码不存在"};
		private System.Windows.Forms.GroupBox dbConGroup;
		private System.Windows.Forms.Label lblSmType;
		private System.Windows.Forms.RadioButton rbnNormal;
		private System.Windows.Forms.RadioButton rbnWap;
		private System.Windows.Forms.Label lblUrl;
		private System.Windows.Forms.Label lblphoneID;
		private System.Windows.Forms.Label labelTime;
		private System.Windows.Forms.TextBox txtSMTime;
		private System.Windows.Forms.Label lbSMTime;
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.Label lbDemo;
		private System.Windows.Forms.TextBox txtDB;
		private System.Windows.Forms.TextBox txtSrcID;

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

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

			//
			// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
			//
		}

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



		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{
			this.textUrl = new System.Windows.Forms.TextBox();
			this.btnExit = new System.Windows.Forms.Button();
			this.btnRecvRpt = new System.Windows.Forms.Button();
			this.btnRecvSM = new System.Windows.Forms.Button();
			this.btnSend = new System.Windows.Forms.Button();
			this.btnRelease = new System.Windows.Forms.Button();
			this.btnInit = new System.Windows.Forms.Button();
			this.dbConGroup = new System.Windows.Forms.GroupBox();
			this.txtDB = new System.Windows.Forms.TextBox();
			this.label1 = new System.Windows.Forms.Label();
			this.textPassword = new System.Windows.Forms.TextBox();
			this.lblPws = new System.Windows.Forms.Label();
			this.textUsername = new System.Windows.Forms.TextBox();
			this.lblUser = new System.Windows.Forms.Label();
			this.textCode = new System.Windows.Forms.TextBox();
			this.lblCode = new System.Windows.Forms.Label();
			this.textIp = new System.Windows.Forms.TextBox();
			this.lblIP = new System.Windows.Forms.Label();
			this.textSmId = new System.Windows.Forms.TextBox();
			this.lblSMID = new System.Windows.Forms.Label();
			this.textContext = new System.Windows.Forms.TextBox();
			this.lblContent = new System.Windows.Forms.Label();
			this.textMobile = new System.Windows.Forms.TextBox();
			this.lblMobile = new System.Windows.Forms.Label();
			this.lblSmType = new System.Windows.Forms.Label();
			this.rbnNormal = new System.Windows.Forms.RadioButton();
			this.rbnWap = new System.Windows.Forms.RadioButton();
			this.lblUrl = new System.Windows.Forms.Label();
			this.lblphoneID = new System.Windows.Forms.Label();
			this.txtSrcID = new System.Windows.Forms.TextBox();
			this.labelTime = new System.Windows.Forms.Label();
			this.txtSMTime = new System.Windows.Forms.TextBox();
			this.lbSMTime = new System.Windows.Forms.Label();
			this.lbDemo = new System.Windows.Forms.Label();
			this.dbConGroup.SuspendLayout();
			this.SuspendLayout();
			// 
			// textUrl
			// 
			this.textUrl.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
			this.textUrl.Enabled = false;
			this.textUrl.Location = new System.Drawing.Point(192, 264);
			this.textUrl.Name = "textUrl";
			this.textUrl.Size = new System.Drawing.Size(336, 21);
			this.textUrl.TabIndex = 31;
			this.textUrl.Text = "";
			// 
			// btnExit
			// 
			this.btnExit.Location = new System.Drawing.Point(456, 440);
			this.btnExit.Name = "btnExit";
			this.btnExit.Size = new System.Drawing.Size(72, 24);
			this.btnExit.TabIndex = 29;
			this.btnExit.Text = "exit";
			this.btnExit.Click += new System.EventHandler(this.btnExit_Click);
			// 
			// btnRecvRpt
			// 
			this.btnRecvRpt.Location = new System.Drawing.Point(360, 440);
			this.btnRecvRpt.Name = "btnRecvRpt";
			this.btnRecvRpt.Size = new System.Drawing.Size(80, 24);
			this.btnRecvRpt.TabIndex = 28;
			this.btnRecvRpt.Text = "receiveRPT";
			this.btnRecvRpt.Click += new System.EventHandler(this.btnRecvRpt_Click);
			// 
			// btnRecvSM
			// 
			this.btnRecvSM.Location = new System.Drawing.Point(272, 440);
			this.btnRecvSM.Name = "btnRecvSM";
			this.btnRecvSM.Size = new System.Drawing.Size(72, 24);
			this.btnRecvSM.TabIndex = 27;
			this.btnRecvSM.Text = "receiveSM";
			this.btnRecvSM.Click += new System.EventHandler(this.btnRecvSM_Click);
			// 
			// btnSend
			// 
			this.btnSend.Location = new System.Drawing.Point(192, 440);
			this.btnSend.Name = "btnSend";
			this.btnSend.Size = new System.Drawing.Size(64, 24);
			this.btnSend.TabIndex = 26;
			this.btnSend.Text = "send";
			this.btnSend.Click += new System.EventHandler(this.btnSend_Click);
			// 
			// btnRelease
			// 
			this.btnRelease.Location = new System.Drawing.Point(112, 440);
			this.btnRelease.Name = "btnRelease";
			this.btnRelease.Size = new System.Drawing.Size(64, 24);
			this.btnRelease.TabIndex = 25;
			this.btnRelease.Text = "release";
			this.btnRelease.Click += new System.EventHandler(this.btnRelease_Click);
			// 
			// btnInit
			// 
			this.btnInit.Location = new System.Drawing.Point(32, 440);
			this.btnInit.Name = "btnInit";
			this.btnInit.Size = new System.Drawing.Size(64, 24);
			this.btnInit.TabIndex = 24;
			this.btnInit.Text = "init";
			this.btnInit.Click += new System.EventHandler(this.btnInit_Click);
			// 
			// dbConGroup
			// 
			this.dbConGroup.Controls.AddRange(new System.Windows.Forms.Control[] {
																					 this.txtDB,
																					 this.label1,
																					 this.textPassword,
																					 this.lblPws,
																					 this.textUsername,
																					 this.lblUser,
																					 this.textCode,
																					 this.lblCode,
																					 this.textIp,
																					 this.lblIP});
			this.dbConGroup.Location = new System.Drawing.Point(56, 304);
			this.dbConGroup.Name = "dbConGroup";
			this.dbConGroup.Size = new System.Drawing.Size(472, 112);
			this.dbConGroup.TabIndex = 23;
			this.dbConGroup.TabStop = false;
			this.dbConGroup.Text = "数据库连接信息";
			// 
			// txtDB
			// 
			this.txtDB.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
			this.txtDB.Location = new System.Drawing.Point(88, 80);
			this.txtDB.Name = "txtDB";
			this.txtDB.Size = new System.Drawing.Size(120, 21);
			this.txtDB.TabIndex = 15;
			this.txtDB.Text = "im";
			// 
			// label1
			// 
			this.label1.Location = new System.Drawing.Point(8, 88);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(72, 16);
			this.label1.TabIndex = 14;
			this.label1.Text = "数据库名称";
			// 
			// textPassword
			// 
			this.textPassword.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
			this.textPassword.Location = new System.Drawing.Point(320, 48);
			this.textPassword.Name = "textPassword";
			this.textPassword.PasswordChar = '*';
			this.textPassword.Size = new System.Drawing.Size(128, 21);
			this.textPassword.TabIndex = 13;
			this.textPassword.Text = "dbi";
			// 
			// lblPws
			// 
			this.lblPws.Location = new System.Drawing.Point(256, 56);
			this.lblPws.Name = "lblPws";
			this.lblPws.Size = new System.Drawing.Size(40, 16);
			this.lblPws.TabIndex = 12;
			this.lblPws.Text = "密码";
			// 
			// textUsername
			// 
			this.textUsername.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
			this.textUsername.Location = new System.Drawing.Point(88, 48);
			this.textUsername.Name = "textUsername";
			this.textUsername.Size = new System.Drawing.Size(120, 21);
			this.textUsername.TabIndex = 11;
			this.textUsername.Text = "dbi";
			// 
			// lblUser
			// 
			this.lblUser.Location = new System.Drawing.Point(24, 56);
			this.lblUser.Name = "lblUser";
			this.lblUser.Size = new System.Drawing.Size(48, 16);
			this.lblUser.TabIndex = 10;
			this.lblUser.Text = "用户名";
			// 
			// textCode
			// 
			this.textCode.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
			this.textCode.Location = new System.Drawing.Point(320, 16);
			this.textCode.Name = "textCode";
			this.textCode.Size = new System.Drawing.Size(128, 21);
			this.textCode.TabIndex = 9;
			this.textCode.Text = "dbi";
			// 
			// lblCode
			// 
			this.lblCode.Location = new System.Drawing.Point(256, 24);
			this.lblCode.Name = "lblCode";
			this.lblCode.Size = new System.Drawing.Size(56, 16);
			this.lblCode.TabIndex = 8;
			this.lblCode.Text = "API编码";
			// 
			// textIp
			// 
			this.textIp.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
			this.textIp.Location = new System.Drawing.Point(88, 16);
			this.textIp.Name = "textIp";
			this.textIp.Size = new System.Drawing.Size(120, 21);
			this.textIp.TabIndex = 7;
			this.textIp.Text = "192.168.0.52";
			// 
			// lblIP
			// 
			this.lblIP.Location = new System.Drawing.Point(24, 24);
			this.lblIP.Name = "lblIP";
			this.lblIP.Size = new System.Drawing.Size(48, 16);
			this.lblIP.TabIndex = 6;
			this.lblIP.Text = "IP地址";
			// 
			// textSmId
			// 
			this.textSmId.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
			this.textSmId.Location = new System.Drawing.Point(168, 128);
			this.textSmId.Name = "textSmId";
			this.textSmId.Size = new System.Drawing.Size(80, 21);
			this.textSmId.TabIndex = 22;
			this.textSmId.Text = "10";
			// 
			// lblSMID
			// 
			this.lblSMID.Location = new System.Drawing.Point(88, 136);
			this.lblSMID.Name = "lblSMID";
			this.lblSMID.Size = new System.Drawing.Size(56, 16);
			this.lblSMID.TabIndex = 21;
			this.lblSMID.Text = "短信smID";
			// 
			// textContext
			// 
			this.textContext.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
			this.textContext.Location = new System.Drawing.Point(168, 88);
			this.textContext.Multiline = true;
			this.textContext.Name = "textContext";
			this.textContext.Size = new System.Drawing.Size(296, 32);
			this.textContext.TabIndex = 20;
			this.textContext.Text = "使用NET API发送短信!";
			// 
			// lblContent
			// 
			this.lblContent.Location = new System.Drawing.Point(88, 96);
			this.lblContent.Name = "lblContent";
			this.lblContent.Size = new System.Drawing.Size(64, 16);
			this.lblContent.TabIndex = 19;
			this.lblContent.Text = "短信内容";
			this.lblContent.Click += new System.EventHandler(this.lblContent_Click);
			// 
			// textMobile
			// 
			this.textMobile.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
			this.textMobile.Location = new System.Drawing.Point(168, 48);
			this.textMobile.Multiline = true;
			this.textMobile.Name = "textMobile";
			this.textMobile.ScrollBars = System.Windows.Forms.ScrollBars.Horizontal;
			this.textMobile.Size = new System.Drawing.Size(296, 32);
			this.textMobile.TabIndex = 18;
			this.textMobile.Text = "13588478293";
			// 
			// lblMobile
			// 
			this.lblMobile.Location = new System.Drawing.Point(72, 56);
			this.lblMobile.Name = "lblMobile";
			this.lblMobile.Size = new System.Drawing.Size(80, 16);
			this.lblMobile.TabIndex = 17;
			this.lblMobile.Text = "目的手机号码";
			// 
			// lblSmType
			// 
			this.lblSmType.Location = new System.Drawing.Point(96, 240);
			this.lblSmType.Name = "lblSmType";
			this.lblSmType.Size = new System.Drawing.Size(72, 16);
			this.lblSmType.TabIndex = 34;
			this.lblSmType.Text = "短信类型";
			// 
			// rbnNormal
			// 
			this.rbnNormal.Checked = true;
			this.rbnNormal.Location = new System.Drawing.Point(168, 232);
			this.rbnNormal.Name = "rbnNormal";
			this.rbnNormal.TabIndex = 35;
			this.rbnNormal.TabStop = true;
			this.rbnNormal.Text = "一般短信";
			this.rbnNormal.CheckedChanged += new System.EventHandler(this.rbnNormal_CheckedChanged);
			// 
			// rbnWap
			// 
			this.rbnWap.Location = new System.Drawing.Point(336, 232);
			this.rbnWap.Name = "rbnWap";
			this.rbnWap.TabIndex = 36;
			this.rbnWap.Text = "Wap Push短信";
			this.rbnWap.CheckedChanged += new System.EventHandler(this.rbnWap_CheckedChanged);
			// 
			// lblUrl
			// 
			this.lblUrl.Location = new System.Drawing.Point(64, 264);
			this.lblUrl.Name = "lblUrl";
			this.lblUrl.Size = new System.Drawing.Size(112, 16);
			this.lblUrl.TabIndex = 37;
			this.lblUrl.Text = "Wap Push短信的Url";
			// 
			// lblphoneID
			// 
			this.lblphoneID.Location = new System.Drawing.Point(24, 208);
			this.lblphoneID.Name = "lblphoneID";
			this.lblphoneID.Size = new System.Drawing.Size(128, 16);
			this.lblphoneID.TabIndex = 38;
			this.lblphoneID.Text = "手机上显示尾号srcID";
			// 
			// txtSrcID
			// 
			this.txtSrcID.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
			this.txtSrcID.Location = new System.Drawing.Point(168, 200);
			this.txtSrcID.Name = "txtSrcID";
			this.txtSrcID.Size = new System.Drawing.Size(64, 21);
			this.txtSrcID.TabIndex = 39;
			this.txtSrcID.Text = "10";
			// 
			// labelTime
			// 
			this.labelTime.Location = new System.Drawing.Point(96, 176);
			this.labelTime.Name = "labelTime";

⌨️ 快捷键说明

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