private void SetButtons(MsgButtons buttons) { div_footer.Visible = true; switch (buttons) { case MsgButtons.None: div_footer.Visible = false; break; case MsgButtons.OK: btn_ok.Visible = true; btn_accept.Visible = btn_ignore.Visible = false; break; case MsgButtons.YesNo: btn_ok.Visible = false; btn_accept.Visible = btn_ignore.Visible = true; break; case MsgButtons.AllButtons: btn_ok.Visible = btn_accept.Visible = btn_ignore.Visible = true; break; default: break; } }
public void Show(string title, string message, MsgButtons buttons, DisplayState state, int timeout) { if (state == DisplayState.Hidden) { return; } this.lbl_title.Text = title; this.tbx_message.Text = message; this.btn_accept.Text = this.YesText; this.btn_ignore.Text = this.NoText; this.btn_ok.Text = this.OkText; SetButtons(buttons); SetState(state); if (timeout > 0) { this.timeout = timeout; this.timer1.Enabled = true; } else { this.timeout = 0; this.timer1.Enabled = false; lbl_timout.Visible = false; } this.BringToFront(); }
internal void TranslateMouseDragged(NSEvent e, MsgButtons button) { var msg = TranslateMouseCore(e, out bool client); msg.wParam = (IntPtr)(e.ModifierFlags.ToWParam() | (uint)button); msg.message = client ? Msg.WM_MOUSEMOVE : Msg.WM_NCMOUSEMOVE; Application.SendMessage(ref msg); }
internal void TranslateMouseDragged(NSEvent e, MsgButtons button) { // Dragging events get delivered to the view where dragging started. // We have to redirect them to the view under the cursor (maybe in another window). var msg = TranslateMouseCore(e, out bool client, MouseTarget()); msg.wParam = (IntPtr)(e.ModifierFlags.ToWParam() | (uint)button); msg.message = client ? Msg.WM_MOUSEMOVE : Msg.WM_NCMOUSEMOVE; Application.SendMessage(ref msg); }
public static MsgResult Show( string mainInstruction, string content, MsgIcon icon, MsgButtons buttons, MsgResult defaultButton = MsgResult.None) { try { using (TaskDialog <MsgResult> td = new TaskDialog <MsgResult>()) { td.AllowCancel = false; td.DefaultButton = defaultButton; td.MainIcon = icon; if (content == null) { if (mainInstruction.Length < 80) { td.MainInstruction = mainInstruction; } else { td.Content = mainInstruction; } } else { td.MainInstruction = mainInstruction; td.Content = content; } if (buttons == MsgButtons.OkCancel) { td.AddButton("OK", MsgResult.OK); td.AddButton("Cancel", MsgResult.Cancel); } else { td.CommonButtons = buttons; } return(td.Show()); } } catch (Exception e) { return((MsgResult)MessageBox.Show(e.GetType().Name + "\n\n" + e.Message + "\n\n" + e, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error)); } }
public static MsgButtons Show(string msg, string title, MsgButtons buttons, string suppress) { var box = new MessageBox(); box.msg.Text = msg; box.Title = title; box.ok.Visibility = buttons.HasFlag(MsgButtons.OK) ? Visibility.Visible : Visibility.Collapsed; box.cancel.Visibility = buttons.HasFlag(MsgButtons.Cancel) ? Visibility.Visible : Visibility.Collapsed; box.yes.Visibility = buttons.HasFlag(MsgButtons.Yes) ? Visibility.Visible : Visibility.Collapsed; box.no.Visibility = buttons.HasFlag(MsgButtons.No) ? Visibility.Visible : Visibility.Collapsed; box.all.Visibility = buttons.HasFlag(MsgButtons.All) ? Visibility.Visible : Visibility.Collapsed; box.next.Visibility = buttons.HasFlag(MsgButtons.Next) ? Visibility.Visible : Visibility.Collapsed; box.prev.Visibility = buttons.HasFlag(MsgButtons.Previous) ? Visibility.Visible : Visibility.Collapsed; box.ShowDialog(); return(box.Result); }
/// <summary> /// A public static method with a return value of System.Windows.Forms.DialogResult /// </summary> /// <param name="_windowTitle"></param> /// <param name="_mainInstruction"></param> /// <param name="_msgButtons"></param> /// <param name="_msgIcons"></param> // Optional parameter with default value of None /// <param name="_content"></param> // Optional parameter with default value of Empty /// <returns></returns> public static DialogResult ShowMessage(string _windowTitle, string _mainInstruction, MsgButtons _msgButtons, MsgIcons _msgIcons = MsgIcons.None, string _content = "") { // Creates a new instance of MainForm so we can set the properties of the controls MainForm main = new MainForm(); // Sets the initial height of the form main.Height = 157; // Sets Window Title main.Text = _windowTitle; // Sets MainInstruction main.mainInstruction.Text = _mainInstruction; // Sets Content main.content.Text = _content; // Sets the properties of the buttons based on which enum was provided switch (_msgButtons) { // Button1 is the left button // Button2 is the right button case MsgButtons.OK: main.Button1.Visible = false; main.Button2.DialogResult = DialogResult.OK; main.Button2.Text = "OK"; main.AcceptButton = main.Button2; main.Button2.TabIndex = 0; main.ActiveControl = main.Button2; break; case MsgButtons.OKCancel: main.Button1.DialogResult = DialogResult.OK; main.Button2.DialogResult = DialogResult.Cancel; main.Button1.Text = "OK"; main.Button2.Text = "Cancel"; main.AcceptButton = main.Button2; main.Button1.TabIndex = 1; main.Button2.TabIndex = 0; main.ActiveControl = main.Button2; break; case MsgButtons.YesNo: main.Button1.DialogResult = DialogResult.Yes; main.Button2.DialogResult = DialogResult.No; main.Button1.Text = "Yes"; main.Button2.Text = "No"; main.AcceptButton = main.Button2; main.Button1.TabIndex = 1; main.Button2.TabIndex = 0; main.ActiveControl = main.Button2; break; default: break; } // Sets the Image for the PictureBox based on which enum was provided if (_msgIcons != MsgIcons.None) { main.msgIcon.Visible = true; switch (_msgIcons) { case MsgIcons.Question: main.msgIcon.Image = SystemIcons.Question.ToBitmap(); break; case MsgIcons.Info: main.msgIcon.Image = SystemIcons.Information.ToBitmap(); break; case MsgIcons.Warning: main.msgIcon.Image = SystemIcons.Warning.ToBitmap(); break; case MsgIcons.Error: main.msgIcon.Image = SystemIcons.Error.ToBitmap(); break; case MsgIcons.Shield: main.msgIcon.Image = SystemIcons.Shield.ToBitmap(); break; default: break; } } else { main.msgIcon.Visible = false; } // Shows the message and gets the result selected by the user return(main.ShowDialog()); }
public static MsgResult ShowQuestion( string mainInstruction, string content, MsgButtons buttons = MsgButtons.OkCancel) { return(Msg.Show(mainInstruction, content, MsgIcon.None, buttons, MsgResult.None)); }
private void prev_Click(object sender, RoutedEventArgs e) { Result = MsgButtons.Previous; DialogResult = true; }
private void all_Click(object sender, RoutedEventArgs e) { Result = MsgButtons.All; DialogResult = true; }
private void no_Click(object sender, RoutedEventArgs e) { Result = MsgButtons.No; DialogResult = false; }
private void yes_Click(object sender, RoutedEventArgs e) { Result = MsgButtons.Yes; DialogResult = true; }
private void cancel_Click(object sender, RoutedEventArgs e) { Result = MsgButtons.Cancel; DialogResult = false; }
public MsgBox.MsgResult UserMsgBox(MsgTypes msgType, MsgButtons msgButtons, MsgResult defaultMsgResult, string msg) { return UserMsgBox(SharedObjects.MainWin, msgType, msgButtons, defaultMsgResult, msg); }
public MsgBox.MsgResult UserMsgBox(MsgTypes msgType, MsgButtons msgButtons, MsgResult defaultMsgResult, string msg) { return(UserMsgBox(SharedObjects.MainWin, msgType, msgButtons, defaultMsgResult, msg)); }