Thanattha Bussapak

Thanattha Bussapak

  • NA
  • 20
  • 19.4k

Alarm setting background process wp8

Feb 1 2014 8:37 AM
I want to remander when gps is on destination. I have alarm  set with Begintime&ExpirationTime but I want to change begintime&ExpirationTime by calculate in php (Btime.Text).How to change it with background process.

ex. I'm set alarm at 10.00. But gps come to destination at 9.50 ,begintime change 9.50.

private void ApplicationBarSaveButton_Click(object sender, EventArgs e)
        {
           
            String name = System.Guid.NewGuid().ToString();

            DateTime date = (DateTime)beginDatePicker.Value;
            DateTime time = (DateTime)beginTimePicker.Value;
            DateTime beginTime = date + time.TimeOfDay;
           
            if (beginTime < DateTime.Now)
            {
                MessageBox.Show("the begin date must be in the future.");
                return;
            }
           
            date = (DateTime)expirationDatePicker.Value;
            time = (DateTime)expirationTimePicker.Value;
            DateTime expirationTime = date + time.TimeOfDay;

            if (expirationTime < beginTime)
            {
                MessageBox.Show("expiration time must be after the begin time.");
                return;
            }
    
            string param1Value = param1TextBox.Text;
            string param2Value = param2TextBox.Text;
            string queryString = "";
                       
            else
            {
                 Alarm alarm = new Alarm(name);
                alarm.Content = contentTextBox.Text;
                alarm.Sound = new Uri("RTalarm.wma", UriKind.Relative);
                alarm.BeginTime = beginTime;
                alarm.ExpirationTime = expirationTime;
                alarm.RecurrenceType = recurrence;

                ScheduledActionService.Add(alarm);

                alarm.Recurrence = UpdateRecurrence.Interval;
                alarm.Interval = UpdateInterval.EveryHour;
                alarm.BeginTime = Btime.Text;
                alarm.ExpirationTime = Btime.Text;
                alarm.Start();
                alarm = true;
            }