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

📄 frmmain.cs

📁 网通网关Cngp
💻 CS
📖 第 1 页 / 共 2 页
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Text;
using System.Timers;
using WriteLog;
using System.Threading;
using Pierce.AttributeClass;
using System.Diagnostics;


namespace Cngp
{
	/// <summary>
	/// frmMain类:
	/// 2005-06-09:割接前使用	
	/// </summary>
	[LastModified("2005-11-11","增加Debug处理")]
	[LastModified("2005-11-22","CngpSendMessage:增加从数据库中取数据的长度")]
	[LastModified("2005-12-16","把Pierce.Attribute放在Gac中引用")]
	[LastModified("2005-12-20","更改发送计费信息条件,不再检测网关返回状态值")]
	[LastModified("2006-01-05","配置文件参数统一读到ConfigInformatin 类中")]
	[LastModified("2006-01-06","建立Represent Class,建立主要的逻辑处理")]
	[LastModified("2006-01-12","更改Represend类的Timer处理事件中,静态栏目调度时间,"+
		 "更改CngpProtocol类的从数据库获取数据方法,限制MT信息发送时间")]
	[LastModified("2006-01-18","修改CngpSendMessage,每个单独的数据库操作,如取数据,"+
		"接收Mo,调度静态栏目,取计费信息都增加自己的OracleHelpler,"+
		 "更改CngpProtocol的发送方法")]
	[LastModified("2006-03-13","修改cngpprotocol类的接收deliver信息方法,停止使用do while循环")]
	[LastModified("2006-03-14","修改CngpProtocol类,Mt,Mo累加时触发事件更新显示")]
	[LastModified("2006-06-21","增加OraData类,使用数组读取信息")]
	[LastModified("2006-02-26","修改CngpSendMessage类,增加函数InsertStatusReport")]
	[LastModified("2007-04-03","修改CngpProtocol和CngpSendMessage类,增加对MsgId的处理")]
	public class frmMain : System.Windows.Forms.Form
	{
		private System.ComponentModel.IContainer components;		                

		private System.Windows.Forms.Label lbCount;						//Show sequence
		/// <summary>
		/// 发送计费线程
		/// </summary>
		private Thread threadFee;
	
		
		private System.Windows.Forms.MainMenu mainMenu;					//main menu
		private System.Windows.Forms.MenuItem menuItemFee;				//fee menu
		private System.Windows.Forms.MenuItem menuItemSendFee;			//send fee menu
		/// <summary>
		/// 控制发送计费信息速度的timer
		/// </summary>
		private System.Timers.Timer timerFee=new System.Timers.Timer();	
		
		/// <summary>
		/// 显示接收Mo数量的Lable
		/// </summary>			
		private System.Windows.Forms.Label lblMo;						

		
		/// <summary>
		/// 记录日志的类实例
		/// </summary>
		private Logs logIt=new Logs();									
		/// <summary>
		/// 在底部显示状态的Bar
		/// </summary>
		private System.Windows.Forms.StatusBar statusBar;
		private System.Windows.Forms.Label label1;
		/// <summary>
		/// 没有收到回复的信息数量
		/// </summary>
		private System.Windows.Forms.Label lblCount;					
		
		private System.Windows.Forms.Label label2;
		/// <summary>
		/// 准备发送的信息数量
		/// </summary>
		private System.Windows.Forms.Label lblReadySend;
		private System.Windows.Forms.Label label3;
		/// <summary>
		/// 网络连接数
		/// </summary>
		private System.Windows.Forms.Label lblSocket;	
		//------------------------------------------------------------------	
		
		private System.Windows.Forms.Label label4;
		private System.Windows.Forms.Label label5;
		private System.Windows.Forms.Label lblSocketStatus;				
		
		
	
		/// <summary>
		/// 检查网络连接数的Timer
		/// </summary>
		private System.Windows.Forms.Timer timerCheckConnection;		
							//Connection
		
		private System.Windows.Forms.Label l6;
						
		private System.Windows.Forms.ContextMenu Cmenu;
		private System.Windows.Forms.MenuItem menuRestore;
		private System.Windows.Forms.MenuItem menuExit;
		private System.Windows.Forms.NotifyIcon Noti;	
	
		/// <summary>
		/// Represent类实例
		/// </summary>
		private Represent represent;
		private System.Windows.Forms.Label lbmo;
		private CngpSendMessage cngpsendmessage;
			
	
		/// <summary>
		/// 构造函数
		/// 执行自定义的初始化参数的过程
		/// 读取配置文件的参数	
		/// </summary>
		[LastModified("2005-12-16","构造函数,读取配置信息")]
		public frmMain()
		{
			try
			{
				//
				// Windows 窗体设计器支持所必需的
				//
				InitializeComponent();		
				//初始化自己的参数
				InitMineComponent();
				//
				
				
			}
			catch(Exception ex)
			{
				throw ex;
			}

		}

		/// <summary>		
		/// 读取配置文件信息,初始化自定义变量
		/// </summary>
		[LastModified("205-11-11","读取配置文件信息,初始化自定义变量")]
		[LastModified("2007-02-01","读取配置文件的状态报告参数")]
		private void InitMineComponent()
		{						
			
			//
			//读取配置文件
			//
			ConfigInformation.GateIp=ReadConfig.ReadValue("IP");
			ConfigInformation.GatePort=Convert.ToInt32(ReadConfig.ReadValue("PORT"));
			ConfigInformation.CorpId=ReadConfig.ReadValue("CORPID");
			ConfigInformation.GateUserName=ReadConfig.ReadValue("USER");
			ConfigInformation.GateUserPassword=ReadConfig.ReadValue("PASS");
			ConfigInformation.MultiApp=ReadConfig.ReadValue("MULTIAPP").ToUpper();
			ConfigInformation.InstanceCount=Convert.ToInt32(ReadConfig.ReadValue("INSTANCE"));
			ConfigInformation.ConnectDb=ReadConfig.ReadValue("CONNECTDB").ToUpper();
			ConfigInformation.OraUser=ReadConfig.ReadValue("orauser".ToUpper());
			ConfigInformation.OraPassword=ReadConfig.ReadValue("orapassword".ToUpper());
			ConfigInformation.OraService=ReadConfig.ReadValue("oraservice".ToUpper());
			ConfigInformation.Sendspeed=ReadConfig.ReadValue("sendspeed".ToUpper());
			ConfigInformation.SendTimeout=Convert.ToInt32(ReadConfig.ReadValue("sendtimeout").ToUpper());
			ConfigInformation.ReceiveTimeout=Convert.ToInt32(ReadConfig.ReadValue("receivetimeout").ToUpper());
			ConfigInformation.Lingertime=Convert.ToInt32(ReadConfig.ReadValue("lingertime").ToUpper());
			//2007-02-01,状态报告
			ConfigInformation.Needreport=Convert.ToInt32(ReadConfig.ReadValue("needreport".ToUpper()));


			//
			//Represent类实例
			//
			represent=new Represent();

			cngpsendmessage=new CngpSendMessage();
	
			
		}
		/// <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.components = new System.ComponentModel.Container();
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(frmMain));
			this.lbCount = new System.Windows.Forms.Label();
			this.mainMenu = new System.Windows.Forms.MainMenu();
			this.menuItemFee = new System.Windows.Forms.MenuItem();
			this.menuItemSendFee = new System.Windows.Forms.MenuItem();
			this.lblMo = new System.Windows.Forms.Label();
			this.statusBar = new System.Windows.Forms.StatusBar();
			this.label1 = new System.Windows.Forms.Label();
			this.lblCount = new System.Windows.Forms.Label();
			this.label2 = new System.Windows.Forms.Label();
			this.lblReadySend = new System.Windows.Forms.Label();
			this.label3 = new System.Windows.Forms.Label();
			this.lblSocket = new System.Windows.Forms.Label();
			this.label4 = new System.Windows.Forms.Label();
			this.label5 = new System.Windows.Forms.Label();
			this.lblSocketStatus = new System.Windows.Forms.Label();
			this.timerCheckConnection = new System.Windows.Forms.Timer(this.components);
			this.l6 = new System.Windows.Forms.Label();
			this.Cmenu = new System.Windows.Forms.ContextMenu();
			this.menuRestore = new System.Windows.Forms.MenuItem();
			this.menuExit = new System.Windows.Forms.MenuItem();
			this.Noti = new System.Windows.Forms.NotifyIcon(this.components);
			this.lbmo = new System.Windows.Forms.Label();
			this.SuspendLayout();
			// 
			// lbCount
			// 
			this.lbCount.Location = new System.Drawing.Point(72, 136);
			this.lbCount.Name = "lbCount";
			this.lbCount.Size = new System.Drawing.Size(56, 23);
			this.lbCount.TabIndex = 5;
			this.lbCount.Text = "0";
			// 
			// mainMenu
			// 
			this.mainMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																					 this.menuItemFee});
			// 
			// menuItemFee
			// 
			this.menuItemFee.Index = 0;
			this.menuItemFee.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																						this.menuItemSendFee});
			this.menuItemFee.Text = "Fee";
			// 
			// menuItemSendFee
			// 
			this.menuItemSendFee.Index = 0;
			this.menuItemSendFee.Text = "Send Fee";
			this.menuItemSendFee.Click += new System.EventHandler(this.menuItemSendFee_Click);
			// 
			// lblMo
			// 
			this.lblMo.Location = new System.Drawing.Point(192, 136);
			this.lblMo.Name = "lblMo";
			this.lblMo.Size = new System.Drawing.Size(64, 23);
			this.lblMo.TabIndex = 8;
			this.lblMo.Text = "Deliver:";
			// 
			// statusBar
			// 
			this.statusBar.Location = new System.Drawing.Point(0, 163);
			this.statusBar.Name = "statusBar";
			this.statusBar.Size = new System.Drawing.Size(384, 22);
			this.statusBar.TabIndex = 10;
			// 
			// label1
			// 
			this.label1.Location = new System.Drawing.Point(32, 8);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(160, 23);
			this.label1.TabIndex = 11;
			this.label1.Text = "没有收到回复的信息数量:";
			// 
			// lblCount
			// 
			this.lblCount.Location = new System.Drawing.Point(184, 8);
			this.lblCount.Name = "lblCount";
			this.lblCount.TabIndex = 12;
			this.lblCount.Text = "0";
			// 
			// label2
			// 
			this.label2.Location = new System.Drawing.Point(32, 40);
			this.label2.Name = "label2";
			this.label2.Size = new System.Drawing.Size(136, 23);
			this.label2.TabIndex = 13;
			this.label2.Text = "准备发送信息数量:";
			// 
			// lblReadySend
			// 
			this.lblReadySend.Location = new System.Drawing.Point(184, 40);
			this.lblReadySend.Name = "lblReadySend";
			this.lblReadySend.TabIndex = 14;
			this.lblReadySend.Text = "0";
			// 
			// label3
			// 
			this.label3.Location = new System.Drawing.Point(32, 72);
			this.label3.Name = "label3";
			this.label3.TabIndex = 15;
			this.label3.Text = "连接数:";
			// 
			// lblSocket
			// 
			this.lblSocket.Location = new System.Drawing.Point(184, 72);
			this.lblSocket.Name = "lblSocket";
			this.lblSocket.TabIndex = 16;
			this.lblSocket.Text = "0";
			// 
			// label4
			// 
			this.label4.Location = new System.Drawing.Point(40, 136);
			this.label4.Name = "label4";
			this.label4.Size = new System.Drawing.Size(32, 23);
			this.label4.TabIndex = 17;
			this.label4.Text = "Mt:";
			// 
			// label5
			// 
			this.label5.Location = new System.Drawing.Point(32, 104);
			this.label5.Name = "label5";
			this.label5.Size = new System.Drawing.Size(96, 23);
			this.label5.TabIndex = 18;
			this.label5.Text = "调度栏目数量:";
			// 
			// lblSocketStatus
			// 
			this.lblSocketStatus.Location = new System.Drawing.Point(120, 104);
			this.lblSocketStatus.Name = "lblSocketStatus";
			this.lblSocketStatus.Size = new System.Drawing.Size(56, 23);
			this.lblSocketStatus.TabIndex = 19;
			// 
			// timerCheckConnection
			// 
			this.timerCheckConnection.Enabled = true;
			this.timerCheckConnection.Interval = 1000;
			this.timerCheckConnection.Tick += new System.EventHandler(this.timerCheckConnection_Tick);
			// 
			// l6
			// 
			this.l6.Location = new System.Drawing.Point(208, 104);
			this.l6.Name = "l6";
			this.l6.TabIndex = 20;
			this.l6.Text = "0";
			// 
			// Cmenu
			// 
			this.Cmenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																				  this.menuRestore,
																				  this.menuExit});
			// 
			// menuRestore
			// 
			this.menuRestore.Index = 0;
			this.menuRestore.Text = "还原";
			this.menuRestore.Click += new System.EventHandler(this.menuRestore_Click);
			// 
			// menuExit
			// 
			this.menuExit.Index = 1;
			this.menuExit.Text = "退出";
			this.menuExit.Click += new System.EventHandler(this.menuExit_Click);
			// 
			// Noti
			// 
			this.Noti.ContextMenu = this.Cmenu;
			this.Noti.Icon = ((System.Drawing.Icon)(resources.GetObject("Noti.Icon")));
			this.Noti.Text = "Cngp2.0";
			this.Noti.Visible = true;

⌨️ 快捷键说明

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