Esempio n. 1
0
 public List <MessageBoxFooterButton> GetFooterButtonsFinal()
 {
     if (!IsFrozen && FooterButtons == null)
     {
         FooterButtons = new MessageBoxFooterButtonsCollection();
     }
     return(FooterButtons);
 }
Esempio n. 2
0
 protected override bool FreezeCore(bool isChecking)
 {
     //if (FooterButtons != null)
     //{
     //	if (FooterButtons.Count > 0)
     //		FooterButtons.ForEach(fb => fb.Freeze());
     //}
     if (FooterButtons == null)
     {
         FooterButtons = new MessageBoxFooterButtonsCollection();
     }
     return(base.FreezeCore(isChecking));
 }
Esempio n. 3
0
        public static MessageBoxInfo New(MessageBoxType type, string header, string content, MessageBoxFooterButtonsCollection footerButtons = null, Action <MessageBoxButton> action = null)
        {
            MessageBoxInfo result = new MessageBoxInfo
            {
                Title         = header,
                Content       = content,
                Action        = action,
                FooterButtons = footerButtons
            };

            switch (type)
            {
            case MessageBoxType.Question:
                result.IconBrushKey = MessageBoxIconBrushDefaultKeys.Question;
                result.Buttons      = MessageBoxButtons.YesNo;
                break;

            case MessageBoxType.Exception:
                result.IconBrushKey       = MessageBoxIconBrushDefaultKeys.Exception;
                result.ContentTemplateKey = MessageBoxContentTemplateDefaultKeys.Exception;
                result.Buttons            = MessageBoxButtons.OK;
                break;

            case MessageBoxType.Information:
                result.IconBrushKey = MessageBoxIconBrushDefaultKeys.Information;
                result.Buttons      = MessageBoxButtons.OK;
                break;

            case MessageBoxType.Warning:
                result.IconBrushKey = MessageBoxIconBrushDefaultKeys.Warning;
                result.Buttons      = MessageBoxButtons.OK;
                break;
            }
            return(result);
        }
        public static void ShowException(Exception exception, string windowTitle = null, string exceptionHeader = null, string exceptionMessageOverride = null, MessageBoxFooterButtonsCollection footerButtons = null)
        {
            string finalWindowTitle = windowTitle ?? DefaultWindowTitle;

            currentDispatcher.Invoke(new Action(() =>
            {
                MessageBoxInfo info = new MessageBoxInfo
                {
                    Title   = finalWindowTitle,
                    Content = exception != null ?
                              new ExceptionInfo(exceptionHeader, exception.GetType().Name, exceptionMessageOverride ?? exception.Message, exception.StackTrace) :
                              new ExceptionInfo(exceptionHeader, null, exceptionMessageOverride, null),
                    IconBrushKey                 = MessageBoxIconBrushDefaultKeys.Exception,
                    ContentTemplateKey           = MessageBoxContentTemplateDefaultKeys.Exception,
                    AdditionalContentTemplateKey = MessageBoxAdditionalContentTemplateDefaultKeys.Exception,
                    FooterButtons                = footerButtons,
                    Buttons = MessageBoxButtons.OK
                };
                Show(info);
            }));
        }