예제 #1
0
        /// <summary>
        /// Translates a <see cref="CustomDialogButtons"/> into a standard WPF <see cref="MessageBoxButton"/>.
        /// This abstraction allows for different frameworks to use the same ViewModels but supply
        /// alternative implementations of core service interfaces
        /// </summary>
        /// <param name="btn">The button type to be displayed.</param>
        /// <returns>Returns a standard WPF <see cref="MessageBoxButton"/>.</returns>
        private static MessageBoxButton GetButton(CustomDialogButtons btn)
        {
            MessageBoxButton button = MessageBoxButton.OK;

            switch (btn)
            {
            case CustomDialogButtons.Ok:
                button = MessageBoxButton.OK;
                break;

            case CustomDialogButtons.OkCancel:
                button = MessageBoxButton.OKCancel;
                break;

            case CustomDialogButtons.YesNo:
                button = MessageBoxButton.YesNo;
                break;

            case CustomDialogButtons.YesNoCancel:
                button = MessageBoxButton.YesNoCancel;
                break;
            }

            return(button);
        }
        /// <summary>
        ///     Translates a CustomDialogButtons into a standard WPF System.Windows.MessageBox MessageBoxButton.
        ///     This abstraction allows for different frameworks to use the same ViewModels but supply
        ///     alternative implementations of core service interfaces
        /// </summary>
        /// <param name="btn">The button type to be displayed.</param>
        /// <returns>A standard WPF System.Windows.MessageBox MessageBoxButton</returns>
        private MessageBoxButton getButton(CustomDialogButtons btn)
        {
            var button = MessageBoxButton.OK;

            switch (btn)
            {
            case CustomDialogButtons.OK:
                button = MessageBoxButton.OK;
                break;

            case CustomDialogButtons.OKCancel:
                button = MessageBoxButton.OKCancel;
                break;

            case CustomDialogButtons.YesNo:
                button = MessageBoxButton.YesNo;
                break;

            case CustomDialogButtons.YesNoCancel:
                button = MessageBoxButton.YesNoCancel;
                break;
            }

            return(button);
        }
예제 #3
0
        /// <summary>
        /// Shows a standard System.Windows.MessageBox using the parameters requested
        /// but will return a translated result to enable adhere to the IMessageBoxService
        /// implementation required.
        ///
        /// This abstraction allows for different frameworks to use the same ViewModels but supply
        /// alternative implementations of core service interfaces
        /// </summary>
        /// <param name="message">The message to be displayed.</param>
        /// <param name="icon">The icon to be displayed.</param>
        /// <param name="button"></param>
        /// <returns>CustomDialogResults results to use</returns>
        private CustomDialogResults ShowQuestionWithButton(string message,
                                                           CustomDialogIcons icon, CustomDialogButtons button)
        {
            MessageBoxResult result = MessageBox.Show(message, "Please confirm...",
                                                      GetButton(button), GetImage(icon));

            return(GetResult(result));
        }
예제 #4
0
        /// <summary>
        /// Shows a standard System.Windows.MessageBox using the parameters requested
        /// but will return a translated result to enable adhere to the IMessageBoxService
        /// implementation required.
        ///
        /// This abstraction allows for different frameworks to use the same ViewModels but supply
        /// alternative implementations of core service interfaces
        /// </summary>
        /// <param name="message">The message to be displayed.</param>
        /// <param name="caption">The caption of the message box window</param>
        /// <param name="icon">The icon to be displayed.</param>
        /// <param name="button"></param>
        /// <param name="defaultResult">Default result for the message box</param>
        /// <returns>CustomDialogResults results to use</returns>
        private CustomDialogResults ShowQuestionWithButton(string message, string caption,
                                                           CustomDialogIcons icon, CustomDialogButtons button, CustomDialogResults defaultResult)
        {
            MessageBoxResult result = MessageBox.Show(message, caption,
                                                      GetButton(button), GetImage(icon), GetResult(defaultResult));

            return(GetResult(result));
        }
        /// <summary>
        ///     Shows a standard System.Windows.MessageBox using the parameters requested
        ///     but will return a translated result to enable adhere to the IMessageBoxService
        ///     implementation required.
        ///     This abstraction allows for different frameworks to use the same ViewModels but supply
        ///     alternative implementations of core service interfaces
        /// </summary>
        /// <param name="message">The message to be displayed.</param>
        /// <param name="caption">The caption of the message box window</param>
        /// <param name="icon">The icon to be displayed.</param>
        /// <param name="button"></param>
        /// <returns>CustomDialogResults results to use</returns>
        private CustomDialogResults showQuestionWithButton(string message, string caption,
                                                           CustomDialogIcons icon, CustomDialogButtons button)
        {
            var result = MessageBox.Show(message, caption,
                                         getButton(button), getImage(icon));

            return(getResult(result));
        }
예제 #6
0
 public CustomDialog(string strInstructionHeading, string strInstructionText, CustomDialogButtons enumButtons , CustomDialogResults enumDefaultButton , CustomDialogIcons enumInstructionIcon )
 {
     _strInstructionHeading = strInstructionHeading;
     _strInstructionText = strInstructionText;
     _enumButtons = enumButtons;
     _enumDefaultButton = enumDefaultButton;
     _enumInstructionIcon = enumInstructionIcon;
 }
 public CustomDialogWindow(string strCaption, string strInstructionHeading, string strInstructionText, CustomDialogButtons enumButtons, CustomDialogResults enumDefaultButton, CustomDialogIcons enumInstructionIcon, int intButtonsDisabledDelay = 0)
 {
     _strCaption              = strCaption;
     _strInstructionHeading   = strInstructionHeading;
     _strInstructionText      = strInstructionText;
     _enumButtons             = enumButtons;
     _enumDefaultButton       = enumDefaultButton;
     _enumInstructionIcon     = enumInstructionIcon;
     _intButtonsDisabledDelay = intButtonsDisabledDelay;
 }
예제 #8
0
        /// <summary>
        /// Translates a CustomDialogButtons into a standard WPF System.Windows.MessageBox MessageBoxButton.
        /// This abstraction allows for different frameworks to use the same ViewModels but supply
        /// alternative implementations of core service interfaces
        /// </summary>
        /// <param name="btn">The button type to be displayed.</param>
        /// <returns>A standard WPF System.Windows.MessageBox MessageBoxButton</returns>
        private MessageBoxButton GetButton(CustomDialogButtons btn)
        {
            MessageBoxButton button = MessageBoxButton.OK;

            switch (btn)
            {
            case CustomDialogButtons.OK:
                button = MessageBoxButton.OK;
                break;

            case CustomDialogButtons.OKCancel:
                button = MessageBoxButton.OKCancel;
                break;
            }
            return(button);
        }
예제 #9
0
        /// <summary>
        /// Translates a CustomDialogButtons into a standard WPF System.Windows.MessageBox MessageBoxButton.
        /// This abstraction allows for different frameworks to use the same ViewModels but supply
        /// alternative implementations of core service interfaces
        /// </summary>
        /// <param name="btn">The button type to be displayed.</param>
        /// <returns>A standard WPF System.Windows.MessageBox MessageBoxButton</returns>
        private MessageBoxButton GetButton(CustomDialogButtons btn)
        {
            MessageBoxButton button = MessageBoxButton.OK;

            switch (btn)
            {
                case CustomDialogButtons.OK:
                    button = MessageBoxButton.OK;
                    break;
                case CustomDialogButtons.OKCancel:
                    button = MessageBoxButton.OKCancel;
                    break;
                case CustomDialogButtons.YesNo:
                    button = MessageBoxButton.YesNo;
                    break;
                case CustomDialogButtons.YesNoCancel:
                    button = MessageBoxButton.YesNoCancel;
                    break;
            }
            return button;
        }
예제 #10
0
 /// <summary>
 /// Shows a standard System.Windows.MessageBox using the parameters requested
 /// but will return a translated result to enable adhere to the IMessageBoxService
 /// implementation required. 
 /// 
 /// This abstraction allows for different frameworks to use the same ViewModels but supply
 /// alternative implementations of core service interfaces
 /// </summary>
 /// <param name="message">The message to be displayed.</param>
 /// <param name="icon">The icon to be displayed.</param>
 /// <param name="button"></param>
 /// <returns>CustomDialogResults results to use</returns>
 private CustomDialogResults ShowQuestionWithButton(string message,
     CustomDialogIcons icon, CustomDialogButtons button)
 {
     MessageBoxResult result = MessageBox.Show(message, "��ȷ��...",
         GetButton(button), GetImage(icon));
     return GetResult(result);
 }
 /// <summary>
 /// Shows a standard System.Windows.MessageBox using the parameters requested
 /// but will return a translated result to enable adhere to the IMessageBoxService
 /// implementation required. 
 /// 
 /// This abstraction allows for different frameworks to use the same ViewModels but supply
 /// alternative implementations of core service interfaces
 /// </summary>
 /// <param name="message">The message to be displayed.</param>
 /// <param name="caption">The caption of the message box window</param>
 /// <param name="icon">The icon to be displayed.</param>
 /// <param name="button"></param>
 /// <param name="defaultResult">Default result for the message box</param>
 /// <returns>CustomDialogResults results to use</returns>
 private CustomDialogResults ShowQuestionWithButton(string message, string caption,
     CustomDialogIcons icon, CustomDialogButtons button, CustomDialogResults defaultResult)
 {
     MessageBoxResult result = MessageBox.Show(message, caption,
         GetButton(button), GetImage(icon), GetResult(defaultResult));
     return GetResult(result);
 }
예제 #12
0
        /// <summary>
        /// Shows a standard System.Windows.MessageBox using the parameters requested
        /// but will return a translated result to enable adhere to the IMessageBoxService
        /// implementation required.
        ///
        /// This abstraction allows for different frameworks to use the same ViewModels but supply
        /// alternative implementations of core service interfaces
        /// </summary>
        /// <param name="message">The message to be displayed.</param>
        /// <param name="icon">The icon to be displayed.</param>
        /// <param name="button"></param>
        /// <returns>CustomDialogResults results to use</returns>
        private CustomDialogResults ShowQuestionWithButton(string message, CustomDialogIcons icon, CustomDialogButtons button)
        {
            var result = System.Windows.MessageBox.Show(message, "Bitte wählen Sie aus...", GetButton(button), GetImage(icon));

            return(GetResult(result));
        }
예제 #13
0
        /// <summary>
        ///   Shows a standard System.Windows.MessageBox using the parameters requested
        ///   but will return a translated result to enable adhere to the IMessageBoxService
        ///   implementation required.
        ///   This abstraction allows for different frameworks to use the same ViewModels but supply
        ///   alternative implementations of core service interfaces
        /// </summary>
        /// <param name="message">The message to be displayed.</param>
        /// <param name="heading">Heading for the message </param>
        /// <param name="icon">The icon to be displayed.</param>
        /// <param name="button"></param>
        /// <returns>CustomDialogResults results to use</returns>
        private CustomDialogResults ShowQuestionWithButton(string message, string heading, CustomDialogIcons icon, CustomDialogButtons button)
        {
            PreviewShowMessageBox(this, null);
            if (Owner != null)
            {
                var result = MessageBox.Show(Owner, message, heading, GetButton(button), GetImage(icon));
                MessageBoxClosed(this, null);

                return(GetResult(result));
            }
            else
            {
                var result = MessageBox.Show(message, heading, GetButton(button), GetImage(icon));
                MessageBoxClosed(this, null);

                return(GetResult(result));
            }
        }
예제 #14
0
        /// <summary>
        /// Shows a standard System.Windows.MessageBox using the parameters requested
        /// but will return a translated result to enable adhere to the IMessageBoxService
        /// implementation required.
        ///
        /// This abstraction allows for different frameworks to use the same ViewModels but supply
        /// alternative implementations of core service interfaces
        /// </summary>
        /// <param name="message">The message to be displayed.</param>
        /// <param name="icon">The icon to be displayed.</param>
        /// <param name="button"></param>
        /// <returns>CustomDialogResults results to use</returns>
        private static CustomDialogResults ShowQuestionWithButton(string message, CustomDialogIcons icon, CustomDialogButtons button)
        {
            MessageBoxResult result = MessageBox.Show(message, AxLanguage.Languages.REAplan_Confirmation, GetButton(button), GetImage(icon));

            return(GetResult(result));
        }