public MessageButton(MessageButtonType type, string title, string url = "", string payload = "") { Type = type; Title = title; Url = url; Payload = payload; }
public bool Confirm(string message, string title, MessageButtonType messageButtonType, string determineText, string cancelText, double button1Width, double button2Width) { return(MessageWindow.ShowDialog(title, message, MessageBoxType.Confirm, null, MessageButtonType.Custom, determineText, cancelText, button1Width, button2Width).Value); }
public MessageBoxGump(int w, int h, string message, Action <bool> action, bool hasBackground = false, MessageButtonType menuType = MessageButtonType.OK) : base(0, 0) { CanMove = true; CanCloseWithRightClick = false; CanCloseWithEsc = false; AcceptMouseInput = true; AcceptKeyboardInput = true; IsModal = true; LayerOrder = UILayer.Over; WantUpdateSize = false; Width = w; Height = h; _action = action; Add ( new ResizePic(0x0A28) { Width = w, Height = h } ); if (hasBackground) { ResizePic background = new ResizePic(3000) { X = X + 30, Y = Y + 40, Width = Width - 60, Height = Height - 100 }; Add(background); } Add ( new Label ( message, false, 0x0386, Width - 90, 1 ) { X = 40, Y = 45 } ); X = (Client.Game.Window.ClientBounds.Width - Width) >> 1; Y = (Client.Game.Window.ClientBounds.Height - Height) >> 1; // OK Button b; Add ( b = new Button(0, 0x0481, 0x0483, 0x0482) { Y = Height - 45, ButtonAction = ButtonAction.Activate } ); b.X = (Width - b.Width) >> 1; if (menuType == MessageButtonType.OK_CANCEL) { Button bCancel; Add ( bCancel = new Button(1, 0x047E, 0x047F, 0x0480) { Y = Height - 45, ButtonAction = ButtonAction.Activate } ); b.X = Width / 2 - bCancel.Width; bCancel.X = Width / 2 - bCancel.Width; bCancel.X += b.Width + 5; } WantUpdateSize = false; UIManager.KeyboardFocusControl = this; UIManager.KeyboardFocusControl.SetKeyboardFocus(); }
public bool?ShowDialog(string title, string message, MessageBoxType messageBoxType, Geometry logoPath = null, MessageButtonType messageButtonType = MessageButtonType.Default, string determineText = "是", string cancelText = "否", double button1Width = 60, double button2Width = 60) { if (MessageView is Window) { Window view = Activator.CreateInstance(MessageView.WindowType) as Window; MessageView = view as IMessageView; MessageView.Title = title; MessageView.Message = message; MessageView.MessageBoxType = messageBoxType; MessageView.LogoPath = logoPath; MessageView.MessageButtonType = messageButtonType; MessageView.DetermineText = determineText; MessageView.CancelText = cancelText; MessageView.Button1Width = button1Width; MessageView.Button2Width = button2Width; (MessageView as Window).Owner = WindowOperation.GetCurrentActivatedWindow(); return((MessageView as Window).ShowDialog()); } else { return(null); } }