private void RemoveUser_OnClick(object sender, RoutedEventArgs e) { if (UsersListView.SelectedItem is UserDataGetter userData) { try { workShiftList.RemoveEmployeeWholeRange(usersList.GetUser(userData.Username)); usersList.RemoveUser(userData.Username); ShowUsers(); ShowWorkShift(); } catch (UserDoesNotExistException exception) { MessageBox.Show(exception.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } } }