private static void StateChanged(MessageWindow msgWin, MessageButtonCount messageButtonCount) { var localMsg = msgWin.FindName("customMsg") as MessageDialog; localMsg.AdornerForeground = fore; localMsg.AdornerBackground = back; localMsg.MessageButtonResult = messageButtonCount; //更改button的个数 }
/// <summary> /// 打开MessageDialog窗口 /// </summary> /// <returns></returns> private static MessageBoxResult OpenMsgWindow(MessageButtonCount messageButtonCount) { MessageWindow msgWin = new MessageWindow(); StateChanged(msgWin, messageButtonCount); msgWin.ShowDialog(); return(MsgViewModel.msg_Result); }
/// <summary> /// 打开MessageDialog窗口 /// </summary> /// <returns></returns> private static MessageBoxResult OpenMsgWindow(MessageButtonCount messageButtonCount) { Application.Current.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() => { MessageWindow msgWin = new MessageWindow(); StateChanged(msgWin, messageButtonCount); msgWin.ShowDialog(); })); // Dispatcher.Run(); //更新窗口的状态 return(MsgViewModel.msg_Result); }
/// <summary> /// 显示一条窗口信息,并返回结果 /// </summary> /// <returns></returns> public static MessageBoxResult Show(string caption, string indicateText, IconType msgIcon, MessageButtonCount messageButtonCount = MessageButtonCount.Single) { MsgViewModel.msg_Caption = caption; MsgViewModel.msg_IndicateText = indicateText; MsgViewModel.msg_Icon = msgIcon; return(OpenMsgWindow(messageButtonCount)); }
/// <summary> /// 显示一条窗口信息,并返回结果 /// </summary> /// <param name="indicateText"></param> /// <returns></returns> public static MessageBoxResult Show(string indicateText, MessageButtonCount messageButtonCount = MessageButtonCount.Single) { MsgViewModel.msg_IndicateText = indicateText; return(OpenMsgWindow(messageButtonCount)); }
/// <summary> /// 显示一条窗口信息,并返回结果 /// </summary> /// <returns></returns> public static MessageBoxResult Show(string caption, string indicateText, IconType msgIcon, MessageButtonCount messageButtonCount = MessageButtonCount.Single) { MsgViewModel.msg_Caption = caption; MsgViewModel.msg_IndicateText = indicateText; MsgViewModel.msg_Icon = msgIcon; return(Application.Current.Dispatcher.Invoke(() => OpenMsgWindow(messageButtonCount))); }