Ejemplo n.º 1
0
        private void OnTripSaveComplete(bool success)
        {
            activity.sendGaEvent("ui_action", "save trip", "save trip", Convert.ToInt16(success));

            if (success)
            {
                Intent        alarmIntent = new Intent(activity, typeof(LocationAlarmReceiver));
                PendingIntent pi          = PendingIntent.GetBroadcast(activity.ApplicationContext, 0, alarmIntent, 0);

                DateTime dtNow   = DateTime.Now.ToLocalTime();
                DateTime dtStart = this.itinerary.GetStartDate().ToLocalTime();

                TimeSpan diffTS = dtStart - dtNow;

                long ms = (long)diffTS.TotalMilliseconds;

                if (((int)Build.VERSION.SdkInt) >= 19)
                {
                    mAlarmManager.SetExact(AlarmType.ElapsedRealtimeWakeup, ms, pi);
                }
                else
                {
                    mAlarmManager.Set(AlarmType.ElapsedRealtimeWakeup, ms, pi);
                }
                view.OnSaveComplete();
                activity.SetResult(Result.Ok);
                activity.Finish();
            }
            else
            {
                view.OnSaveError();
                activity.SetResult(Result.Canceled);
            }
        }
Ejemplo n.º 2
0
 public void OnTripCancelComplete(bool success)
 {
     activity.sendGaEvent("ui_action", "cancel trip", "cancel trip", Convert.ToInt16(success));
     if (success)
     {
         view.OnCancelComplete();
         activity.SetResult(Result.Ok);
         activity.Finish();
     }
     else
     {
         view.OnCancelError();
         activity.SetResult(Result.Canceled);
     }
 }