using DataEntity.Share;
|
using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Text;
|
using System.Threading.Tasks;
|
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 XImagingXhandler.XDAL;
|
|
namespace XHandler.View.MethodProperty
|
{
|
/// <summary>
|
/// PlsPausewin.xaml 的交互逻辑
|
/// </summary>
|
public partial class PlsPausewin : Window
|
{
|
int totalTime = 0;
|
string TipInfo=string.Empty;
|
int model = 0;
|
System.Windows.Threading.DispatcherTimer timer;
|
|
public PlsPausewin(MethodPauseMove methodPauseMove)
|
{
|
InitializeComponent();
|
|
model = methodPauseMove.pauseMode;
|
if (model == 0)
|
{
|
totalTime = Convert.ToInt32(methodPauseMove.pauseTime);
|
}
|
else
|
{
|
TipInfo = methodPauseMove.pauseTipInfo;
|
}
|
this.Owner = (Window)Shared.Main;
|
}
|
|
private void Window_Loaded(object sender, RoutedEventArgs e)
|
{
|
//启动倒计时
|
if(model==0)
|
{
|
textblockMsg.Text = "系统需要暂停"+totalTime.ToString()+"S";
|
textblockData.Text = "倒计时"+ totalTime + "S";
|
//启动一秒计时器刷新提示
|
timer=new System.Windows.Threading.DispatcherTimer();
|
timer.Interval = new TimeSpan(0, 0, 1);//设置的间隔为一秒
|
timer.Tick += timer_OnTime;//设置定时器溢出触发事件
|
//timer = new System.Windows.Threading.DispatcherTimer(new System.Windows.Threading(timer_OnTime), null, -1, 1000);
|
//timer.
|
//开启定时器
|
timer.Start();
|
}
|
else
|
{
|
textblockMsg.Text = TipInfo;
|
}
|
}
|
|
private void timer_OnTime(object sender, EventArgs e)
|
{
|
System.Windows.Application.Current.Dispatcher.Invoke(new Action(() =>
|
{
|
if (totalTime > 0)
|
{
|
textblockData.Text = "倒计时" + totalTime + "S";
|
totalTime--;
|
}
|
else if(totalTime == 0)
|
{
|
this.Close();
|
}
|
}));
|
}
|
}
|
}
|