private void Savealarm(object sender, RoutedEventArgs e)
        {
            if (dimanche.IsChecked == true)
            {
                SharedInformattion.tab[0] = true;
            }
            if (lundi.IsChecked == true)
            {
                SharedInformattion.tab[1] = true;
            }
            if (mardi.IsChecked == true)
            {
                SharedInformattion.tab[2] = true;
            }
            if (mercredi.IsChecked == true)
            {
                SharedInformattion.tab[3] = true;
            }
            if (jeudi.IsChecked == true)
            {
                SharedInformattion.tab[4] = true;
            }
            if (vendredi.IsChecked == true)
            {
                SharedInformattion.tab[5] = true;
            }
            if (samedi.IsChecked == true)
            {
                SharedInformattion.tab[6] = true;
            }
            a = new AlarmData();
            test = 0;
            DateTime dueTime = new DateTime();
            foreach (var item in SharedInformattion.tab)
            {
                if (item)
                {
                    test++;
                }
                if (test == 0)
                {
                    for (int i = 0; i < SharedInformattion.tab.Length; i++)
                    {

                        SharedInformattion.tab[i] = true;
                    }
                }

            }

            try
            {
                for (int i = 0; i < SharedInformattion.tab.Length; i++)
                {

                    if (SharedInformattion.tab[i])
                    {

                        DateTime today = DateTime.Today;

                        int daysUntilTuesday = ((int)SharedInformattion.days[i] - (int)today.DayOfWeek + 7) % 7;
                        DateTime nextTuesday = today.AddDays(daysUntilTuesday);

                        double dateNow = DateTime.Now.TimeOfDay.TotalSeconds;
                        double timePickerTime = time.Time.TotalSeconds;
                        double difference = timePickerTime - dateNow;
                        DateTime d = new DateTime(DateTime.Now.Year, DateTime.Now.Month, nextTuesday.Day, time.Time.Hours, time.Time.Minutes, time.Time.Seconds, 0);

                        String updateString = "It is time to take your medicine";
                        dueTime = d;

                        Random rand = new Random();
                        int idNumber = rand.Next(0, 10000000);

                        ScheduleToastWithStringManipulation(updateString, dueTime, idNumber);
                   
                   //     ScheduleToast(updateString, dueTime, idNumber);



                    }
                }
            }
            catch (Exception)
            {
               // NotifyUser("You must input a valid time in seconds.", NotifyType.ErrorMessage);
            }
            for (int i = 0; i < SharedInformattion.tab.Length; i++)
            {
                SharedInformattion.tab[i] = false;
            }
            //  ObservableCollection<AlarmData> alarmDatas = IsolatedStorageHelper.GetObject<ObservableCollection<AlarmData>>("alarms");
            a.id = maxid+1;

            a.IsEnable = true;

            a.drug = drug;
            a.drugid = drug.Id;
            a.ItemType = "Drug name";
            a.ItemDays = drug.name;
            if (time.Time.Minutes < 10)
            {
                a.DueTime = time.Time.Hours + " : 0" + time.Time.Minutes;
            }
            else
            {
                a.DueTime = time.Time.Hours + " : " + time.Time.Minutes;
            }
            alarms.Add(a);
            IsolatedStorageHelper.SaveObject<ObservableCollection<AlarmData>>("alarms", alarms);


            // IsolatedStorageHelper.SaveObject<int>("ids", IsolatedStorageHelper.idAlarm);

            Frame.Navigate(typeof(AddDrugAlarm));
        }
 private void select(object sender, SelectionChangedEventArgs e)
 {
     sharedAlarm = ItemGridView.SelectedItem as AlarmData;
 }