Exemple #1
0
        private async Task ExecuteOnSave()
        {
            if (Drugs.Duration < 1 & !Drugs.Indeterminer)
            {
                DependencyService.Get <IMessage>().ShortAlert("Invalid Duration !");
                return;
            }
            if (!string.IsNullOrEmpty(Drugs.Drug) & index >= 0 & Times_List.Count > 0 & Drugs.Dose > 0)
            {
                if (await DependencyService.Get <IDialog>().AlertAsync("", "Voulez Vous Enregistrer ?", "Oui", "Non"))
                {
                    Drugs.Times_List = Times_List.ToList();
                    switch (Index)
                    {
                    case 0: Drugs.Taking_Time = "unimportant"; break;

                    case 1: Drugs.Taking_Time = "without food"; break;

                    case 2: Drugs.Taking_Time = "preparandial"; break;

                    case 3: Drugs.Taking_Time = "postparandial"; break;
                    }
                    Drugs.PicturePathe = PicturePath;
                    DataStore.AddDrugs(Drugs);
                    MessagingCenter.Send(this, "DataUpdated");
                    RappelService.SetRappel();
                    await Navigation.PopModalAsync();
                }
            }
            else
            {
                DependencyService.Get <IMessage>().ShortAlert("Invalide Data !");
            }
        }