Exemplo n.º 1
0
        public async void LoadDirectory()
        {
            if (!IsBusy)
            {
                /*
                 * await Task.Delay(3000);
                 * var loadDirectory = CategoryDirectoryService.LoadCategoryDirectory();
                 *
                 * foreach (var category in loadDirectory.CategoryList)
                 * {
                 *  this.CategoryList.Add(category);
                 * }
                 */
                try
                {
                    IsBusy = true;
                    this.CategoryList.Clear();
                    var categories = await CategoryDirectoryService.GetCategories();

                    foreach (var category in categories)
                    {
                        this.CategoryList.Add(category);
                    }
                }
                catch (Exception e)
                {
                    await Xamarin.Forms.Application.Current.MainPage.DisplayAlert("Error!", e.Message, "OK");
                }
                finally
                {
                    IsBusy = false;
                }
            }
        }
Exemplo n.º 2
0
        public void SaveDirectory()
        {
            if (!IsBusy)
            {
                IsBusy = true;

                Task.Delay(3000);

                CategoryDirectoryService.saveCategory(categoryItem);

                IsBusy = false;
            }
        }
Exemplo n.º 3
0
 private async void CleanData()
 {
     if (!IsBusy)
     {
         try
         {
             IsBusy = true;
             await CategoryDirectoryService.CleanData();
         }
         catch (Exception e)
         {
             await Xamarin.Forms.Application.Current.MainPage.DisplayAlert("Error!", e.Message, "OK");
         }
         finally
         {
             IsBusy = false;
         }
     }
 }