using DataEntity.Share;
|
using DataEntity.Sockets.TakePhoto;
|
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>
|
/// PlsWaitForwin.xaml 的交互逻辑
|
/// </summary>
|
public partial class PlsWaitForwin : Window
|
{
|
System.Windows.Threading.DispatcherTimer timer; //用于计时数
|
int totalTime = 0;
|
|
public PlsWaitForwin()
|
{
|
InitializeComponent();
|
}
|
|
public PlsWaitForwin(MethodTimer methodTimer,MethodWaitFor methodWaitFor)
|
{
|
InitializeComponent();
|
|
totalTime = Convert.ToInt32(methodTimer.duringTime);
|
|
tbkTimerName.Text = methodWaitFor.duringTimeText;
|
tbkDuringTime.Text = methodTimer.duringTime;
|
tbkContent.Text = methodTimer.duringTimeInfo;
|
|
if (methodWaitFor.enableEndWaitfor)
|
{
|
btnEndTimer.Visibility = Visibility.Visible;
|
}
|
else
|
{
|
btnEndTimer.Visibility = Visibility.Collapsed;
|
}
|
|
this.Owner = (Window)Shared.Main;
|
}
|
|
private void Window_Loaded(object sender, RoutedEventArgs e)
|
{
|
try
|
{
|
tbkCountdownTime.Text = totalTime.ToString();
|
|
//启动一秒计时器刷新提示
|
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();
|
}
|
catch(Exception ex)
|
{
|
|
}
|
}
|
|
#region 结束计时
|
private void btnEndTimer_Click(object sender, RoutedEventArgs e)
|
{
|
System.Windows.Application.Current.Dispatcher.Invoke(new Action(() =>
|
{
|
timer.Stop();
|
this.Close();
|
}));
|
}
|
#endregion
|
|
#region 计时器时间
|
private void timer_OnTime(object sender, EventArgs e)
|
{
|
System.Windows.Application.Current.Dispatcher.Invoke(new Action(() =>
|
{
|
if (totalTime > 0)
|
{
|
tbkCountdownTime.Text = totalTime.ToString();
|
totalTime--;
|
}
|
else if (totalTime == 0)
|
{
|
this.Close();
|
}
|
}));
|
}
|
#endregion
|
}
|
}
|