public async void AddItemToDb()
 {
     addDrugM.Drug.ImageUrl = ImageUrl;
     containingVm.startProcessing("Adding to database");
     await Task.Run(() =>
     {
         try
         {
             addDrugM.AddDrugToDb();
         }
         catch (ArgumentException ex)
         {
             containingVm.ShowMessage(ex.Message);
         }
         catch (Exception ex) { containingVm.ShowMessage(ex.Message); }
         containingVm.finishProcessing("Success!");
         GoBack();
     });
 }
示例#2
0
        //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

        public async void UpdateInDb()
        {
            containingVm.startProcessing("Updating on database");
            await Task.Run(() =>
            {
                try
                {
                    updatePhysicianM.UpdatePhysicianInDb();
                    containingVm.finishProcessing("Success!");
                }
                catch (ArgumentException ex) { containingVm.ShowMessage(ex.Message); }
                catch (Exception ex) { containingVm.ShowMessage(ex.Message); }
                GoBack();
            });
        }
示例#3
0
        public async void RemoveItemFromDb(object selectedDrug)
        {
            containingShellVm.startProcessing("Removing drug");
            Drug drug = selectedDrug as Drug;
            await Task.Run(() =>
            {
                try
                {
                    drugsManagementM.RemoveFromDb(drug);
                    containingShellVm.finishProcessing("Drug removed");
                }

                catch (ArgumentException e) { containingShellVm.ShowMessage(e.Message); }
                catch (Exception e) { containingShellVm.ShowMessage(e.Message); }
            });

            Items.Remove(drug);
        }