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.
73 lines
2.0 KiB
C#
73 lines
2.0 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
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;
|
|
|
|
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();
|
|
public enum WindowID
|
|
{
|
|
frame1
|
|
}
|
|
public Main()
|
|
{
|
|
InitializeComponent();
|
|
main = this;
|
|
WindowChange(WindowID.frame1);
|
|
CommonFunc.Common.ReadConfig();//读取配置文件
|
|
timer.Interval = 1000;
|
|
timer.Elapsed += Timer_Elapsed;
|
|
timer.Start();
|
|
}
|
|
|
|
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);
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
}
|