Esempio n. 1
0
 /// <summary>
 /// Method to invoke when the Delete command is executed.
 /// </summary>
 /// <param name="parameter">The parameter of the command.</param>
 private async void OnDeleteExecute(object parameter)
 {
     if (await _messageService.Show("Are you sure that you want to remove the selected shopping list?", "Are you sure?", MessageButton.OKCancel) == MessageResult.OK)
     {
         ShoppingLists.Remove(SelectedShoppingList);
         SelectedShoppingList = null;
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Replaces an old <c>ShoppingList</c>-Object with a modified one.
        /// </summary>
        /// <param name="oldShoppingList">The <c>Shop</c>-Object that should be replaced.</param>
        /// <param name="newShoppingList">The <c>Shop</c>-Object that should be inserted into the Collection.</param>
        public void EditShoppingList(ShoppingList oldShoppingList, ShoppingList newShoppingList)
        {
            // Get index of old object
            int idx = ShoppingLists.IndexOf(oldShoppingList);

            // Remove old object and insert new object at the same position as the old one
            ShoppingLists.Remove(oldShoppingList);
            ShoppingLists.Insert(idx, newShoppingList);

            // Save data to isolated storage
            SaveShoppingLists();
        }
Esempio n. 3
0
        /// <summary>
        /// Removes a <c>Shop</c>-Object from the <c>Shops</c>-Collection.
        /// </summary>
        /// <param name="shop">The <c>Shop</c>-Object that should be removed from the Collection.</param>
        public void DeleteShop(Shop shop)
        {
            Shops.Remove(shop);

            // Clone ShoppingLists-List
            var templist = ShoppingLists.ToList();

            // Query all shopping lists and update the Shop object of the Shopping lists
            foreach (ShoppingList list in templist)
            {
                if (list.Shop.ID.Equals(shop.ID))
                {
                    ShoppingLists.Remove(list);
                }
            }

            // Save data to isolated storage
            SaveShops();
            SaveShoppingLists();

            // Remove Geofence
            ServiceLocator.Current.GetInstance <GeoHelper>().RemoveGeofence(shop.ID);
        }
Esempio n. 4
0
 /// <summary>
 /// Removes a <c>ShoppingList</c>-Object from the <c>ShoppingLists</c>-Collection.
 /// </summary>
 /// <param name="shoppingList">The <c>ShoppingList</c>-Object that should be removed from the Collection.</param>
 public void DeleteShoppingList(ShoppingList shoppingList)
 {
     ShoppingLists.Remove(shoppingList);
     SaveShoppingLists();
 }