private void InitAvailableCategories() { foreach (CategoryNode node in AllCategories) { AvailableCategories.Add(node); } }
public async Task InsertDefaultShopItems(IGenericRepository <ShopItemModel> datamanager) { var catArr = AvailableCategories.ToArray(); await datamanager.Insert(new ShopItemModel() { Name = "Melk", ItemCategory = catArr[0], Unit = "Liter" }); await datamanager.Insert(new ShopItemModel() { Name = "Brød", ItemCategory = catArr[1], Unit = "Stk" }); await datamanager.Insert(new ShopItemModel() { Name = "Øl", ItemCategory = catArr[2], Unit = "Stk" }); await datamanager.Insert(new ShopItemModel() { Name = "Smoothi", ItemCategory = catArr[3], Unit = "Stk" }); AvailableShopItems = await datamanager.Get(); }
private bool RemoveCategory(string category) { if (category != null && !Array.Exists(AvailableCategories.Items, x => x == category)) { AvailableCategories.Add(category); SelectedCategories.Remove(category); return(true); } return(false); }
public void SetAvailableCategories(List <ReminderCategoryViewModel> value) { this.AvailableCategories = new List <SelectListItem>(); this.SelectedCategories = this.SelectedCategories ?? new List <long>(); foreach (var item in value) { AvailableCategories.Add(new SelectListItem() { Value = item.Id.ToString(), Text = item.Name, Selected = this.SelectedCategories.Contains(item.Id) }); } }
public void AddCategory() { if (_selectedCategoryFirst != null) { // Set parrent schedule _selectedCategoryFirst.ParentSchedule = _schedule; ScheduleCategories.Add(_selectedCategoryFirst); AvailableCategories.Remove(_selectedCategoryFirst); NotifyOfPropertyChange(() => CanRemoveCategory); } }
protected override void OnNavigatedTo(NavigationEventArgs e) { NavigationHelper.OnNavigatedTo(e); App.OnBackRequested += App_OnBackRequested; IsDirty = false; Entry entry = e.Parameter as Entry; if (entry != null) { InitDefaultSettings(entry); AvailableCategories = DataHandler.Instance.GetUniqueCategories(); TxtName.Text = entry.Name; TxtPassword.Password = entry.Password; ComboCategories.ItemsSource = AvailableCategories; ComboCategories.SelectedIndex = AvailableCategories.IndexOf(entry.Category); } }
private void SearchByAvailableCategoryName(string name) { AvailableCategories.Clear(); if (!string.IsNullOrEmpty(name) || !string.IsNullOrWhiteSpace(name)) { foreach (Category c in allAvailableCategories) { if (c.Name.ToUpper().Contains(name.ToUpper())) { AvailableCategories.Add(c); } } } else { foreach (Category c in allAvailableCategories) { AvailableCategories.Add(c); } } }
public RecipeListDesignViewModel() { AvailableRecipes.Add(TestData.GetTestRecipe("Eierspeis")); AvailableRecipes.Add(TestData.GetTestRecipe("Schnitzel")); AvailableRecipes.Add(TestData.GetTestRecipe("Curry")); AvailableRecipes.Add(TestData.GetTestRecipe("Brathendl")); AvailableRecipes.Add(TestData.GetTestRecipe("Pancakes")); AvailableIngredients.Add(new FilterObject(TestData.GetTestIngredient("Mehl"))); AvailableIngredients.Add(new FilterObject(TestData.GetTestIngredient("Milch"))); AvailableIngredients.Add(new FilterObject(TestData.GetTestIngredient("Eier"))); SelectedIngredients.Add(AvailableIngredients[1]); SelectedIngredients.Add(AvailableIngredients[2]); AvailableCategories.AddRange(TestData.GetTestFilterCategories()); SelectedCategory = AvailableCategories[0]; SearchByRecipe = false; SearchByIngredient = true; }
protected override void InternalOnPropertyChanged(ViewModelBase vm, string property) { if (vm is ExpressionVM && property == "Category") { var newCategory = ((ExpressionVM)vm).Category; if (!AvailableCategories.Any(c => c.Equals(newCategory))) { AvailableCategories.Add(newCategory); TrainingConfiguration.AvailableCategories.Add(newCategory); SearchPanel.AvailableCategories.Add(newCategory); } } else if (vm is TranslationVM && property == "Translation") { Save();//To be sure that a new translation will be taken into account Notify(() => NumberOfExpressionsPerLanguage); } else if (vm is TranslationVM && property == "IsSelected") { Save();//To be sure that a new translation will be taken into account Notify(() => NumberOfExpressionsPerLanguage); } else if (vm is LanguageVM && property == "IsSelected" || property == "ShowEmptyTranslations") { Save(); RebuildList(true); foreach (var ex in Expressions) { foreach (var t in ex.Translations) { t.Notify("TranslationVisibility"); } } } }
public string GetSitesNames() { Stopwatch s = Stopwatch.StartNew(); NameValueCollection nv = ConfigurationManager.AppSettings; string allscrapers = nv.Get("Plugins"); string[] scrapers = allscrapers.Split(','); Dictionary <string, string> dict = new Dictionary <string, string>(); foreach (string site in scrapers) { Assembly asm = null; try { string asmPath = HttpRuntime.AppDomainAppPath + $"Plugins/{site}Library.dll"; asm = Assembly.LoadFrom(asmPath); } catch (Exception e) { Console.WriteLine(e.Message); continue; } var pluginTypes = from t in asm.GetTypes() where t.IsClass && (t.BaseType == typeof(BaseScraper)) select t; foreach (Type t in pluginTypes) { CategoryAttribute cat_attr = t.GetCustomAttribute(typeof(CategoryAttribute)) as CategoryAttribute; AvailableCategories category = cat_attr != null ? cat_attr.Category : AvailableCategories.Other; dict.Add(site, category.ToString()); } } return(JsonConvert.SerializeObject(dict)); }
public Template CreateTemplate() { return(CreateTemplate("neues Template", Languages.FirstOrDefault(lang => lang.Id.ToLower() == "de"), AvailableCategories.FirstOrDefault(c => c.Id == 20))); }
public void RemoveCategory() { AvailableCategories.Add(_selectedCategorySecond); ScheduleCategories.Remove(_selectedCategorySecond); NotifyOfPropertyChange(() => CanRemoveCategory); }
public void DeselectCategory() { AvailableCategories.Add(SelectedUsedCategory); SelectedCategories.Remove(SelectedUsedCategory); SelectedUsedCategory = null; }
public void SelectCategory() { SelectedCategories.Add(SelectedAvailableCategory); AvailableCategories.Remove(SelectedAvailableCategory); SelectedAvailableCategory = null; }
public CategoryListDesignViewModel() { AvailableCategories.AddRange(TestData.GetTestCategories()); }
public CategoryAttribute(AvailableCategories category) => this.Category = category;