コード例 #1
0
        public void Close(IChildViewModel viewModel)
        {
            var window = _openedWindows[viewModel.GetType()];
            _openedWindows.Remove(viewModel.GetType());

            Application.Current.Dispatcher.BeginInvoke(new Action(() => window.Close()), null);
        }
コード例 #2
0
        public void Close(IChildViewModel viewModel)
        {
            var window = _openedWindows[viewModel.GetType()];

            _openedWindows.Remove(viewModel.GetType());

            Application.Current.Dispatcher.BeginInvoke(new Action(() => window.Close()), null);
        }
コード例 #3
0
        public void Close(IChildViewModel viewModel, bool? result)
        {
            var tuple = _openedWindows[viewModel.GetType()];
            _openedWindows.Remove(viewModel.GetType());

            Application.Current.Dispatcher.BeginInvoke(new Action(() => tuple.Item1.Close()), null);

            tuple.Item2.SetResult(result);
        }
コード例 #4
0
        public void Close(IChildViewModel viewModel, bool?result)
        {
            var tuple = _openedWindows[viewModel.GetType()];

            _openedWindows.Remove(viewModel.GetType());

            Application.Current.Dispatcher.BeginInvoke(new Action(() => tuple.Item1.Close()), null);

            tuple.Item2.SetResult(result);
        }
コード例 #5
0
        private void ShowWindowInternal(IChildViewModel viewModel, bool showDialog)
        {
            var windowType = ViewTypeResolver.ResolveViewType(viewModel.GetType());
            var window = (Window)Activator.CreateInstance(windowType);

            _openedWindows.Add(viewModel.GetType(), window);

            window.DataContext = viewModel;
            if (showDialog)
                window.ShowDialog();
            else
                window.Show();
        }
コード例 #6
0
        private void ShowWindowInternal(IChildViewModel viewModel, bool showDialog)
        {
            var windowType = ViewTypeResolver.ResolveViewType(viewModel.GetType());
            var window     = (Window)Activator.CreateInstance(windowType);

            _openedWindows.Add(viewModel.GetType(), window);

            window.DataContext = viewModel;
            if (showDialog)
            {
                window.ShowDialog();
            }
            else
            {
                window.Show();
            }
        }
コード例 #7
0
        private Task<bool?> ShowWindowInternal(IChildViewModel viewModel, bool showDialog)
        {
            var tcs = new TaskCompletionSource<bool?>();

            var windowType = ViewTypeResolver.ResolveViewType(viewModel.GetType());
            var window = (Window) Activator.CreateInstance(windowType);

            _openedWindows.Add(viewModel.GetType(), new Tuple<Window, TaskCompletionSource<bool?>>(window, tcs));

            window.DataContext = viewModel;
            if (showDialog)
                window.ShowDialog();
            else
                window.Show();

            return tcs.Task;
        }
コード例 #8
0
        private Task <bool?> ShowWindowInternal(IChildViewModel viewModel, bool showDialog)
        {
            var tcs = new TaskCompletionSource <bool?>();

            var windowType = ViewTypeResolver.ResolveViewType(viewModel.GetType());
            var window     = (Window)Activator.CreateInstance(windowType);

            _openedWindows.Add(viewModel.GetType(), new Tuple <Window, TaskCompletionSource <bool?> >(window, tcs));

            window.DataContext = viewModel;
            if (showDialog)
            {
                window.ShowDialog();
            }
            else
            {
                window.Show();
            }

            return(tcs.Task);
        }