private void UpdateTherapyPlace(TherapyPlace updatedTherapyPlace) { var placeListItem = TherapyPlaces.First(listItem => listItem.PlaceId == updatedTherapyPlace.Id); var placeType = dataCenter.GetTherapyPlaceType(updatedTherapyPlace.TypeId); placeListItem.Name = updatedTherapyPlace.Name; placeListItem.TypeIcon = GetIconForTherapyPlaceType(placeType.IconType); placeListItem.TypeName = placeType.Name; SelectedTherapyPlaceObject = updatedTherapyPlace; var updatedRoom = SelectedRoomObject.UpdateTherapyPlace(updatedTherapyPlace); UpdateRoom(updatedRoom); }
private void DoAddTherapyPlace() { var newTherapyPlace = TherapyPlaceCreateAndEditLogic.Create("noName"); var placeType = dataCenter.GetTherapyPlaceType(newTherapyPlace.TypeId); var newTherapyPlaceListItem = new TherapyPlaceDisplayData(newTherapyPlace.Name, placeType.ToString(), GetIconForTherapyPlaceType(placeType.IconType), newTherapyPlace.Id, SelectedRoom.DisplayedColor); TherapyPlaces.Add(newTherapyPlaceListItem); var updatedRoom = SelectedRoomObject.AddTherapyPlace(newTherapyPlace); UpdateRoom(updatedRoom); SelectedTherapyPlace = newTherapyPlaceListItem; }
private async void DoDeleteTherapyPlace() { var dialog = new UserDialogBox("", $"Therapyplatz [{SelectedTherapyPlace.Name}] wirklich löschen?", MessageBoxButton.OKCancel); var result = await dialog.ShowMahAppsDialog(); if (result == MessageDialogResult.Affirmative) { var therapyPlaceToDelete = SelectedTherapyPlace; var updatedRoom = SelectedRoomObject.RemoveTherapyPlace(therapyPlaceToDelete.PlaceId); UpdateRoom(updatedRoom); TherapyPlaces.Remove(SelectedTherapyPlace); SelectedTherapyPlace = null; } }