GetCoffees() 공개 메소드

public GetCoffees ( ) : Task>
리턴 Task>
예제 #1
0
        async Task ExecuteLoadCoffeesCommandAsync()
        {
            if (IsBusy || !(await LoginAsync()))
            {
                return;
            }


            try
            {
                LoadingMessage = "Loading Coffees...";
                IsBusy         = true;
                var coffees = await azureService.GetCoffees();

                Coffees.ReplaceRange(coffees);


                SortCoffees();
            }
            catch (Exception ex)
            {
                Debug.WriteLine("OH NO!" + ex);

                await Application.Current.MainPage.DisplayAlert("Sync Error", "Unable to sync coffees, you may be offline", "OK");
            }
            finally
            {
                IsBusy = false;
            }
        }
예제 #2
0
        async Task ExecuteLoadCoffeesCommandAsync()
        {
            if (IsBusy)
            {
                return;
            }


            try
            {
                LoadingMessage = "Loading Coffees...";
                IsBusy         = true;
                var coffees = await azureService.GetCoffees();

                Coffees.ReplaceRange(coffees);


                SortCoffees();
            }
            catch (Exception ex)
            {
                Debug.WriteLine("OH NO!" + ex);
                MessagingService.Current.SendMessage <MessagingServiceAlert>("message", new MessagingServiceAlert
                {
                    Cancel  = "OK",
                    Message = "Unable to sync coffees, you may be offline",
                    Title   = "Coffee sync Error"
                });
            }
            finally
            {
                IsBusy = false;
            }
        }
예제 #3
0
        async Task ExecuteLoadCoffeesCommandAsync()
        {
            if (IsBusy)
            {
                return;
            }


            try
            {
                if (!Settings.IsLoggedIn)
                {
                    await azureService.Initialize();

                    var user = await DependencyService.Get <IAuthentication>().LoginAsync(azureService.MobileService, MobileServiceAuthenticationProvider.MicrosoftAccount);

                    if (user == null)
                    {
                        return;
                    }
                }


                LoadingMessage = "Loading Coffees...";
                IsBusy         = true;
                var coffees = await azureService.GetCoffees();

                Coffees.ReplaceRange(coffees);


                SortCoffees();
            }
            catch (Exception ex)
            {
                Debug.WriteLine("OH NO!" + ex);
                MessagingService.Current.SendMessage <MessagingServiceAlert>("message", new MessagingServiceAlert
                {
                    Cancel  = "OK",
                    Message = "Unable to sync coffees, you may be offline",
                    Title   = "Coffee sync Error"
                });
            }
            finally
            {
                IsBusy = false;
            }
        }