private void OpenDialog() { var owner = AssociatedObject as Window; var vm = Content as IDialog; _Dialog = DialogFactory.Create(vm.GetType()); _Dialog.WindowState = WindowState.Normal; _Dialog.WindowStartupLocation = WindowStartupLocation.CenterOwner; _Dialog.Closed += Closed; _Dialog.DataContext = vm; Debug.WriteLine($"{DateTime.Now:HH:mm:ss.fff}\tVM: {vm.GetType().Name}, Owner: {owner.GetType().Name}, Dialog: {_Dialog.GetType().Name}"); Dispatcher.BeginInvoke(new Action(() => { try { _Dialog.Owner = owner; _Dialog.ShowDialog(); } catch (Exception e) { Debug.WriteLine(e); } })); }
static AuthenticationDialogViewModel() { DialogFactory.Register(typeof(AuthenticationDialogViewModel), typeof(AuthenticationDialogWindow)); }
static MessageDialogViewModel() { DialogFactory.Register(typeof(MessageDialogViewModel), typeof(MessageDialogWindow)); }
static PasswordInputDialogViewModel() { DialogFactory.Register(typeof(PasswordInputDialogViewModel), typeof(PasswordInputDialogWindow)); }
static ConfirmDialogViewModel() { DialogFactory.Register(typeof(ConfirmDialogViewModel), typeof(ConfirmationDialogWindow)); }