Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        private void OnDialogDismissFinished()
        {
            DialogsManager.CurrentlyDisplayedDialog = null;

            DialogShown?.Invoke(this, EventArgs.Empty);
            _showSemaphore?.Release();
            _showSemaphore = null;
        }
Exemplo n.º 3
0
        /// <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);
        }
Exemplo n.º 4
0
        /// <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);
        }
Exemplo n.º 5
0
 /// <summary>
 /// Starts the dialog and displays it on screen.
 /// </summary>
 public new void Show()
 {
     base.Show();
     DialogShown?.Invoke(this, EventArgs.Empty);
 }
Exemplo n.º 6
0
 private void OnDialogShown(DialogEventArgs e)
 {
     DialogShown?.Invoke(this, e);
 }
Exemplo n.º 7
0
 public void OnDialogShown()
 {
     DialogShown?.Invoke(this, null);
 }