// ----- Helper functions ----- #region Helper Functions private static void ProcessDialogCallback(Grid OverlayToRemove, DialogButtonCallback Callback, object CallbackData) { RemoveControl(OverlayToRemove); if (Callback != null) { Callback(CallbackData); } }
public static void OpenTextInputDialog(Grid ExistingGrid, string Title, string Body, DialogButtonCallback Callback) { Grid Overlay = DarkOverlayGrid(ExistingGrid); StackPanel sp = new StackPanel(); sp.HorizontalAlignment = HorizontalAlignment.Center; sp.VerticalAlignment = VerticalAlignment.Center; QuickAddTitleAndBody(sp, Title, Body); TextBox ti = new TextBox(); ti.HorizontalAlignment = HorizontalAlignment.Center; ti.VerticalAlignment = VerticalAlignment.Center; ti.TextAlignment = TextAlignment.Center; sp.Children.Add(ti); sp.Children.Add(QuickTextblock(" ", false)); List <DialogButton> buttons = new List <DialogButton>(); buttons.Add(new DialogButton(LangResources.CurLang.OK, Callback, ti)); buttons.Add(new DialogButton(LangResources.CurLang.Cancel, Callback, null)); sp.Children.Add(DialogButtonGrid(Overlay, buttons)); Overlay.Children.Add(sp); ti.Focus(); }
public DialogButton(string Text, DialogButtonCallback Callback, object CallbackData) { this.Text = Text; this.Callback = Callback; this.CallbackData = CallbackData; }