public void Close(IChildViewModel viewModel) { var window = _openedWindows[viewModel.GetType()]; _openedWindows.Remove(viewModel.GetType()); Application.Current.Dispatcher.BeginInvoke(new Action(() => window.Close()), null); }
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); }
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); }
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(); }
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(); } }
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; }
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); }