public MessageWindowElement(MessageDailog dm)
            : base()
        {
            var bindinAccept = new CommandBinding(AcceptCommand, OnAccept);
            this.CommandBindings.Add(bindinAccept);

            var bindingCancel = new CommandBinding(CancelCommand, OnCancel);
            this.CommandBindings.Add(bindingCancel);

            if (dm != null)
            {
                Buttons = dm.DialogButton;
                Title = dm.Title;
                Content = dm.Caption;

                if (dm.DialogHeight != 0)
                    this.Height = dm.DialogHeight;
                if (dm.DialogWidth != 0)
                    this.Height = dm.DialogWidth;

                if(dm.IsSizeToContent)
                    this.SizeToContent = SizeToContent.WidthAndHeight;
            }

            CreateContainer();
        }
コード例 #2
0
 public static void LogError(Exception exception, string errorType = "Error", string message = "", string userMessage = "")
 {
     Instance.ErrorException(message, exception);
     string userFrenMsg = userMessage + Environment.NewLine + exception.Message;
     var messageDailog = new MessageDailog()
         {
             Caption = userFrenMsg,
             DialogButton = DialogButton.Ok,
             Title = errorType,
             IsSizeToContent = true
         };
     Messenger.Default.Send(messageDailog);
 }