示例#1
0
        //
        // Summary:
        //     Displays a message box that has a message, title bar caption, button, and
        //     icon; and that accepts a default message box result and returns a result.
        //
        // Parameters:
        //   messageBoxText:
        //     A System.String that specifies the text to display.
        //
        //   caption:
        //     A System.String that specifies the title bar caption to display.
        //
        //   button:
        //     A System.Windows.MessageBoxButton value that specifies which button or buttons
        //     to display.
        //
        //   icon:
        //     A System.Windows.MessageBoxImage value that specifies the icon to display.
        //
        //   defaultResult:
        //     A System.Windows.MessageBoxResult value that specifies the default result
        //     of the message box.
        //
        // Returns:
        //     A System.Windows.MessageBoxResult value that specifies which message box
        //     button is clicked by the user.


        public static MessageBoxResult Show(Window owner, string text, string caption, String detailsHeader, String details, bool dontAskAgainVisible, string dontAskAgainText, MessageBoxButton button, MessageBoxImage icon)
        {
            var mbcModel = new MessageBoxControlModel
            {
                DontAskAgainVisible = dontAskAgainVisible,
                MessageBoxImage     = icon,
                Text             = text,
                ExpanderHeader   = detailsHeader,
                ExpanderDetails  = details,
                DontAskAgainText = dontAskAgainText
            };
            var mbcontrol = new MessageBoxControl(mbcModel);
            var m         = new Model {
                MessageBoxButton = button, Title = caption, Content = mbcontrol
            };

            var fx = new FxMessageWindow(m);

            fx.Owner         = owner;
            fx.ShowInTaskbar = false;
            fx.ShowDialog();
            return(fx.Result);
        }
        //
        // Summary:
        //     Displays a message box that has a message, title bar caption, button, and
        //     icon; and that accepts a default message box result and returns a result.
        //
        // Parameters:
        //   messageBoxText:
        //     A System.String that specifies the text to display.
        //
        //   caption:
        //     A System.String that specifies the title bar caption to display.
        //
        //   button:
        //     A System.Windows.MessageBoxButton value that specifies which button or buttons
        //     to display.
        //
        //   icon:
        //     A System.Windows.MessageBoxImage value that specifies the icon to display.
        //
        //   defaultResult:
        //     A System.Windows.MessageBoxResult value that specifies the default result
        //     of the message box.
        //
        // Returns:
        //     A System.Windows.MessageBoxResult value that specifies which message box
        //     button is clicked by the user.
        public static MessageBoxResult Show(Window owner,string text, string caption,String detailsHeader,String details,bool dontAskAgainVisible,string dontAskAgainText, MessageBoxButton button, MessageBoxImage icon)
        {
            var mbcModel = new MessageBoxControlModel
                               {
                                   DontAskAgainVisible = dontAskAgainVisible,
                                   MessageBoxImage = icon,
                                   Text = text,
                                   ExpanderHeader = detailsHeader,
                                   ExpanderDetails = details,
                                   DontAskAgainText = dontAskAgainText
                               };
            var mbcontrol = new MessageBoxControl(mbcModel);
            var m = new Model {MessageBoxButton = button, Title = caption, Content = mbcontrol};

            var fx = new FxMessageWindow(m);
            fx.Owner = owner;
            fx.ShowInTaskbar = false;
            fx.ShowDialog();
            return fx.Result;
        }
 public MessageBoxControl(MessageBoxControlModel model)
 {
     InitializeComponent();
     DataContext = model;
 }
 public MessageBoxControl(MessageBoxControlModel model)
 {
     InitializeComponent();
     DataContext = model;
 }