/// <summary>
        /// Display message window with message, title and button (max 3). Returns myResult.
        /// </summary>
        /// <param name="message">Type string. Text to display as massage</param>
        /// <param name="caption">Type string. Text to display as title of window</param>
        /// <param name="buttons">Type array of string. Texts to display in new button controls</param>
        /// <returns></returns>
        public static MessageBoxResult Show(string message, string caption, MyMessageBoxButtons buttons)
        {
            MyMessageBox    box      = new MyMessageBox();
            ControlTemplate template = (ControlTemplate)box.FindResource("MyMessageButtonControlTemplate");

            box.messageText.Text             = message;
            box.messageBoxTitleLabel.Content = caption;


            switch (buttons)
            {
            case MyMessageBoxButtons.Ok:
                box.buttonsStackPanel.Children.Add(MyMessageBox.createButton("OK", template));
                break;

            case MyMessageBoxButtons.OkAnuluj:
                box.buttonsStackPanel.Children.Add(MyMessageBox.createButton("OK", template));
                box.buttonsStackPanel.Children.Add(MyMessageBox.createButton("ANULUJ", template));
                box.buttonsStackPanel.Children[1].Focus();
                break;

            case MyMessageBoxButtons.PominAnuluj:
                box.buttonsStackPanel.Children.Add(MyMessageBox.createButton("POMIŃ", template));
                box.buttonsStackPanel.Children.Add(MyMessageBox.createButton("ANULUJ", template));
                break;

            case MyMessageBoxButtons.Popraw:
                box.buttonsStackPanel.Children.Add(MyMessageBox.createButton("POPRAW", template));
                break;

            case MyMessageBoxButtons.PominPopraw:
                box.buttonsStackPanel.Children.Add(MyMessageBox.createButton("POPRAW", template));
                box.buttonsStackPanel.Children.Add(MyMessageBox.createButton("POMIŃ", template));
                break;

            case MyMessageBoxButtons.Usun:
                box.buttonsStackPanel.Children.Add(MyMessageBox.createButton("USUŃ", template));
                break;

            case MyMessageBoxButtons.UsunPopraw:
                box.buttonsStackPanel.Children.Add(MyMessageBox.createButton("POPRAW", template));
                box.buttonsStackPanel.Children.Add(MyMessageBox.createButton("USUŃ", template));
                break;

            case MyMessageBoxButtons.UsunAnuluj:
                box.buttonsStackPanel.Children.Add(MyMessageBox.createButton("ANULUJ", template));
                box.buttonsStackPanel.Children.Add(MyMessageBox.createButton("USUŃ", template));
                break;

            case MyMessageBoxButtons.TakNie:
                box.buttonsStackPanel.Children.Add(MyMessageBox.createButton("TAK", template));
                box.buttonsStackPanel.Children.Add(MyMessageBox.createButton("NIE", template));
                break;
            }
            box.ShowDialog();
            return(result);
        }
Example #2
0
        public static void Show(string message, string caption)
        {
            MyMessageBox    box      = new MyMessageBox();
            ControlTemplate template = (ControlTemplate)box.FindResource("MyMessageButtonControlTemplate");

            box.buttonsStackPanel.Children.Add(createButton("OK", template));
            box.messageText.Text             = message;
            box.messageBoxTitleLabel.Content = caption;
            box.ShowDialog();
        }
Example #3
0
        /// <summary>
        /// Display window with a message.
        /// </summary>
        /// <param name="message">Type System.String. Text to display as message</param>
        public static void Show(string message)
        {
            MyMessageBox    box      = new MyMessageBox();
            ControlTemplate template = (ControlTemplate)box.FindResource("MyMessageButtonControlTemplate");

            box.buttonsStackPanel.Children.Add(createButton("OK", template));
            box.buttonsStackPanel.Children[0].Focus();
            box.messageText.Text = message;
            box.ShowDialog();
        }