public static IDialogAction ShowMessage(string title, string msg, Image img, IDialogAction[] actions) { sizetext_buttons = new int[actions.Length]; string[] acc = new string[actions.Length]; for (int i = 0; i < acc.Length; i++) { acc[i] = actions[i].GetTitle(); Size s = TextRenderer.MeasureText(acc[i],Control.DefaultFont); sizetext_buttons[i] = s.Width; } return ShowCusMessage(title, msg, img, acc, actions); }
private static IDialogAction ShowCusMessage(string title, string msg, Image img, string[] buttonNames, IDialogAction[] actions) { XMessageBox box = new XMessageBox(); box.actions = actions; box.InitializeComponent(msg, img, buttonNames); box.Text = title; box.DoAutoPos(); int total_width_btn = 0; for (int i = 0; i < sizetext_buttons.Length; i++) total_width_btn += sizetext_buttons[i]; box.MinimumSize = new Size(total_width_btn + ((margin_default + 6) * (sizetext_buttons.Length + 1)), 0); box.ShowDialog(); //box.Width = 5; box.Height = 5; return box.result; }
public bool CanExecuteCommand(IDialogAction command) { return(true); }
public ExceptionHandlingDialogAction(IDialogAction dialogAction, Action<Exception> errorAction) { _dialogAction = dialogAction; _errorAction = errorAction; }
private void userClick(object sender, EventArgs e) { if (this.actions != null) { try { IDialogAction SelectedAction = (IDialogAction)((SimpleButton)sender).Tag; this.result = SelectedAction; if (SelectedAction != null) { SelectedAction.Action(); } } catch (Exception ex) { } } this.Close(); }
private void SetupEdit(Type type) { Condition = (IDialogAction) Activator.CreateInstance(type); propertyGrid1.SelectedObject = Condition; }
public DialogActionExecuteEventArgs(IDialogAction action) { Action = action; }
/// <summary>Cho phép hiện thị một thông báo và thêm nhiều nút xử lý khác. /// </summary> public static IDialogAction ShowMessage(string title, string msg, Image img, IDialogAction[] actions) { return XMessageBox.ShowMessage( title, msg, img, actions); }