public void ShowAddUserDialog() { Window window = FindFromCollection("addUserDialog"); if (window == null) { window = new UserDialog(new UserViewModel(_userService.CreateUser())); AddToCollection("addUserDialog", window); } window.Closed += (sender, args) => DialogCollection.Remove("addUserDialog"); ActivateWindow(window); }
public void ShowEditUserDialog(UserViewModel userViewModel) { Window window = FindFromCollection(userViewModel.Model.Id); if (window == null) { window = new UserDialog(new UserViewModel(_userService.CreateCopy(userViewModel.Model))); AddToCollection(userViewModel.Model.Id, window); } window.Closed += (sender, args) => DialogCollection.Remove(((UserViewModel)((MetroWindow)sender).DataContext).Model.Id); ActivateWindow(window); }