コード例 #1
0
 public override object Convert(object value, Type targetType, object parameter, CultureInfo culture)
 {
     if (this.BindableConverterParameter != null && this.BindableConverterParameter is IMessageBoxModel && value is NotificationButtons)
     {
         NotificationButtons valueEnum     = (NotificationButtons)value;
         IMessageBoxModel    parameterEnum = (IMessageBoxModel)this.BindableConverterParameter;
         return(valueEnum == parameterEnum.DefaultButton);
     }
     return(false);
 }
コード例 #2
0
ファイル: MessageBox.cs プロジェクト: alxnull/adonis-ui
        /// <summary>
        /// Displays a message box in front of the specified window. The message box is configured like specified in the <see cref="IMessageBoxModel"/> and returns a result.
        /// </summary>
        /// <param name="owner">A <see cref="Window"/> that represents the owner window of the message box.</param>
        /// <param name="messageBoxModel">An <see cref="IMessageBoxModel"/> that configures the appearance and behavior of the message box.</param>
        /// <returns>A <see cref="MessageBoxResult"/> value that specifies which message box button is clicked by the user.</returns>
        public static MessageBoxResult Show(Window owner, IMessageBoxModel messageBoxModel)
        {
            var messageBox = new MessageBoxWindow
            {
                Owner     = owner,
                ViewModel = messageBoxModel,
            };

            messageBox.ShowDialog();
            return(messageBoxModel.Result);
        }
コード例 #3
0
ファイル: MessageBox.cs プロジェクト: alxnull/adonis-ui
        /// <summary>
        /// Displays a message box that is configured like specified in the <see cref="IMessageBoxModel"/> and that returns a result.
        /// </summary>
        /// <param name="messageBoxModel">An <see cref="IMessageBoxModel"/> that configures the appearance and behavior of the message box.</param>
        /// <returns>A <see cref="MessageBoxResult"/> value that specifies which message box button is clicked by the user.</returns>
        public static MessageBoxResult Show(IMessageBoxModel messageBoxModel)
        {
            Window activeWindow = Application.Current?.Windows.OfType <Window>().FirstOrDefault(x => x.IsActive);

            return(Show(activeWindow, messageBoxModel));
        }