|
|
@ -1,6 +1,7 @@ |
|
|
using System; |
|
|
using System; |
|
|
using System.Collections.Generic; |
|
|
using System.Collections.Generic; |
|
|
using System.Data; |
|
|
using System.Data; |
|
|
|
|
|
using System.IO; |
|
|
using System.Linq; |
|
|
using System.Linq; |
|
|
using System.Text; |
|
|
using System.Text; |
|
|
using System.Text.RegularExpressions; |
|
|
using System.Text.RegularExpressions; |
|
|
@ -30,8 +31,11 @@ namespace formula_manage |
|
|
int ID_N = 1; |
|
|
int ID_N = 1; |
|
|
|
|
|
|
|
|
WindowStartupLocation = WindowStartupLocation.CenterScreen; |
|
|
WindowStartupLocation = WindowStartupLocation.CenterScreen; |
|
|
InitializeComponent(); |
|
|
InitializeComponent(); |
|
|
|
|
|
this.Closing += Window_Closing; //添加窗口关闭事件
|
|
|
|
|
|
|
|
|
|
|
|
CountDown();//执行循环方法
|
|
|
|
|
|
|
|
|
DataTable dataTable = new DataTable(); |
|
|
DataTable dataTable = new DataTable(); |
|
|
dataTable.Columns.Add("ID", typeof(int)); |
|
|
dataTable.Columns.Add("ID", typeof(int)); |
|
|
dataTable.Columns.Add("PRODUCT_CODE", typeof(string)); |
|
|
dataTable.Columns.Add("PRODUCT_CODE", typeof(string)); |
|
|
@ -56,6 +60,33 @@ namespace formula_manage |
|
|
DetailedGrid.ItemsSource = dataTable.DefaultView; |
|
|
DetailedGrid.ItemsSource = dataTable.DefaultView; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) //窗口关闭事件
|
|
|
|
|
|
{ |
|
|
|
|
|
string logpath = System.Environment.CurrentDirectory + "\\Log";//日志文件目录
|
|
|
|
|
|
string logPath = "" + System.Environment.CurrentDirectory + "\\Log\\Log.txt";//日志文件
|
|
|
|
|
|
string Log_time = "[" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "]:"; |
|
|
|
|
|
|
|
|
|
|
|
System.IO.DirectoryInfo log = new System.IO.DirectoryInfo(@logpath);//生成日志文件目录
|
|
|
|
|
|
FileStream fs = new FileStream(logPath, FileMode.Append, FileAccess.Write); |
|
|
|
|
|
StreamWriter wr = new StreamWriter(fs);//创建文件
|
|
|
|
|
|
wr.WriteLine(Log_time + "FORMULA_STOP"); |
|
|
|
|
|
wr.Close(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private DispatcherTimer disTimer = new DispatcherTimer();//循环功能
|
|
|
|
|
|
|
|
|
|
|
|
public void DisTimer_Tick(object sender, EventArgs e)//循环事件
|
|
|
|
|
|
{ |
|
|
|
|
|
USERTIME.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); |
|
|
|
|
|
} |
|
|
|
|
|
public void CountDown() |
|
|
|
|
|
{ |
|
|
|
|
|
//设置定时器
|
|
|
|
|
|
disTimer.Tick += new EventHandler(DisTimer_Tick);//每一秒执行的方法
|
|
|
|
|
|
disTimer.Interval = new TimeSpan(10000000); //时间间隔为一秒。
|
|
|
|
|
|
disTimer.Start();//计时开始
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
private void SearchBox_OnKeyDownd(object sender, System.Windows.Input.KeyEventArgs e) //回车跳转功能
|
|
|
private void SearchBox_OnKeyDownd(object sender, System.Windows.Input.KeyEventArgs e) //回车跳转功能
|
|
|
{ |
|
|
{ |
|
|
if (e.Key == Key.Enter) |
|
|
if (e.Key == Key.Enter) |
|
|
|