Ejemplo n.º 1
0
        public CustomMessageBox(Window windowSender, string text, string title, CustomMessageBoxTypes type, string yesText, string noText)
        {
            InitializeComponent();
            this.Title = title;
            this.Owner = windowSender;
            if (windowSender == null)
            {
                this.Background            = new SolidColorBrush(Color.FromArgb(0, 0, 0, 0));
                this.WindowStartupLocation = WindowStartupLocation.CenterScreen;
            }
            titleLabel.Text = title;
            textLabel.Text  = text;
            LinearGradientBrush typeColor = null;
            string iconUri = "";

            NoButton.Content  = noText;
            YesButton.Content = yesText;
            if (noText == "")
            {
                setJustOkButton();
            }
            switch (type)
            {
            case CustomMessageBoxTypes.Error:
                typeColor = redGradientBrush;
                iconUri   = "/images/CustomMessageBox/errorIcon.png";
                break;

            case CustomMessageBoxTypes.Stop:
                typeColor = redGradientBrush;
                iconUri   = "/images/CustomMessageBox/stopIcon.png";
                break;

            case CustomMessageBoxTypes.Warning:
                typeColor = yellowGradientBrush;
                iconUri   = "/images/CustomMessageBox/warningIcon.png";
                break;

            case CustomMessageBoxTypes.Question:
                typeColor = blueGradientBrush;
                iconUri   = "/images/CustomMessageBox/questionIcon.png";
                break;

            case CustomMessageBoxTypes.Success:
                typeColor = greenGradientBrush;
                iconUri   = "/images/CustomMessageBox/successIcon.png";
                break;
            }
            TopBar.Background     = typeColor;
            strip.Fill            = typeColor;
            titleLabel.Foreground = typeColor;
            iconImage.Source      = new BitmapImage(new Uri(iconUri, UriKind.Relative));
        }
Ejemplo n.º 2
0
        public static Boolean ShowDialog(Window windowSender, string text, string title, CustomMessageBoxTypes type, string yseText, string noText)
        {
            CustomMessageBox customMessage = new CustomMessageBox(windowSender, text, title, type, yseText, noText);

            return((Boolean)customMessage.ShowDialog());
        }