|
|
@ -3,17 +3,34 @@ using System.Collections.Generic; |
|
|
|
using System.ComponentModel; |
|
|
|
using System.Data; |
|
|
|
using System.Data.SqlClient; |
|
|
|
using System.Diagnostics; |
|
|
|
using System.Drawing; |
|
|
|
using System.Linq; |
|
|
|
using System.Runtime.InteropServices; |
|
|
|
using System.Security.Cryptography; |
|
|
|
using System.Text; |
|
|
|
using System.Threading; |
|
|
|
using System.Threading.Tasks; |
|
|
|
using System.Windows; |
|
|
|
using System.Windows.Forms; |
|
|
|
|
|
|
|
namespace ProcessManage |
|
|
|
{ |
|
|
|
internal class Program |
|
|
|
{ |
|
|
|
[DllImport("user32.dll")] |
|
|
|
static extern bool ShowWindow(IntPtr hWnd, int cmdShow); |
|
|
|
|
|
|
|
[DllImport("kernel32.dll")] |
|
|
|
static extern IntPtr GetConsoleWindow(); |
|
|
|
|
|
|
|
const int SW_HIDE = 0; |
|
|
|
const int SW_SHOW = 5; |
|
|
|
const int SW_MINIMIZE = 6; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static IniFile.IniFiles Configini = new IniFile.IniFiles(Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "ProcessManageConfigini.ini"); |
|
|
|
private static string SQLIP = Configini.IniReadvalue("SQL_SERVER", "SQL1"); //读配置文件
|
|
|
|
private static string SQLNAME = Configini.IniReadvalue("SQL_SERVER", "SQL2"); |
|
|
@ -21,7 +38,7 @@ namespace ProcessManage |
|
|
|
private static string SQLUSER = Configini.IniReadvalue("SQL_SERVER", "SQL4"); |
|
|
|
private static string SQLPASWORD = Configini.IniReadvalue("SQL_SERVER", "SQL5"); |
|
|
|
private static DataTable DyelotsBulkedRecipe = new DataTable(); |
|
|
|
private static Timer _timer; |
|
|
|
private static System.Threading.Timer _timer; |
|
|
|
private static int Count = 0; |
|
|
|
private static readonly int _intervalMs = int.Parse( Configini.IniReadvalue("SQL_SERVER", "SQL6")); |
|
|
|
private static DataTable Product = new DataTable(); |
|
|
@ -29,8 +46,28 @@ namespace ProcessManage |
|
|
|
|
|
|
|
static void Main(string[] args) |
|
|
|
{ |
|
|
|
var handle = GetConsoleWindow(); |
|
|
|
// ShowWindow(handle, SW_MINIMIZE);
|
|
|
|
ShowWindow(handle, SW_HIDE); |
|
|
|
|
|
|
|
// 托盘图标部分
|
|
|
|
var notifyIcon = new NotifyIcon(); |
|
|
|
notifyIcon.Icon = new System.Drawing.Icon("./sunlight_logo.ico"); |
|
|
|
notifyIcon.Visible = true; |
|
|
|
notifyIcon.Text = "Process选择"; |
|
|
|
notifyIcon.MouseClick += (s, e) => |
|
|
|
{ |
|
|
|
if (e.Button == MouseButtons.Left) |
|
|
|
{ |
|
|
|
ShowWindow(handle, SW_SHOW); |
|
|
|
//Process.GetCurrentProcess().MainWindowHandle; // 强制刷新焦点
|
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Console.WriteLine("Process选择功能启动"); |
|
|
|
_timer = new Timer( |
|
|
|
_timer = new System.Threading.Timer( |
|
|
|
callback: EXTask, |
|
|
|
state: null, |
|
|
|
dueTime: 100, |
|
|
|