async public Task Login(string provider)
        {
            // If authentication is enabled and we're not authenticated yet
            if (Authenticator != null && !IsAuthenticated)
            {
                IsAuthenticated = await Authenticator.Authenticate(provider);
            }

            if (IsAuthenticated)
            {
                // Login is no longer needed now that we know we are logged in
                Locator.Instance.IsLoginNeeded = false;

                try
                {
                    JToken userName = await MobileService.InvokeApiAsync("UserProfile/UserName", HttpMethod.Get, new Dictionary <string, string>() { { "provider", ApplicationCapabilities.ConvertString2IdentityProvider(provider).ToString() } });

                    LoginStatus = userName.ToObject(typeof(string)) as string;
                }
                catch (Exception)
                {
                    LoginStatus = "<User Name Unavailable>";
                }
            }
            else
            {
                LoginStatus = "Login";
            }
        }
Example #2
0
        public async Task <MicrosoftAccountUserInfo> GetMicrosoftAccountUserInfo()
        {
            var userInfo = await MobileService.InvokeApiAsync("userInfo", HttpMethod.Get, new Dictionary <string, string>());

            var msAccUserInfo = JsonConvert.DeserializeObject <MicrosoftAccountUserInfoJson>(userInfo.ToString());

            return(msAccUserInfo.MicrosoftAccountUserInfo);
        }
        public async Task <Place> GetPlaceByBeaconAsync(BeaconModel beaconModel)
        {
            var parameters = new Dictionary <string, string>
            {
                ["beaconId"] = beaconModel.UUID,
                ["major"]    = beaconModel.Major.ToString(),
                ["minor"]    = beaconModel.Minor.ToString()
            };
            var result = await MobileService.InvokeApiAsync <Place>("PlaceItemCustom", HttpMethod.Get, parameters);

            return(result);
        }