You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
116 lines
3.3 KiB
C#
116 lines
3.3 KiB
C#
using CentralControl.DBDAO;
|
|
using CommonFunc;
|
|
using CommonFunc.Tools;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Timers;
|
|
using System.Windows;
|
|
using System.Windows.Controls;
|
|
using System.Windows.Data;
|
|
using System.Windows.Documents;
|
|
using System.Windows.Input;
|
|
using System.Windows.Media;
|
|
using System.Windows.Media.Imaging;
|
|
using System.Windows.Shapes;
|
|
using XGL.Views;
|
|
|
|
namespace XGL.FormItem
|
|
{
|
|
/// <summary>
|
|
/// Main.xaml 的交互逻辑
|
|
/// </summary>
|
|
public partial class Main : Window
|
|
{
|
|
public static Main main;
|
|
Frame frame1 = new Frame() { Content = new Views.LanJu_Index()};
|
|
Timer timer = new Timer();
|
|
LanJu_Prepare prepare = new LanJu_Prepare();
|
|
LanJu_Operator op = new LanJu_Operator();
|
|
DryingRoomUC dryingRoomUC = new DryingRoomUC();
|
|
|
|
public enum WindowID
|
|
{
|
|
frame1
|
|
}
|
|
public Main()
|
|
{
|
|
InitializeComponent();
|
|
main = this;
|
|
//WindowChange(WindowID.frame1);
|
|
CommonFunc.Common.ReadConfig();//读取配置文件
|
|
timer.Interval = 1000;
|
|
timer.Elapsed += Timer_Elapsed;
|
|
timer.Start();
|
|
|
|
InitPage();
|
|
}
|
|
|
|
private void InitPage()
|
|
{
|
|
if (Utils.GetAppSetting("ClientMode").Equals("0"))
|
|
{
|
|
this.Index.Content = prepare;
|
|
}
|
|
else if (Utils.GetAppSetting("ClientMode").Equals("1"))
|
|
{
|
|
this.Index.Content = op;
|
|
}
|
|
else
|
|
{
|
|
this.Index.Content = dryingRoomUC;
|
|
}
|
|
}
|
|
|
|
private void Timer_Elapsed(object sender, ElapsedEventArgs e)
|
|
{
|
|
this.Dispatcher.Invoke(
|
|
new Action(() => { LabDate.Content = DateTime.Now.ToString("yyyy-MM-dd"); LabTime.Content = DateTime.Now.ToString("HH:mm:ss"); }
|
|
),
|
|
System.Windows.Threading.DispatcherPriority.Render) ;
|
|
}
|
|
|
|
public void WindowChange(WindowID windowID)
|
|
{
|
|
this.Index.Content = frame1;
|
|
}
|
|
|
|
private void Close(object sender, EventArgs e)
|
|
{
|
|
System.Environment.Exit(System.Environment.ExitCode);
|
|
}
|
|
private void btnExit_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
if (MessageBox.Show("是否确认关闭程序", "提示信息", MessageBoxButton.YesNo, MessageBoxImage.Information) == MessageBoxResult.No)
|
|
{
|
|
|
|
}
|
|
else
|
|
{
|
|
System.Environment.Exit(System.Environment.ExitCode);
|
|
}
|
|
}
|
|
|
|
private void btnZXH_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
this.WindowState = WindowState.Minimized;
|
|
}
|
|
|
|
|
|
private void Window_Loaded(object sender, RoutedEventArgs e)
|
|
{
|
|
this.tbOperator.Text = LoginUser.UserName;
|
|
this.tbDevice.Text = Utils.GetAppSetting("DeviceCode");
|
|
string sitecode = Utils.GetAppSetting("SiteCode");
|
|
DBService userDbWareHouse = new DBService();
|
|
DataTable dt = userDbWareHouse.GetFactoryInfo(sitecode);
|
|
string name = dt == null?"": dt.Rows[0][0].ToString();
|
|
this.tbFactory.Text = name;
|
|
}
|
|
}
|
|
|
|
}
|