Ejemplo n.º 1
0
 public MainPageViewModel()
 {
     AccountServices.GetProfile().ContinueWith(x => CompleteProfile(x));
     PemasanganService.GetItemsAsync().ContinueWith(x => CompletePemasangan(x));
     PerubahanService.GetItemsAsync().ContinueWith(x => CompletePerubahan(x));
     PengaduanService.GetItemsAsync().ContinueWith(x => CompletePengaduan(x));
 }
Ejemplo n.º 2
0
        private async void RefreshAction(object obj)
        {
            await Task.Delay(1000);

            try
            {
                if (IsBusy)
                {
                    return;
                }
                IsBusy = true;
                Source.Clear();
                var result = await PerubahanService.GetItemsAsync();

                int nomor = 0;
                foreach (var item in result)
                {
                    nomor++;
                    item.StatusUbah = nomor;
                    if (item.Petugas != null && !string.IsNullOrEmpty(item.Petugas.Nama))
                    {
                        item.ShowPetugas = true;
                    }
                    Source.Add(item);
                }
            }
            catch (Exception ex)
            {
                Helpers.ShowMessageError(ex.Message);
            }
            finally
            {
                IsBusy = false;
            }
        }