Example #1
0
        public void Save()
        {
            this.IsLoading = true;

            var model = new WishList() { Name = this.Name, Description = this.Description };

            int id = 0;
            if (!string.IsNullOrEmpty(this.ListId) && int.TryParse(this.ListId, out id))
                model.Id = id;

            var onComplete = new Action<Task>((t) =>
            {
                var ex = t.Exception;

                this.IsLoading = false;

                if (t.Status != System.Threading.Tasks.TaskStatus.RanToCompletion)
                    this.ReportError("Unable to save your new Wish List!");
                else
                    RequestClose(this);

            });

            if (string.IsNullOrEmpty(this.ListId))
                App.Azure.GetTable<WishList>().InsertAsync(model).ContinueWith(onComplete);
            else
                App.Azure.GetTable<WishList>().UpdateAsync(model).ContinueWith(onComplete);
        }
Example #2
0
        public void Delete(WishList item)
        {
            IsLoading = true;

            App.Azure.GetTable<WishList>().DeleteAsync(item).ContinueWith(t =>
                {
                    var ex = t.Exception;

                    IsLoading = false;

                    if (t.Status != TaskStatus.RanToCompletion)
                    {
                        ReportError("Failed to delete WishList!");
                    }
                    else
                    {
                        InvokeOnMainThread(() => _lists.Remove(item));

                        RaisePropertyChanged(() => Lists);
                    }
                });
        }
Example #3
0
 public void Edit(WishList item)
 {
     RequestNavigate<EditWishListViewModel>(new {listId = item.Id});
 }
Example #4
0
 public void Select(WishList item)
 {
     RequestNavigate<WishListViewModel>(new {listId = item.Id});
 }
Example #5
0
        public void LoadListAndItems()
        {
            this.IsLoading = true;

            App.Azure.GetTable<WishList>().LookupAsync(this.ListId).ContinueWith((t) =>
            {
                var ex = t.Exception;

                if (t.Status == System.Threading.Tasks.TaskStatus.RanToCompletion)
                {
                    this.WishList = t.Result;

                    LoadItems();
                }
                else
                {
                    this.IsLoading = false;
                }
            });
        }
Example #6
0
        public void LoadListAndItems()
        {
            IsLoading = true;

            App.Azure.GetTable<WishList>().LookupAsync(ListId).ContinueWith(t =>
                {
                    var ex = t.Exception;

                    if (t.Status == TaskStatus.RanToCompletion)
                    {
                        WishList = t.Result;

                        LoadItems();
                    }
                    else
                    {
                        IsLoading = false;
                    }
                });
        }