Exemplo n.º 1
0
        private async void LoginWithFacebook(Profile profile, string email)
        {
            try
            {
                StartLoading();

                UserApiRequest user = new UserApiRequest();

                user.Name              = profile.Name.ToString();
                user.RegisterType      = (int)ERegisterType.FACEBOOK;
                user.RegisterProfileId = profile.Id.ToString();
                user.Email             = email;

                user.ProfilePicture     = new ImageApiRequest();
                user.ProfilePicture.Url = profile.GetProfilePictureUri(200, 200).ToString();

                var response = await UserApiService.Login(user);

                if (ResponseValidator.Validate(response, this))
                {
                    AppStatus.UserLogged = response;
                    CheckUserLogged();
                }
                else
                {
                    StopLoading();
                }
            }
            catch (Exception exception)
            {
                InsightsUtils.LogException(exception);
            }
        }
Exemplo n.º 2
0
        private async void SendArmedTrap()
        {
            try
            {
                progressDialog = ProgressDialog.Show(Activity, Resources.GetString(MyTrap.Droid.Resource.String.loading), Resources.GetString(MyTrap.Droid.Resource.String.arming_trap));

                ArmedTrapApiRequest armedTrap = new ArmedTrapApiRequest();

                armedTrap.NameKey   = selectedTrap.NameKey;
                armedTrap.Latitude  = (float)lastLocation.Latitude;
                armedTrap.Longitude = (float)lastLocation.Longitude;

                var response = await TrapApiService.Arm(armedTrap);

                if (ResponseValidator.Validate(response, Activity))
                {
                    ShowAlertArmedTrapSuccessfuly();
                }

                progressDialog.Cancel();
            }
            catch (Exception exception)
            {
                InsightsUtils.LogException(exception);
            }
        }