예제 #1
0
        public void ShowDialog(IWindowViewModel viewModel, ResizeMode resizeMode)
        {
            viewModel.Closed = false;
            ClosableWindow window = CreateWindow(viewModel, resizeMode);

            window.OpenDialog();
        }
예제 #2
0
        private ClosableWindow CreateWindow(IWindowViewModel viewModel, ResizeMode resizeMode)
        {
            System.Windows.ResizeMode mode = GetMode(resizeMode);
            var window = new ClosableWindow(viewModel, mode);

            if (ownerWindow != null)
            {
                window.Owner = ownerWindow;
                window.WindowStartupLocation = WindowStartupLocation.CenterOwner;
            }
            else if (ownerForm != null)
            {
                var helper = new WindowInteropHelper(window);
                helper.Owner = ownerForm.Handle;
                window.WindowStartupLocation = WindowStartupLocation.CenterOwner;
            }

            return(window);
        }