📄 frmmain.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using System.Net.Sockets;
using System.Text;
using System.Text.RegularExpressions;
using Microsoft.Win32;
using System.Xml;
using System.Management;
namespace apolloService
{
/// <summary>
/// Form1 的摘要说明。
/// </summary>
public class frmMain : System.Windows.Forms.Form
{
private System.Windows.Forms.NotifyIcon ApolloNotifyIcon;
private System.Windows.Forms.ContextMenu ChickMenu;
private System.Windows.Forms.Button button1;
private System.ServiceProcess.ServiceController ApolloMsgSrv;
private System.Windows.Forms.TabControl tabControl1;
private System.Windows.Forms.StatusBar statusBar1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.MenuItem menuItem1;
private System.Windows.Forms.MenuItem menuItem2;
private System.Windows.Forms.MenuItem menuItem3;
private System.Windows.Forms.MenuItem menuItem4;
private System.Windows.Forms.MenuItem menuItem5;
private System.Windows.Forms.MenuItem menuItem6;
private System.Windows.Forms.MenuItem menuItem7;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button button5;
private System.Windows.Forms.Button button8;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.OpenFileDialog openFileDialog1;
private System.Windows.Forms.FolderBrowserDialog folderBrowserDialog1;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.Label label10;
private System.Windows.Forms.CheckBox chkCheckRemind;
private System.Windows.Forms.CheckBox chkFestival;
private System.Windows.Forms.CheckBox chkBirthday;
private System.Windows.Forms.CheckBox chkLogistics;
private System.Windows.Forms.CheckBox chkBottleNeck;
private System.Windows.Forms.CheckBox chkNewAdd;
private System.Windows.Forms.TextBox txbJLlogPWD;
private System.Windows.Forms.TextBox txbJLlogName;
private System.Windows.Forms.Button btnModify;
private System.Windows.Forms.Button btnNew;
private System.Windows.Forms.TextBox txbMsgContent;
private System.Windows.Forms.ComboBox cmbMsgType;
private System.Windows.Forms.Button btnRestore;
private System.Windows.Forms.Button btnBakcup;
private System.Windows.Forms.Button btnFresh;
private System.Windows.Forms.CheckBox chkHaveCadreman;
private System.Windows.Forms.CheckBox chkDawnMarginRemind;
private System.Windows.Forms.ComboBox cboDataBase;
private System.Windows.Forms.TextBox txbResPath;
private System.Windows.Forms.TextBox txbBakPath;
private System.ComponentModel.IContainer components;
private System.Windows.Forms.Button btnUnCompress;
private System.Windows.Forms.Button btnCompress;
private System.Timers.Timer timer1;
private System.Windows.Forms.TabPage TG_Service;
private System.Windows.Forms.TabPage TG_MsgSet;
private System.Windows.Forms.TabPage TG_Database;
private System.Windows.Forms.TabPage TG_MsgContent;
private System.Windows.Forms.TabPage TG_AppSet;
private System.Windows.Forms.Button btnSrvOption;
private System.Windows.Forms.ImageList imageList1;
private System.Windows.Forms.GroupBox groupBox3;
private System.Windows.Forms.Label label11;
private System.Windows.Forms.Label label12;
private System.Windows.Forms.Label label13;
private System.Windows.Forms.TextBox txtSqlName;
private System.Windows.Forms.TextBox txtSqlPWD;
private System.Windows.Forms.Label label14;
private System.Windows.Forms.Button btnFresh1;
private System.Windows.Forms.ComboBox cboDataBase1;
private System.Windows.Forms.TextBox txtSqlHost;
private System.Windows.Forms.Button btnMsgFresh;
private System.Windows.Forms.Button button4;
private System.Windows.Forms.Label lblSockState;
private System.Windows.Forms.Button button6;
private System.Windows.Forms.Button button7;
private string logFilePath="C:\\ApolloLog\\MsgLog" + DateTime.Now.Year.ToString() + Common.NumAdjust(DateTime.Now.Month.ToString()) + Common.NumAdjust(DateTime.Now.Day.ToString()) + ".log" ;
private SQLDMO.SQLServer srv;
private SqlConnection DB;
private DataSet ds;
private static string SqlHost="(local)";
public static string SqlHostValue
{
get{return SqlHost;}
set{SqlHost = value;}
}
private static string SqlName="sa";
public static string SqlNameValue
{
get{return SqlName;}
set{SqlName = value;}
}
private static string SqlPWD="";
private System.Windows.Forms.ListBox listBox1;
public static string SqlPWDValue
{
get{return SqlPWD;}
set{SqlPWD = value;}
}
private static string SqlDataBase="";
public static string SqlDataBaseName
{
get{return SqlDataBase;}
set{SqlDataBase = value;}
}
public bool GetNotifyIcon()
{
return ApolloNotifyIcon.Visible;
}
public void SetNotifyIcon(bool VisibleValue)
{
ApolloNotifyIcon.Visible = VisibleValue;
}
public frmMain()
{
//
// 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()
{
this.components = new System.ComponentModel.Container();
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(frmMain));
this.ApolloNotifyIcon = new System.Windows.Forms.NotifyIcon(this.components);
this.ChickMenu = new System.Windows.Forms.ContextMenu();
this.menuItem1 = new System.Windows.Forms.MenuItem();
this.menuItem2 = new System.Windows.Forms.MenuItem();
this.menuItem3 = new System.Windows.Forms.MenuItem();
this.menuItem4 = new System.Windows.Forms.MenuItem();
this.menuItem5 = new System.Windows.Forms.MenuItem();
this.menuItem6 = new System.Windows.Forms.MenuItem();
this.menuItem7 = new System.Windows.Forms.MenuItem();
this.button1 = new System.Windows.Forms.Button();
this.ApolloMsgSrv = new System.ServiceProcess.ServiceController();
this.tabControl1 = new System.Windows.Forms.TabControl();
this.TG_Service = new System.Windows.Forms.TabPage();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.cboDataBase1 = new System.Windows.Forms.ComboBox();
this.btnFresh1 = new System.Windows.Forms.Button();
this.label14 = new System.Windows.Forms.Label();
this.txtSqlPWD = new System.Windows.Forms.TextBox();
this.txtSqlName = new System.Windows.Forms.TextBox();
this.txtSqlHost = new System.Windows.Forms.TextBox();
this.label13 = new System.Windows.Forms.Label();
this.label12 = new System.Windows.Forms.Label();
this.label11 = new System.Windows.Forms.Label();
this.btnSrvOption = new System.Windows.Forms.Button();
this.label10 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.textBox1 = new System.Windows.Forms.TextBox();
this.TG_MsgSet = new System.Windows.Forms.TabPage();
this.txbJLlogPWD = new System.Windows.Forms.TextBox();
this.label9 = new System.Windows.Forms.Label();
this.txbJLlogName = new System.Windows.Forms.TextBox();
this.label8 = new System.Windows.Forms.Label();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.chkHaveCadreman = new System.Windows.Forms.CheckBox();
this.chkCheckRemind = new System.Windows.Forms.CheckBox();
this.chkFestival = new System.Windows.Forms.CheckBox();
this.chkBirthday = new System.Windows.Forms.CheckBox();
this.chkLogistics = new System.Windows.Forms.CheckBox();
this.chkBottleNeck = new System.Windows.Forms.CheckBox();
this.chkDawnMarginRemind = new System.Windows.Forms.CheckBox();
this.chkNewAdd = new System.Windows.Forms.CheckBox();
this.TG_Database = new System.Windows.Forms.TabPage();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.cboDataBase = new System.Windows.Forms.ComboBox();
this.label3 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.btnUnCompress = new System.Windows.Forms.Button();
this.btnRestore = new System.Windows.Forms.Button();
this.button8 = new System.Windows.Forms.Button();
this.btnCompress = new System.Windows.Forms.Button();
this.btnBakcup = new System.Windows.Forms.Button();
this.button5 = new System.Windows.Forms.Button();
this.txbResPath = new System.Windows.Forms.TextBox();
this.btnFresh = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.txbBakPath = new System.Windows.Forms.TextBox();
this.TG_MsgContent = new System.Windows.Forms.TabPage();
this.btnMsgFresh = new System.Windows.Forms.Button();
this.label7 = new System.Windows.Forms.Label();
this.btnModify = new System.Windows.Forms.Button();
this.btnNew = new System.Windows.Forms.Button();
this.txbMsgContent = new System.Windows.Forms.TextBox();
this.cmbMsgType = new System.Windows.Forms.ComboBox();
this.label6 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.TG_AppSet = new System.Windows.Forms.TabPage();
this.button7 = new System.Windows.Forms.Button();
this.button6 = new System.Windows.Forms.Button();
this.lblSockState = new System.Windows.Forms.Label();
this.button4 = new System.Windows.Forms.Button();
this.statusBar1 = new System.Windows.Forms.StatusBar();
this.button2 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
this.folderBrowserDialog1 = new System.Windows.Forms.FolderBrowserDialog();
this.timer1 = new System.Timers.Timer();
this.imageList1 = new System.Windows.Forms.ImageList(this.components);
this.listBox1 = new System.Windows.Forms.ListBox();
this.tabControl1.SuspendLayout();
this.TG_Service.SuspendLayout();
this.groupBox3.SuspendLayout();
this.TG_MsgSet.SuspendLayout();
this.groupBox2.SuspendLayout();
this.TG_Database.SuspendLayout();
this.groupBox1.SuspendLayout();
this.TG_MsgContent.SuspendLayout();
this.TG_AppSet.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.timer1)).BeginInit();
this.SuspendLayout();
//
// ApolloNotifyIcon
//
this.ApolloNotifyIcon.ContextMenu = this.ChickMenu;
this.ApolloNotifyIcon.Icon = ((System.Drawing.Icon)(resources.GetObject("ApolloNotifyIcon.Icon")));
this.ApolloNotifyIcon.Text = "太阳神综合管理器";
this.ApolloNotifyIcon.Visible = true;
//
// ChickMenu
//
this.ChickMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem1,
this.menuItem2,
this.menuItem3,
this.menuItem4,
this.menuItem5,
this.menuItem6,
this.menuItem7});
//
// menuItem1
//
this.menuItem1.Index = 0;
this.menuItem1.Text = "&Manage";
this.menuItem1.Click += new System.EventHandler(this.menuItem1_Click);
//
// menuItem2
//
this.menuItem2.Index = 1;
this.menuItem2.Text = "-";
//
// menuItem3
//
this.menuItem3.Index = 2;
this.menuItem3.Text = "&Start";
this.menuItem3.Click += new System.EventHandler(this.menuItem3_Click);
//
// menuItem4
//
this.menuItem4.Index = 3;
this.menuItem4.Text = "&Pause";
this.menuItem4.Click += new System.EventHandler(this.menuItem4_Click);
//
// menuItem5
//
this.menuItem5.Index = 4;
this.menuItem5.Text = "S&top";
this.menuItem5.Click += new System.EventHandler(this.menuItem5_Click);
//
// menuItem6
//
this.menuItem6.Index = 5;
this.menuItem6.Text = "-";
//
// menuItem7
//
this.menuItem7.Index = 6;
this.menuItem7.Text = "&Exit";
this.menuItem7.Click += new System.EventHandler(this.menuItem7_Click);
//
// button1
//
this.button1.Location = new System.Drawing.Point(112, 192);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(80, 24);
this.button1.TabIndex = 0;
this.button1.Text = "确定";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// ApolloMsgSrv
//
this.ApolloMsgSrv.MachineName = "localhost";
this.ApolloMsgSrv.ServiceName = "ApolloMsgSrv";
//
// tabControl1
//
this.tabControl1.Controls.Add(this.TG_Service);
this.tabControl1.Controls.Add(this.TG_MsgSet);
this.tabControl1.Controls.Add(this.TG_Database);
this.tabControl1.Controls.Add(this.TG_MsgContent);
this.tabControl1.Controls.Add(this.TG_AppSet);
this.tabControl1.Location = new System.Drawing.Point(8, 8);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(576, 176);
this.tabControl1.TabIndex = 1;
this.tabControl1.SelectedIndexChanged += new System.EventHandler(this.tabControl1_SelectedIndexChanged);
//
// TG_Service
//
this.TG_Service.Controls.Add(this.groupBox3);
this.TG_Service.Controls.Add(this.btnSrvOption);
this.TG_Service.Controls.Add(this.label10);
this.TG_Service.Controls.Add(this.label4);
this.TG_Service.Controls.Add(this.textBox1);
this.TG_Service.Location = new System.Drawing.Point(4, 21);
this.TG_Service.Name = "TG_Service";
this.TG_Service.Size = new System.Drawing.Size(568, 151);
this.TG_Service.TabIndex = 0;
this.TG_Service.Text = "服务程序";
//
// groupBox3
//
this.groupBox3.Controls.Add(this.cboDataBase1);
this.groupBox3.Controls.Add(this.btnFresh1);
this.groupBox3.Controls.Add(this.label14);
this.groupBox3.Controls.Add(this.txtSqlPWD);
this.groupBox3.Controls.Add(this.txtSqlName);
this.groupBox3.Controls.Add(this.txtSqlHost);
this.groupBox3.Controls.Add(this.label13);
this.groupBox3.Controls.Add(this.label12);
this.groupBox3.Controls.Add(this.label11);
this.groupBox3.Location = new System.Drawing.Point(168, 16);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(392, 120);
this.groupBox3.TabIndex = 5;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "数据库服务器设置";
//
// cboDataBase1
//
this.cboDataBase1.Location = new System.Drawing.Point(16, 88);
this.cboDataBase1.Name = "cboDataBase1";
this.cboDataBase1.Size = new System.Drawing.Size(144, 20);
this.cboDataBase1.TabIndex = 16;
//
// btnFresh1
//
this.btnFresh1.Location = new System.Drawing.Point(168, 88);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -