public static void ShowMessage(DialogPopupDelegate popupDelegate, String format, params Object[] args) { String message = StringUtils.TryFormat(format, args); DialogPopup popup = new DialogPopup(popupDelegate, "Message", message, ButtonOk); Application.RootController().GetCurrentController().StartPopup(popup); }
public DialogPopup(DialogPopupDelegate popupDelegate, String title, String message, PopupButton cancelButton, params PopupButton[] buttons) { this.popupDelegate = popupDelegate; AddView(new RectView(0, 0, width, height, new Color(0.0f, 0.0f, 0.0f, 0.25f), Color.Black)); RectView frameView = new RectView(0, 0, 0.75f * width, 0, new Color(0.0f, 0.0f, 0.0f, 0.75f), Color.Black); View content = new View(); content.width = frameView.width - 2 * 50; content.alignX = content.alignY = View.ALIGN_CENTER; Font font = Helper.fontSystem; // title TextView titleView = new TextView(font, title); titleView.alignX = titleView.parentAlignX = View.ALIGN_CENTER; content.AddView(titleView); // message TextView messageView = new TextView(font, message, (int)content.width); messageView.alignX = messageView.parentAlignX = View.ALIGN_CENTER; content.AddView(messageView); // buttons Button button = new TempButton(cancelButton.title); button.id = (int)cancelButton.id; button.buttonDelegate = OnButtonPress; button.alignX = View.ALIGN_CENTER; button.parentAlignX = View.ALIGN_CENTER; SetCancelButton(button); content.AddView(button); content.LayoutVer(10); content.ResizeToFitViewsVer(); frameView.AddView(content); frameView.ResizeToFitViewsVer(20, 20); frameView.alignX = frameView.alignY = frameView.parentAlignX = frameView.parentAlignY = View.ALIGN_CENTER; AddView(frameView); content.x = 0.5f * frameView.width; content.y = 0.5f * frameView.height; }