public DialogResult ShowDialog(string title, IDialogViewModel viewModel) { if (viewModel == null) { throw new ArgumentNullException(nameof(viewModel)); } var window = new DialogWindow { Title = title, Owner = Application.Current.MainWindow, DataContext = viewModel }; try { DialogShown?.Invoke(this, EventArgs.Empty); window.ShowDialog(); viewModel.Close(window.Result); } finally { DialogClosed?.Invoke(this, EventArgs.Empty); } return(window.Result); }
private void OnDialogDismissFinished() { DialogsManager.CurrentlyDisplayedDialog = null; DialogShown?.Invoke(this, EventArgs.Empty); _showSemaphore?.Release(); _showSemaphore = null; }
/// <summary> /// Shows the dialog with given parameter. /// </summary> /// <param name="parameter">Parameter which can be passed to dialog's ViewModel.</param> public void Show(object parameter = null) { DialogsManager.CurrentlyDisplayedDialog = this; DialogWillShow?.Invoke(this, EventArgs.Empty); Parameter = parameter; Show(ConfiguredFragmentManager, FragmentTag); OnShown(); DialogShown?.Invoke(this, EventArgs.Empty); }
/// <summary> /// Shows the dialog with given parameter. /// </summary> /// <param name="parameter">Parameter which can be passed to dialog's ViewModel.</param> public async void Show(object parameter = null) { DialogsManager.CurrentlyDisplayedDialog = this; DialogWillShow?.Invoke(this, EventArgs.Empty); Parameter = parameter; await base.ShowAsync(ContentDialogPlacement.Popup); OnShown(); DialogShown?.Invoke(this, EventArgs.Empty); }
/// <summary> /// Starts the dialog and displays it on screen. /// </summary> public new void Show() { base.Show(); DialogShown?.Invoke(this, EventArgs.Empty); }
private void OnDialogShown(DialogEventArgs e) { DialogShown?.Invoke(this, e); }
public void OnDialogShown() { DialogShown?.Invoke(this, null); }