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 } /// /// 确认Dialog /// 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 /// /// 取消 /// /// /// private void btnCancel_Click(object sender, RoutedEventArgs e) { this.DialogResult = false; this.Close(); } /// /// 确定 /// /// /// private void btnOK_Click(object sender, RoutedEventArgs e) { this.DialogResult = true; this.Close(); } /// /// 清除缓存数据 /// /// /// 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 拖动窗体 /// /// 拖动窗体 /// /// /// private void Grid_MouseDown(object sender, MouseButtonEventArgs e) { if (e.ChangedButton == MouseButton.Left) { this.DragMove(); } } #endregion #region ESC关闭画面 /// /// ESC关闭画面 /// /// /// private void Window_PreviewKeyDown(object sender, System.Windows.Input.KeyEventArgs e) { if (e.Key == Key.Escape) { this.Close(); } } #endregion } }