private DialogResult ShowWindow(object model) { object lastAction = null; object lastActionParameter = null; var window = new DialogWindow(model, context, options); if (options.TopMost) { window.Topmost = true; } window.Form.OnAction += (s, e) => { lastAction = e.ActionContext.Action; lastActionParameter = e.ActionContext.ActionParameter; }; window.ShowDialog(); if (options.BringToFront) { window.Activate(); window.Focus(); } return(new DialogResult(window.Form.Value, lastAction, lastActionParameter)); }
private DialogResult ShowWindow(object model) { return(Application.Current.Dispatcher.Invoke(() => { object lastAction = null; object lastActionParameter = null; var window = new DialogWindow(model, context, options); if (options.TopMost) { window.Topmost = true; } window.Form.OnAction += (s, e) => { lastAction = e.ActionContext.Action; lastActionParameter = e.ActionContext.ActionParameter; }; window.Owner = Application.Current.MainWindow; window.ShowDialog(); if (options.BringToFront) { window.Activate(); window.Focus(); Keyboard.Focus(window); } return new DialogResult(window.Form.Value, lastAction, lastActionParameter); })); }
public static void DialogWindow(Dialog dialog) { if (!DialogWindowFocus(dialog)) { DialogWindow dialogWindow = new DialogWindow(dialog); dialogWindow.Show(); dialogWindow.Activate(); } }