Beispiel #1
0
        private void SelectionChanged()
        {
            if (SelectedDish == null)
            {
                OnPropertyChanged(string.Empty);
                return;
            }
            m_viewDisabler.Disable("Laster...", GetAndSetChosenDish());

            DishIngredientInProgress = new DishIngredientResult();
            OnPropertyChanged(nameof(TheDish));
        }
Beispiel #2
0
        private async void DeleteIngredient()
        {
            if (SelectedIngredient != null)
            {
                var status = await m_foodFacade.DeleteIngredient(SelectedIngredient);

                if (status == 500)
                {
                    await m_popupDialog.Dialog.ShowMessageAsync(this, $"Kan ikke slette {SelectedIngredient.Name}", $"{SelectedIngredient.Name} kan ikke slettes fordi den blir brukt i en eller flere av rettene. Slett retten(e) eller slett ingrediensen ''{SelectedIngredient.Name}'' fra retten(e) ");

                    return;
                }
                m_viewDisabler.Disable("Laster...", RefreshIngredient());
            }
        }
Beispiel #3
0
        private async void CreateNewTag()
        {
            if (TagName != null)
            {
                var numberOfEqualTags = Tags.Select(x => x).Where(t => t.Name.ToUpper().Equals(TagName.ToUpper())).ToArray().Count();
                if (numberOfEqualTags > 0)
                {
                    await m_popupDialog.Dialog.ShowMessageAsync(this, $"Kan ikke legge til {TagName}", $"{TagName} kan ikke legges til fordi det eksisterer allerede en tag med samme navn");

                    return;
                }
                Tags.Add(await m_foodFacade.AddTag(new Tag()
                {
                    Name = TagName
                }));
                TagName = "";
                OnPropertyChanged(nameof(TagName));
                m_viewDisabler.Disable("Laster...", RefreshTag());
            }
        }