/// <inheritdoc /> public void Show(IDialogModel dialogModel) { var dialog = CreateDialogWindow(dialogModel); _windowStack.Push(dialog); dialog.Show(); }
public static bool?ShowDialog(Window owner, IDialogModel model) { var headerViewModel = new DialogHeaderMessageViewModel(model.Message); IDialogFooterViewModel footerViewModel; if (model.Buttons == DialogButtons.YesNo) { footerViewModel = new DialogFooterYesNoViewModel(model.Buttons); } else if (model.Buttons == DialogButtons.Ok) { footerViewModel = new DialogFooterOkViewModel(model.Buttons); } else { throw new NotImplementedException("This type of buttons is not implemented yet"); } var dialogViewModel = new DialogViewModel(model.Caption, headerViewModel, footerViewModel); var dialog = new DialogWindow() { DataContext = dialogViewModel, Owner = owner }; return(dialog.ShowDialog()); }
public static Task <bool?> ShowDialogAsync(IDialogModel model) { return(GO.Dispatch(delegate { var dialog = new GenericDialog { }; dialog.NotifyWindowManager(); return dialog.ShowDialogWithModelAsync(model); })); }
public void ShowDialogAsync <T>(IDialogModel model, Action closed = null) where T : IDialogWindow, new() { IDialogWindow dialog = CreateDialog <T>(model, closed); if (model.IsModal) { ShowModalDialog(dialog); } else { ShowModalessDialog(dialog); } }
public void ShowDialog <T>(IDialogModel model, Action closed = null) where T : IDialogWindow, new() { IDialogWindow dialog = CreateDialog <T>(model, closed); if (model.IsModal) { dialog.ShowDialog(); } else { dialog.Show(); } }
private Window CreateDialogWindow(IDialogModel dialogModel) { var window = new DialogWindow { DataContext = dialogModel }; window.SetBinding(Window.TitleProperty, new Binding(nameof(dialogModel.Title)) { Mode = BindingMode.OneWay, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged }); return(window); }
public async Task <bool?> ShowDialogWithModelAsync(IDialogModel model) { if (model == null) { throw new ArgumentNullException(nameof(model), $"{nameof(model)} is null."); } Model = model; var result = await Dispatcher.InvokeAsync(ShowDialog); Model = null; return(result); }
private IDialogWindow CreateDialog <T>(IDialogModel model, Action closed) where T : IDialogWindow, new() { IDialogWindow dialog = new T { Model = model }; model.IsShown = true; model.RequestClose += (s, e) => dialog.Close(); if (closed != null) { dialog.Closed += (s, e) => closed(); } return(dialog); }
/// <inheritdoc /> public bool?ShowDialog(IDialogModel dialogModel) { var dialog = CreateDialogWindow(dialogModel); if (_windowStack.Any()) { dialog.Owner = _windowStack.Peek(); dialog.WindowStartupLocation = WindowStartupLocation.CenterOwner; } _windowStack.Push(dialog); try { return(dialog.ShowDialog()); } finally { _windowStack.Pop(); } }
public bool?ShowDialog(IDialogModel dataContext, Style style) { DialogWindow dialog = CreateDialog(dataContext, style, true); return(dialog.ShowDialog()); }
public bool?ShowDialog(IDialogModel dataContext) { return(ShowDialog(dataContext, null)); }
public void Show(IDialogModel dataContext, Style style) { DialogWindow dialog = CreateDialog(dataContext, style, false); dialog.Show(); }
public void Show(IDialogModel dataContext) { Show(dataContext, null); }