public void ToggleFavoriteState(CatalogItem catalogItem, CatalogItemAdapter adapter) { if (!favoritesCatalogItems.Contains(catalogItem)) { favoritesCatalogItems.Add(catalogItem); catalogItem.SetFavorite(true); } else { favoritesCatalogItems.Remove(catalogItem); catalogItem.SetFavorite(false); } adapter?.SetFavorite(catalogItem.IsFavorite()); }
public void ToggleFavoriteState(SceneObject sceneObject, CatalogItemAdapter adapter) { if (!favoritesSceneObjects.Contains(sceneObject)) { favoritesSceneObjects.Add(sceneObject); sceneObject.isFavorite = true; } else { favoritesSceneObjects.Remove(sceneObject); sceneObject.isFavorite = false; } adapter.SetFavorite(sceneObject.isFavorite); }