Example #1
0
        async Task AddItemToHat()
        {
            if (!string.IsNullOrWhiteSpace(NewItemEntry))
            {
                if (!HatItems.Any(x => x.Equals(NewItemEntry, StringComparison.CurrentCultureIgnoreCase)))
                {
                    HatItems.Add(NewItemEntry);
                    NewItemEntry = string.Empty;

                    OnPropertyChanged(nameof(HatItems));
                    OnPropertyChanged(nameof(NewItemEntry));
                }
                else
                {
                    await Application.Current.MainPage.DisplayAlert(string.Empty, "Item already added.", "OK");
                }
            }
        }
Example #2
0
        void RemoveItemFromHat(string item)
        {
            HatItems.Remove(item);

            OnPropertyChanged(nameof(HatItems));
        }