Beispiel #1
0
        private void GoToHome()
        {
            Intent intent = new Intent(activity.ApplicationContext, typeof(HomeActivity));

            activity.StartActivity(intent);
            activity.Finish();
        }
        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);
            }
        }
Beispiel #3
0
        public async void OnAttemptLogin(string email, string password)
        {
            try{
                if (string.IsNullOrEmpty(email) || string.IsNullOrEmpty(password))
                {
                    view.OnLoginError("You must enter a username and password");
                }
                else
                {
                    AndroidLoginManager loginManager = AndroidLoginManager.Instance(activity.ApplicationContext);
                    LoginResult         loginResult  = await loginManager.Login(email, password);

                    view.ShowBusy(false);

                    activity.sendGaEvent("ui_action", "user login", "login result", Convert.ToInt16(loginResult.Success));
                    if (loginResult.Success)
                    {
                        AccountManager acm      = new AccountManager();
                        TravelerModel  traveler = await acm.GetTravelerByEmail(email);

                        if (traveler.InformedConsent)
                        {
                            Intent intent = new Intent(activity.ApplicationContext, typeof(HomeActivity));
                            activity.StartActivity(intent);
                            activity.Finish();
                        }
                        else
                        {
                            view.showTerms();
                        }
                    }
                    else
                    {
                        view.OnLoginError(loginResult.ErrorString);
                    }
                }
            }catch (Exception e) {
                Console.WriteLine(e);
                view.OnLoginError("Login failed");
            }
        }
Beispiel #4
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);
     }
 }