Exemplo n.º 1
0
        async Task ExecuteRefreshingCommand(bool pullFromCloud = false)
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                var service = new ZumoService();

                if (pullFromCloud)
                {
                    IsRefreshing = true;
                    await service.SyncOfflineCache();

                    IsRefreshing = false;
                }

                var results = await service.GetAllToDoItems();

                Items.Clear();
                foreach (var item in results)
                {
                    Items.Add(item);
                }
            }
            finally
            {
                IsBusy = false;
            }
        }
Exemplo n.º 2
0
        protected async override void OnResume()
        {
            // Handle when your app resumes
            if (Settings.HasSyncStarted)
            {
                var zumoService = new ZumoService();

                var hasPending = await zumoService.HasPendingOperations();

                if (hasPending)
                {
                    await zumoService.SyncOfflineCache();
                }
            }
        }