/// <summary> /// 显示提示消息框, /// owner指定所属父窗体,默认参数值为null,则指定主窗体为父窗体。 /// </summary> public static bool Show(EnumMessageInfo info, string mes, Window owner = null) { var res = false; Application.Current.Dispatcher.Invoke(new Action(() => { var win = new MessageBox(); if (owner != null) { win.Owner = owner; win.WindowStartupLocation = WindowStartupLocation.CenterOwner; } else { win.WindowStartupLocation = WindowStartupLocation.CenterScreen; } //win.Owner = owner; win.Title = info.GetDescription(); win.Message.Text = mes; win.Message.Info = info; win.Message.Result = false; System.Media.SystemSounds.Beep.Play(); win.ShowDialog(); res = win.Message.Result; })); return(res); }
public EventMessageServerModel(EnumMessageInfo code, string procedureName, string message) { Code = code; ProcedureName = procedureName; Message = message; CreateDatetime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); }
public static void Show(EnumMessageInfo info, string mes, int secend = 3, int width = 380, int height = 140) { GUIThreadHelper.BeginInvoke(() => { PopMessageBox pop = PopBoxs.Where(s => !s.IsOpen).ToArray().IsValid() ? PopBoxs.First(s => !s.IsOpen) : new PopMessageBox(); pop.HorizontalOffset = SystemParameters.PrimaryScreenWidth - width; var ops = PopBoxs.Where(s => s.IsOpen).ToArray(); var strat = ops.IsValid() ? ops.Min(s => s.VerticalOffset) : _StartVerticalOffset; pop.VerticalOffset = strat - height; pop.Width = width; pop.Height = height; pop.Message.Info = info; pop.Message.Text = mes; pop.Start(secend); if (!PopBoxs.Contains(pop)) { PopBoxs.Add(pop); } //清理,最多缓存20个 if (PopBoxs.Count > 20) { PopBoxs.RemoveWhere(s => !s.IsOpen); } }); }