using Leit.StationFunction; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace MirrorBox { public partial class Form1 : Form { public Form1() { InitializeComponent(); ServiceData.PlcServiceInit(); ServiceData.ServiceDataInit(); ServiceData.WorkStationInit(); ServiceData.StationTimer(); } private void Form1_Load(object sender, EventArgs e) { this.BeginInvoke(new Action(() => { this.Hide(); })); } private void ToolStripMenuItem_Exit_Click(object sender, EventArgs e) { this.Close(); } private void ToolStripMenuItem_Version_Click(object sender, EventArgs e) { this.Show(); this.WindowState = FormWindowState.Normal; this.Activate(); } private void notifyIcon_Main_MouseDoubleClick(object sender, MouseEventArgs e) { this.Show(); this.WindowState = FormWindowState.Normal; this.Activate(); } private void Form1_Resize(object sender, EventArgs e) { if (this.WindowState == FormWindowState.Minimized) { this.Hide(); } } private void Form1_FormClosing(object sender, FormClosingEventArgs e) { notifyIcon_Main.Visible = false; //if (MessageBox.Show("你确定要退出程序吗?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.OK) //{ // notifyIcon_Main.Visible = false; // e.Cancel = false; //} //else //{ // notifyIcon_Main.Visible = true; // e.Cancel = true; //} } private void 隐藏HToolStripMenuItem_Click(object sender, EventArgs e) { this.Hide(); } } }