Example #1
0
        public async Task <IActionResult> Register(DeviceSelectPageViewModel viewModel)
        {
            using (var graph = new GraphRepository(await HttpContext.GetTokenAsync("access_token")))
            {
                var user = await graph.GetUserAsync();

                await UserInfoRepository.RegistDeviceIdAsync(user.Id, viewModel.SelectedDeviceId);
            }

            return(RedirectToAction("Index"));
        }
Example #2
0
        private async Task InvokeAppAsync(string accessToken, string scheme)
        {
            try
            {
                using (var graph = new GraphRepository(accessToken))
                {
                    var user = await graph.GetUserAsync();

                    var targetDeviceId = await UserInfoRepository.GetTargetDeviceIdByUserIdAsync(user.Id);

                    await graph.AddLaunchAppRequestAsync(targetDeviceId, scheme);
                }
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex);
            }
        }