Exemplo 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));
 }
Exemplo n.º 2
0
        private async void SaveAction(object obj)
        {
            try
            {
                if (IsBusy)
                {
                    return;
                }
                IsBusy = true;
                var saved = await PerubahanService.AddItemAsync(Model);

                if (saved)
                {
                    Helpers.ShowMessage("Permohonan Perubahan Berhasil Dikirim");
                    ResetCommand.Execute(null);
                }
            }
            catch (Exception ex)
            {
                Helpers.ShowMessageError(ex.Message);
            }
            finally
            {
                IsBusy = false;
            }
        }
Exemplo n.º 3
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;
            }
        }