Esempio 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));
 }
        private async void RefreshAction(object obj)
        {
            await Task.Delay(1000);

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

                foreach (var item in result)
                {
                    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;
            }
        }
Esempio n. 3
0
        private async void SaveAction(object obj)
        {
            try
            {
                if (IsBusy)
                {
                    return;
                }
                IsBusy = true;
                var saved = await PengaduanService.AddItemAsync(Model);

                if (saved)
                {
                    Helpers.ShowMessage("Pengaduan Berhasil Dikirim");
                    Model = new PengaduanModel();
                }
            }
            catch (Exception ex)
            {
                Helpers.ShowMessageError(ex.Message);
            }
            finally
            {
                IsBusy = false;
            }
        }