private void FillDeleteCategory(List <string> categoriesExceptAll) { DeleteCategoriesCollection.AddRange(categoriesExceptAll); if (DeleteCategoriesCollection.Count > 0) { DeleteCategoryEnabled = true; } else { DeleteCategoryEnabled = false; } }
/// <summary> /// Fill the list of categories /// </summary> private void FillCategories() { try { var cred = CredentialManager.GetCredentials(App.CredDb); if (cred == null || cred.UserName.Length < 1) { return; } using var db = new LiteDatabase($"{App.GetDbStringWithoutPass}'{cred.Password}'"); var dbUserCategories = db.GetCollection <UserDataCategories>(DbUserData.UserData_Categories.ToString()); var categoriesExceptAll = dbUserCategories.Query().Where(x => x.CategoryName != "All").Select(x => x.CategoryName).ToList(); var parent = (ModifyGameHostViewModel)Parent; AddCategoryMessage = $"{App.ResMan.GetString("AddCategoryTo")} {parent.GameTitle}"; RemoveCategoryMessage = $"{App.ResMan.GetString("RemoveCategoryFrom")} {parent.GameTitle}"; AddCategoriesCollection.Clear(); RemoveCategoriesCollection.Clear(); DeleteCategoriesCollection.Clear(); if (SelectedGame.Categories == null) { return; } FillAddCategory(categoriesExceptAll); FillRemoveCategory(categoriesExceptAll); FillDeleteCategory(categoriesExceptAll); DeleteCategoryIndex = 0; } catch (Exception e) { App.Logger.Warning(e, "Failed to fill list of categories"); SentrySdk.CaptureException(e); } }