/// <summary> /// Creates a child window InputDialog inside of the current window dialog container. /// </summary> /// <param name="window">The window.</param> /// <param name="title">The title of the MessageDialog.</param> /// <param name="message">The message contained within the MessageDialog.</param> /// <param name="settings">Optional Settings that override the global metro dialog settings.</param> /// <param name="overlayFillBehavior">The overlay fill behavior.</param> /// <returns>The text that was entered or null (Nothing in Visual Basic) if the user cancelled the operation.</returns> public static Task <string> ShowChildWindowInputAsync(this Window window, string title, string message, ChildWindowDialogSettings settings = null, ChildWindowManager.OverlayFillBehavior overlayFillBehavior = ChildWindowManager.OverlayFillBehavior.WindowContent) { var dialog = new InputDialog(settings) { Title = title, Message = message, Input = settings?.DefaultText }; window.ShowChildWindowAsync <string>(dialog, overlayFillBehavior); return(dialog.WaitForButtonPressAsync().ContinueWith(y => { dialog.Dispatcher.Invoke(() => dialog.Close(y)); return y; }).Unwrap()); }
/// <summary> /// Creates a child window InputDialog on the given container. /// </summary> /// <param name="window">The window.</param> /// <param name="title">The title of the MessageDialog.</param> /// <param name="message">The message contained within the MessageDialog.</param> /// <param name="container">The container.</param> /// <param name="settings">Optional Settings that override the global metro dialog settings.</param> /// <returns>The text that was entered or null (Nothing in Visual Basic) if the user cancelled the operation.</returns> public static Task <string> ShowChildWindowInputAsync(this Window window, string title, string message, Panel container, ChildWindowDialogSettings settings = null) { var dialog = new InputDialog(settings) { Title = title, Message = message, Input = settings?.DefaultText }; window.ShowChildWindowAsync <string>(dialog, container); return(dialog.WaitForButtonPressAsync().ContinueWith(y => { dialog.Dispatcher.Invoke(() => dialog.Close(y)); return y; }).Unwrap()); }