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; } } }
public void SaveDirectory() { if (!IsBusy) { IsBusy = true; Task.Delay(3000); CategoryDirectoryService.saveCategory(categoryItem); IsBusy = false; } }
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; } } }