Exemplo n.º 1
0
        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);
                }
            }));
        }
Exemplo n.º 2
0
 static AuthenticationDialogViewModel()
 {
     DialogFactory.Register(typeof(AuthenticationDialogViewModel), typeof(AuthenticationDialogWindow));
 }
Exemplo n.º 3
0
 static MessageDialogViewModel()
 {
     DialogFactory.Register(typeof(MessageDialogViewModel), typeof(MessageDialogWindow));
 }
 static PasswordInputDialogViewModel()
 {
     DialogFactory.Register(typeof(PasswordInputDialogViewModel), typeof(PasswordInputDialogWindow));
 }
Exemplo n.º 5
0
 static ConfirmDialogViewModel()
 {
     DialogFactory.Register(typeof(ConfirmDialogViewModel), typeof(ConfirmationDialogWindow));
 }