예제 #1
0
        public static LocalizedMessageResult Show(string messageToShow, LocalizedMessageButton button)
        {
            LocalizedMessageBox messagebox = new LocalizedMessageBox(messageToShow, string.Empty, button, LocalizedMessageIcon.None);

            messagebox.ShowDialog();
            return(messagebox._result);
        }
예제 #2
0
 private LocalizedMessageBox(string messageToShow, string caption, LocalizedMessageButton button, LocalizedMessageIcon icon)
 {
     InitializeComponent();
     DataContext   = this;
     MessageToShow = messageToShow;
     SetFontSize(messageToShow.ToCharArray().Length);
     Caption = caption;
     InitializeButton(button);
     InitializeIcon(icon);
     KeyDown += LocalizedMessageBox_KeyDown;
 }
예제 #3
0
        private void InitializeButton(LocalizedMessageButton button)
        {
            switch (button)
            {
            case LocalizedMessageButton.YesNo:
                SetButtons(new Button[] { Button_1, Button_2 });
                Button_1.Content = Properties.Resources.YES;
                Button_2.Content = Properties.Resources.NO;
                Button_1.Click  += (sender, e) => { _result = LocalizedMessageResult.Yes; Close(); };
                Button_2.Click  += (sender, e) => { _result = LocalizedMessageResult.No; Close(); };
                break;

            case LocalizedMessageButton.YesNoCancel:
                SetButtons(new Button[] { Button_1, Button_2, Button_3 });
                Button_1.Content = Properties.Resources.YES;
                Button_2.Content = Properties.Resources.NO;
                Button_3.Content = Properties.Resources.Cancel;
                Button_1.Click  += (sender, e) => { _result = LocalizedMessageResult.Yes; Close(); };
                Button_2.Click  += (sender, e) => { _result = LocalizedMessageResult.No; Close(); };
                Button_3.Click  += (sender, e) => { _result = LocalizedMessageResult.Cancel; Close(); };
                break;

            case LocalizedMessageButton.OK:
                SetButtons(new Button[] { Button_1 });
                Button_1.Content = Properties.Resources.Ensure;
                Button_1.Click  += (sender, e) => { _result = LocalizedMessageResult.Yes; Close(); };
                break;

            case LocalizedMessageButton.OKCancel:
                SetButtons(new Button[] { Button_1, Button_2 });
                Button_1.Content = Properties.Resources.Ensure;
                Button_2.Content = Properties.Resources.Cancel;
                Button_1.Click  += (sender, e) => { _result = LocalizedMessageResult.Yes; Close(); };
                Button_2.Click  += (sender, e) => { _result = LocalizedMessageResult.No; Close(); };
                break;

            default:
                break;
            }
        }
예제 #4
0
        public static LocalizedMessageResult Show(string messageToShow, string caption = "", LocalizedMessageButton button = LocalizedMessageButton.OK, LocalizedMessageIcon icon = LocalizedMessageIcon.None)
        {
            LocalizedMessageBox messagebox = new LocalizedMessageBox(messageToShow, caption, button, icon);

            messagebox.ShowDialog();
            return(messagebox._result);
        }