public void AddItemToSelectedShoppinglistProductlistMethod()
 {
     ShoppingListSingleton.Instance.AddItemToSelectedShoppingList(_selectedShoppingList, new ProductModel(ItemNameVM, StoreVM, ItemAmountVM, ItemAmountTypeVM, ItemPriceVM, ItemCatagoryVM));
     PersistancyService.SaveShopListAsJsonAsync(ShoppingListSingleton.Instance.ShoppingListList);
     RefreshTotalPrice();
     ShowViewShoppinglistPageMethod();
 }
 public void DeleteShoppingListItem()
 {
     if (_selectedShoppingList != null)
     {
         BoughtProductOnSelectedShoppingList.Remove(SelectedBoughtProductListItem);
         PersistancyService.SaveShopListAsJsonAsync(ShoppingListSingleton.Instance.ShoppingListList);
         RefreshTotalPrice();
     }
 }
 public void DeleteShoppingList()
 {
     if (_selectedShoppingList != null)
     {
         ShoppingListSingleton.Instance.ShoppingListList.Remove(_selectedShoppingList);
         PersistancyService.SaveShopListAsJsonAsync(ShoppingListSingleton.Instance.ShoppingListList);
         StartPageVisibility();
     }
 }
Example #4
0
        public async void LoadShoppingListAsync()
        {
            PersistancyService.FileCreation();
            ObservableCollection <ShoppingListModel> shopLists = await PersistancyService.LoadShopListFromJsonAsync();

            ShoppingListSingleton.Instance.ShoppingListList.Clear();
            if (shopLists == null)
            {
                ShoppingListList.Add(new ShoppingListModel("FiskeFars", ViewModel.ViewModel.Category[0]));
                PersistancyService.SaveShopListAsJsonAsync(ShoppingListList);
            }
            else
            {
                foreach (var shopList in shopLists)
                {
                    ShoppingListList.Add(shopList);
                }
            }
        }
        public async void CreateShoppingList()
        {
            ContentDialog messageDialog = new ContentDialog()
            {
                Title           = "Fejl",
                Content         = "Mangler Information",
                CloseButtonText = "OK"
            };

            if (string.IsNullOrEmpty(ShoppingListNameVM) || string.IsNullOrEmpty(CategoryVM))
            {
                await messageDialog.ShowAsync();
            }
            else
            {
                ShoppingListSingleton.Instance.ShoppingListList.Add(new ShoppingListModel(ShoppingListNameVM, CategoryVM));
                StartPageVisibility();
                PersistancyService.SaveShopListAsJsonAsync(ShoppingListSingleton.Instance.ShoppingListList);
            }
        }
 private void BaseProductList_DragItemsCompleted(ListViewBase sender, DragItemsCompletedEventArgs args)
 {
     PersistancyService.SaveShopListAsJsonAsync(ShoppingListSingleton.Instance.ShoppingListList);
 }