using DataEntity.Share;
|
using System;
|
using System.IO;
|
using System.Windows;
|
using System.Windows.Forms;
|
using System.Windows.Input;
|
using XCommon.Log;
|
using XHandler.Controls.Run.Com;
|
using XImagingXhandler.XDAL;
|
|
namespace XHandler.View.MethodProperty
|
{
|
public enum DialogResults
|
{
|
None,
|
OK,
|
Cancel,
|
Yes,
|
No
|
}
|
/// <summary>
|
/// 确认Dialog
|
/// </summary>
|
public partial class PlsToolTipWin : Window
|
{
|
public RunWnd lauchView = null;
|
System.Threading.Timer heartTimer;//用于轮询远程是否有消息过来关闭窗口
|
public int remoteMark = 0;//远程控制信号
|
|
public PlsToolTipWin(string info)
|
{
|
InitializeComponent();
|
textblockMsg.Text = info;
|
this.Owner = (Window)Shared.Main;
|
}
|
|
#region 定时器——轮询远程是否有消息过来关闭窗口
|
private void heartTimer_Tick(object sender)
|
{
|
try
|
{
|
this.Dispatcher.Invoke(new Action(() =>
|
{
|
if (((MainWindow)this.Owner).remoteMark == 4)
|
{
|
btnOK_Click(null, null);
|
}
|
else if (((MainWindow)this.Owner).remoteMark == 3)
|
{
|
btnCancel_Click(null, null);
|
}
|
}));
|
}
|
catch (Exception ex)
|
{
|
LoggerHelper.InfoLog("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 弹出窗口控制错误: " + ex.Message.ToString());
|
}
|
}
|
#endregion
|
|
/// <summary>
|
/// 取消
|
/// </summary>
|
/// <param name="sender"></param>
|
/// <param name="e"></param>
|
private void btnCancel_Click(object sender, RoutedEventArgs e)
|
{
|
this.DialogResult = false;
|
this.Close();
|
}
|
|
/// <summary>
|
/// 确定
|
/// </summary>
|
/// <param name="sender"></param>
|
/// <param name="e"></param>
|
private void btnOK_Click(object sender, RoutedEventArgs e)
|
{
|
this.DialogResult = true;
|
this.Close();
|
}
|
|
/// <summary>
|
/// 清除缓存数据
|
/// </summary>
|
/// <param name="sender"></param>
|
/// <param name="e"></param>
|
|
private void btnClearData_Click(object sender, RoutedEventArgs e)
|
{
|
if (lauchView != null)
|
{
|
// 清除Tip缓存数据
|
ControlCom.ClearTipData(lauchView);
|
}
|
|
string directoryBase = System.AppDomain.CurrentDomain.BaseDirectory;
|
string xmlFilePath = directoryBase + "Config\\" + "CurrentUsedTips.xml";
|
if (File.Exists(xmlFilePath))
|
{
|
File.Delete(xmlFilePath);
|
}
|
}
|
|
private void btnClose_Click(object sender, RoutedEventArgs e)
|
{
|
this.DialogResult = false;
|
this.Close();
|
}
|
|
#region 拖动窗体
|
/// <summary>
|
/// 拖动窗体
|
/// </summary>
|
/// <param name="sender"></param>
|
/// <param name="e"></param>
|
private void Grid_MouseDown(object sender, MouseButtonEventArgs e)
|
{
|
if (e.ChangedButton == MouseButton.Left)
|
{
|
this.DragMove();
|
}
|
}
|
#endregion
|
|
#region ESC关闭画面
|
/// <summary>
|
/// ESC关闭画面
|
/// </summary>
|
/// <param name="sender"></param>
|
/// <param name="e"></param>
|
private void Window_PreviewKeyDown(object sender, System.Windows.Input.KeyEventArgs e)
|
{
|
if (e.Key == Key.Escape)
|
{
|
this.Close();
|
}
|
}
|
#endregion
|
}
|
}
|