/// <summary> /// Shows the question dialog. /// </summary> /// <param name="control">The user control.</param> /// <param name="title">The message title.</param> /// <param name="msg">The message content.</param> /// <returns>True if the user agree</returns> public static async Task <Boolean> ShowQuestionDialog(this UserControl control, String title, String msg) { var metroWindow = MetroWindow.GetWindow(control) as MetroWindow; MessageDialogResult res = await metroWindow.ShowMessageAsync(title, msg, MessageDialogStyle.AffirmativeAndNegative); return(res == MessageDialogResult.Affirmative); }
private static MetroWindow GetMetroWindowFromScreen(this IViewAware screen) { var uiElement = screen?.GetView() as DependencyObject; if (uiElement == null) { throw new InvalidOperationException($"The view for {typeof(Screen).Name} is not a dependency object"); } var metroWindow = MetroWindow.GetWindow(uiElement) as MetroWindow; if (metroWindow == null) { throw new InvalidOperationException($"Unable to get metro window from screen '{typeof(Screen).Name}'"); } return(metroWindow); }
/// <summary> /// Gets the window. /// </summary> /// <param name="connector">The Oracle connector.</param> /// <returns>The Active Window</returns> public static MetroWindow GetWindow(this UserControl control) { return(MetroWindow.GetWindow(control) as MetroWindow); }
/// <summary> /// Shows a pop up dialog /// </summary> /// <param name="control">The user control.</param> /// <param name="title">The message title.</param> /// <param name="msg">The message content.</param> public static async Task ShowDialog(this UserControl control, String title, String msg) { var metroWindow = MetroWindow.GetWindow(control) as MetroWindow; MessageDialogResult res = await metroWindow.ShowMessageAsync(title, msg, MessageDialogStyle.Affirmative); }