/// <summary> /// 提示选择信息 /// </summary> /// <param name="title"></param> /// <param name="message"></param> /// <param name="action1"></param> /// <param name="action2"></param> public void AlertChoice(string title, string message, Action action1, Action action2) { Application.Current.Dispatcher.Invoke(new Action(() => { var window = new Control.ShowTip(Control.ShowTipType.Choice, title, message); window.btnAccept.Click += (sender, e) => { window.Close(); Loading(action1, "正在处理..."); }; window.btnStop.Click += (sender, e) => { window.Close(); Loading(action2, "正在处理..."); }; window.MouseLeftButtonDown += (sender, e) => { if (e.LeftButton == System.Windows.Input.MouseButtonState.Pressed) { window.DragMove(); } }; window.ShowDialog(); })); }
/// <summary> /// 信息提醒 /// </summary> /// <param name="tipType">提醒类型</param> /// <param name="msg">信息</param> private void ShowTip(PlanMGMT.Control.ShowTipType tipType, string msg) { Application.Current.Dispatcher.Invoke(new Action(() => { Control.ShowTip tip = new Control.ShowTip(tipType, msg); switch (tipType) { case PlanMGMT.Control.ShowTipType.Ok: msg = (String.IsNullOrEmpty(msg) ? msg = "操作成功!" : msg); break; case PlanMGMT.Control.ShowTipType.Warning: msg = (String.IsNullOrEmpty(msg) ? msg = msg = "操作失败!" : msg); break; case PlanMGMT.Control.ShowTipType.Error: msg = (String.IsNullOrEmpty(msg) ? msg = msg = "操作失败!" : msg); break; case PlanMGMT.Control.ShowTipType.Information: default: break; } tip.Show(); })); }