public static void ShowYesNo(string message, string header, Icon icon, Action <bool> callback = null, Panel parent = null)
        {
            if (parent == null)
            {
                parent = Utils.GetMainWindowPanel();
            }

            var messageView = new MessageView();

            messageView.ContentText = message;
            messageView.HeaderText  = header;
            messageView.Icon        = icon;
            messageView.SetItems(new MessageItemInfo[] {
                new MessageItemInfo(
                    "Да",
                    (v) =>
                {
                    v.Close();
                    callback?.Invoke(true);
                },
                    Icon.Check),
                new MessageItemInfo(
                    "Нет",
                    (v) =>
                {
                    v.Close();
                    callback?.Invoke(false);
                },
                    Icon.Cancel,
                    true)
            });
            messageView.Show(parent);
        }
示例#2
0
 public static void ShowMessage(string message, string header, Icon icon, Panel parent = null, Action okCallback = null)
 {
     App.Current.Dispatcher.BeginInvoke(new Action(() => {
         if (parent == null)
         {
             parent = Utils.GetMainWindowPanel();
         }
         var messageView         = new MessageView();
         messageView.ContentText = message;
         messageView.HeaderText  = header;
         messageView.Icon        = icon;
         messageView.SetItems(new MessageItemInfo[] {
             new MessageItemInfo("OK",
                                 (v) => {
                 v.Close();
                 okCallback?.Invoke();
             }, Icon.Check, true)
         });
         messageView.Show(parent);
     }));
 }