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

📄 form1.cs

📁 报刊广告管理系统。CSharp编写
💻 CS
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace WWAM.Tool
{
	/// <summary>
	/// Form1 的摘要说明。
	/// </summary>
	public class Form1 : System.Windows.Forms.Form
	{
		#region form
		private System.Windows.Forms.TabControl tabControl1;
		private System.Windows.Forms.TabPage tabPage1;
		private System.Windows.Forms.TabPage tabPage2;
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.Label label2;
		private System.Windows.Forms.Label label3;
		private System.Windows.Forms.TextBox txtMD5Soucre;
		private System.Windows.Forms.TextBox txtMD5Key;
		private System.Windows.Forms.TextBox txtMD5String;
		private System.Windows.Forms.Button btnMD5Encode;
		private System.Windows.Forms.TextBox txtMachineNum;
		private System.Windows.Forms.Label label4;
		private System.Windows.Forms.Label label5;
		private System.Windows.Forms.TextBox txtVerify;
		private System.Windows.Forms.Button btnGetLocalMachine;
		private System.Windows.Forms.Button btnGetLocalVerify;
		private System.Windows.Forms.Button btnCalcVerify;
		private System.Windows.Forms.Button btnRegistLocal;
		private System.Windows.Forms.Button btnCancelLocal;
		private System.Windows.Forms.Button btnCheckLocal;
		/// <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 窗体设计器生成的代码
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1));
			this.tabControl1 = new System.Windows.Forms.TabControl();
			this.tabPage1 = new System.Windows.Forms.TabPage();
			this.tabPage2 = new System.Windows.Forms.TabPage();
			this.txtMD5Soucre = new System.Windows.Forms.TextBox();
			this.label1 = new System.Windows.Forms.Label();
			this.label2 = new System.Windows.Forms.Label();
			this.label3 = new System.Windows.Forms.Label();
			this.txtMD5Key = new System.Windows.Forms.TextBox();
			this.txtMD5String = new System.Windows.Forms.TextBox();
			this.btnMD5Encode = new System.Windows.Forms.Button();
			this.txtMachineNum = new System.Windows.Forms.TextBox();
			this.label4 = new System.Windows.Forms.Label();
			this.label5 = new System.Windows.Forms.Label();
			this.txtVerify = new System.Windows.Forms.TextBox();
			this.btnGetLocalMachine = new System.Windows.Forms.Button();
			this.btnGetLocalVerify = new System.Windows.Forms.Button();
			this.btnCalcVerify = new System.Windows.Forms.Button();
			this.btnRegistLocal = new System.Windows.Forms.Button();
			this.btnCancelLocal = new System.Windows.Forms.Button();
			this.btnCheckLocal = new System.Windows.Forms.Button();
			this.tabControl1.SuspendLayout();
			this.tabPage1.SuspendLayout();
			this.tabPage2.SuspendLayout();
			this.SuspendLayout();
			// 
			// tabControl1
			// 
			this.tabControl1.Controls.Add(this.tabPage1);
			this.tabControl1.Controls.Add(this.tabPage2);
			this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
			this.tabControl1.Location = new System.Drawing.Point(0, 0);
			this.tabControl1.Name = "tabControl1";
			this.tabControl1.SelectedIndex = 0;
			this.tabControl1.Size = new System.Drawing.Size(410, 200);
			this.tabControl1.TabIndex = 0;
			// 
			// tabPage1
			// 
			this.tabPage1.Controls.Add(this.btnCheckLocal);
			this.tabPage1.Controls.Add(this.btnCancelLocal);
			this.tabPage1.Controls.Add(this.btnRegistLocal);
			this.tabPage1.Controls.Add(this.btnCalcVerify);
			this.tabPage1.Controls.Add(this.btnGetLocalVerify);
			this.tabPage1.Controls.Add(this.btnGetLocalMachine);
			this.tabPage1.Controls.Add(this.txtVerify);
			this.tabPage1.Controls.Add(this.label5);
			this.tabPage1.Controls.Add(this.label4);
			this.tabPage1.Controls.Add(this.txtMachineNum);
			this.tabPage1.Location = new System.Drawing.Point(4, 21);
			this.tabPage1.Name = "tabPage1";
			this.tabPage1.Size = new System.Drawing.Size(402, 175);
			this.tabPage1.TabIndex = 0;
			this.tabPage1.Text = "注册";
			// 
			// tabPage2
			// 
			this.tabPage2.Controls.Add(this.btnMD5Encode);
			this.tabPage2.Controls.Add(this.txtMD5String);
			this.tabPage2.Controls.Add(this.txtMD5Key);
			this.tabPage2.Controls.Add(this.label3);
			this.tabPage2.Controls.Add(this.label2);
			this.tabPage2.Controls.Add(this.label1);
			this.tabPage2.Controls.Add(this.txtMD5Soucre);
			this.tabPage2.Location = new System.Drawing.Point(4, 21);
			this.tabPage2.Name = "tabPage2";
			this.tabPage2.Size = new System.Drawing.Size(402, 175);
			this.tabPage2.TabIndex = 1;
			this.tabPage2.Text = "MD5";
			// 
			// txtMD5Soucre
			// 
			this.txtMD5Soucre.Location = new System.Drawing.Point(64, 24);
			this.txtMD5Soucre.Name = "txtMD5Soucre";
			this.txtMD5Soucre.Size = new System.Drawing.Size(144, 21);
			this.txtMD5Soucre.TabIndex = 0;
			this.txtMD5Soucre.TabStop = false;
			this.txtMD5Soucre.Text = "";
			// 
			// label1
			// 
			this.label1.Location = new System.Drawing.Point(8, 24);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(48, 23);
			this.label1.TabIndex = 1;
			this.label1.Text = "原文";
			this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
			// 
			// label2
			// 
			this.label2.Location = new System.Drawing.Point(8, 56);
			this.label2.Name = "label2";
			this.label2.Size = new System.Drawing.Size(48, 23);
			this.label2.TabIndex = 2;
			this.label2.Text = "密文";
			this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
			// 
			// label3
			// 
			this.label3.Location = new System.Drawing.Point(232, 24);
			this.label3.Name = "label3";
			this.label3.Size = new System.Drawing.Size(48, 23);
			this.label3.TabIndex = 3;
			this.label3.Text = "密匙";
			this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
			// 
			// txtMD5Key
			// 
			this.txtMD5Key.Location = new System.Drawing.Point(288, 24);
			this.txtMD5Key.Name = "txtMD5Key";
			this.txtMD5Key.Size = new System.Drawing.Size(88, 21);
			this.txtMD5Key.TabIndex = 4;
			this.txtMD5Key.TabStop = false;
			this.txtMD5Key.Text = "";
			// 
			// txtMD5String
			// 
			this.txtMD5String.Location = new System.Drawing.Point(64, 56);
			this.txtMD5String.Name = "txtMD5String";
			this.txtMD5String.ReadOnly = true;
			this.txtMD5String.Size = new System.Drawing.Size(312, 21);
			this.txtMD5String.TabIndex = 5;
			this.txtMD5String.TabStop = false;
			this.txtMD5String.Text = "";
			// 
			// btnMD5Encode
			// 
			this.btnMD5Encode.Location = new System.Drawing.Point(288, 96);
			this.btnMD5Encode.Name = "btnMD5Encode";
			this.btnMD5Encode.Size = new System.Drawing.Size(72, 24);
			this.btnMD5Encode.TabIndex = 6;
			this.btnMD5Encode.TabStop = false;
			this.btnMD5Encode.Text = "加密";
			this.btnMD5Encode.Click += new System.EventHandler(this.btnMD5Encode_Click);
			// 
			// txtMachineNum
			// 
			this.txtMachineNum.Location = new System.Drawing.Point(72, 16);
			this.txtMachineNum.Name = "txtMachineNum";
			this.txtMachineNum.Size = new System.Drawing.Size(296, 21);
			this.txtMachineNum.TabIndex = 0;
			this.txtMachineNum.TabStop = false;
			this.txtMachineNum.Text = "";
			// 
			// label4
			// 
			this.label4.Location = new System.Drawing.Point(16, 16);
			this.label4.Name = "label4";
			this.label4.Size = new System.Drawing.Size(56, 23);
			this.label4.TabIndex = 1;
			this.label4.Text = "机器码:";
			this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
			// 
			// label5
			// 
			this.label5.Location = new System.Drawing.Point(16, 48);
			this.label5.Name = "label5";
			this.label5.Size = new System.Drawing.Size(56, 23);
			this.label5.TabIndex = 2;
			this.label5.Text = "注册码:";
			this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
			// 
			// txtVerify
			// 
			this.txtVerify.Location = new System.Drawing.Point(72, 48);
			this.txtVerify.Name = "txtVerify";
			this.txtVerify.ReadOnly = true;
			this.txtVerify.Size = new System.Drawing.Size(296, 21);
			this.txtVerify.TabIndex = 3;
			this.txtVerify.TabStop = false;
			this.txtVerify.Text = "";
			// 
			// btnGetLocalMachine
			// 
			this.btnGetLocalMachine.Location = new System.Drawing.Point(16, 112);
			this.btnGetLocalMachine.Name = "btnGetLocalMachine";
			this.btnGetLocalMachine.Size = new System.Drawing.Size(96, 24);
			this.btnGetLocalMachine.TabIndex = 4;
			this.btnGetLocalMachine.TabStop = false;
			this.btnGetLocalMachine.Text = "本机机器码";
			this.btnGetLocalMachine.Click += new System.EventHandler(this.btnGetLocalMachine_Click);
			// 
			// btnGetLocalVerify
			// 
			this.btnGetLocalVerify.Location = new System.Drawing.Point(16, 144);
			this.btnGetLocalVerify.Name = "btnGetLocalVerify";
			this.btnGetLocalVerify.Size = new System.Drawing.Size(96, 24);
			this.btnGetLocalVerify.TabIndex = 5;
			this.btnGetLocalVerify.TabStop = false;
			this.btnGetLocalVerify.Text = "本机注册码";
			this.btnGetLocalVerify.Click += new System.EventHandler(this.btnGetLocalVerify_Click);
			// 
			// btnCalcVerify
			// 
			this.btnCalcVerify.Location = new System.Drawing.Point(144, 80);
			this.btnCalcVerify.Name = "btnCalcVerify";
			this.btnCalcVerify.Size = new System.Drawing.Size(96, 24);
			this.btnCalcVerify.TabIndex = 6;
			this.btnCalcVerify.TabStop = false;
			this.btnCalcVerify.Text = "计算注册码";
			this.btnCalcVerify.Click += new System.EventHandler(this.btnCalcVerify_Click);
			// 
			// btnRegistLocal
			// 
			this.btnRegistLocal.Location = new System.Drawing.Point(272, 80);
			this.btnRegistLocal.Name = "btnRegistLocal";
			this.btnRegistLocal.Size = new System.Drawing.Size(96, 24);
			this.btnRegistLocal.TabIndex = 7;
			this.btnRegistLocal.TabStop = false;
			this.btnRegistLocal.Text = "给本机注册";
			this.btnRegistLocal.Click += new System.EventHandler(this.btnRegistLocal_Click);
			// 
			// btnCancelLocal
			// 
			this.btnCancelLocal.Location = new System.Drawing.Point(272, 112);
			this.btnCancelLocal.Name = "btnCancelLocal";
			this.btnCancelLocal.Size = new System.Drawing.Size(96, 24);
			this.btnCancelLocal.TabIndex = 8;
			this.btnCancelLocal.TabStop = false;
			this.btnCancelLocal.Text = "取消本机注册";
			this.btnCancelLocal.Click += new System.EventHandler(this.btnCancelLocal_Click);
			// 
			// btnCheckLocal
			// 
			this.btnCheckLocal.Location = new System.Drawing.Point(272, 144);
			this.btnCheckLocal.Name = "btnCheckLocal";
			this.btnCheckLocal.Size = new System.Drawing.Size(96, 24);
			this.btnCheckLocal.TabIndex = 9;
			this.btnCheckLocal.TabStop = false;
			this.btnCheckLocal.Text = "验证本机注册";
			this.btnCheckLocal.Click += new System.EventHandler(this.btnCheckLocal_Click);
			// 
			// Form1
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(410, 200);
			this.Controls.Add(this.tabControl1);
			this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
			this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
			this.MaximizeBox = false;
			this.Name = "Form1";
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
			this.Text = "注册机";
			this.tabControl1.ResumeLayout(false);
			this.tabPage1.ResumeLayout(false);
			this.tabPage2.ResumeLayout(false);
			this.ResumeLayout(false);

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

		#region MD5

		private void btnMD5Encode_Click(object sender, System.EventArgs e)
		{
			this.txtMD5String.Text = WWAM.MD5.MDString(this.txtMD5Key.Text.Trim()+this.txtMD5Soucre.Text.Trim());
		}
		#endregion

		#region Verify
		private void btnCalcVerify_Click(object sender, System.EventArgs e)
		{
			this.txtVerify.Text = WWAM.BLL.Verify.GetVerify(this.txtMachineNum.Text.Trim());
		}

		private void btnGetLocalMachine_Click(object sender, System.EventArgs e)
		{
			this.txtMachineNum.Text = WWAM.BLL.Verify.GetMachineNum();
		}

		private void btnGetLocalVerify_Click(object sender, System.EventArgs e)
		{
			this.txtVerify.Text = WWAM.BLL.Verify.GetLocalVerify();
		}

		private void btnRegistLocal_Click(object sender, System.EventArgs e)
		{
			WWAM.BLL.Verify.SetLocalVerify(WWAM.BLL.Verify.GetLocalVerify());
			MessageBox.Show("完成!");
		}

		private void btnCancelLocal_Click(object sender, System.EventArgs e)
		{
			WWAM.BLL.Verify.SetLocalVerify("");
			MessageBox.Show("完成!");
		}

		private void btnCheckLocal_Click(object sender, System.EventArgs e)
		{
			if(WWAM.BLL.Verify.CheckLocalVerify())
			{
				MessageBox.Show("已注册!");
			}
			else
			{
				MessageBox.Show("未注册!");
			}
		}
		#endregion
	}
}

⌨️ 快捷键说明

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