Example #1
0
 public static void SaveAll(ShoppingListViewModel model)
 {
     using (var store = IsolatedStorageFile.GetUserStoreForApplication())
     {
         Save <ShoppingListViewModel>(store, "current_list.lst", model);
     }
 }
Example #2
0
        public static ShoppingListViewModel CreateOrLoadFromStorage()
        {
            ShoppingListViewModel model = new ShoppingListViewModel();

            try
            {
                using (var store = IsolatedStorageFile.GetUserStoreForApplication())
                {
                    if (store.FileExists("current_list.lst"))
                    {
                        model = model.Load <ShoppingListViewModel>(store, "current_list.lst");
                    }
                }
            }
            catch
            {
            }
            return(model);
        }