private async void LoginSucceded(string accessToken) { //IMLearningService _mLearningService = ServiceManager.GetService(); MLearningAzureService service = Mvx.Resolve <IMLearningService>() as MLearningAzureService; dynamic parameters = new ExpandoObject(); parameters.access_token = accessToken; parameters.fields = "id"; dynamic result = await _fb.GetTaskAsync("me", parameters); parameters = new ExpandoObject(); parameters.id = result.id; parameters.access_token = accessToken; var vm = this.ViewModel as LoginViewModel; WAMSRepositoryService service3 = new WAMSRepositoryService(); JObject access_token = new JObject(); access_token["access_token"] = accessToken; int provider = 3; // facebook MobileServiceUser user1 = await service.LoginProvider(provider, access_token); string socialId = user1.UserId; vm.CreateUserCommand.Execute(user1); //Frame.Navigate(typeof(FacebookInfoPage), (object)parameters); }
//Register: Get SASQueryString (permissions) for Azure Uploading static async Task<Resource> registerResource(string filepath) { if (filepath == null) { filepath = getFileId(); } Resource resource = new Resource { LocalPath = filepath, ContainerName = "mlresources" }; IRepositoryService repo = new WAMSRepositoryService(); await repo.InsertAsync<Resource>(resource); return resource; }
static async void AsyncMain(string[] args) { IRepositoryService repositoryService = new WAMSRepositoryService(); _mLearningService = new MLearningAzureService(repositoryService); Console.WriteLine("Hello world!"); //await LOcomments(); //await CirclePosts(); //await LOquizzes(); await CreateLearningObjects(951); Console.ReadKey(true); }
//Register: Get SASQueryString (permissions) for Azure Uploading static async Task <Resource> registerResource(string filepath) { if (filepath == null) { filepath = getFileId(); } Resource resource = new Resource { LocalPath = filepath, ContainerName = "mlresources" }; IRepositoryService repo = new WAMSRepositoryService(); await repo.InsertAsync <Resource>(resource); return(resource); }
//MobileServiceUser user ; private async Task DoLogoutFacebook() { //while (user == null) //{ try { WAMSRepositoryService service = Mvx.Resolve <IRepositoryService>() as WAMSRepositoryService; //user = await service.MobileService.LoginAsync(this, provider); service.MobileService.Logout(); //Console.WriteLine ("Facebook : " + user.UserId + " " + user.MobileServiceAuthenticationToken ) ; } catch (InvalidOperationException e) {} //} }
private async Task Authenticate(MobileServiceAuthenticationProvider provider) { while (user == null) { try { WAMSRepositoryService service = Mvx.Resolve <IRepositoryService>() as WAMSRepositoryService; user = await service.MobileService.LoginAsync(this, provider); System.Console.WriteLine("Facebook : " + user.UserId + " " + user.MobileServiceAuthenticationToken); } catch (InvalidOperationException e) {} } var vm = ViewModel as LoginViewModel; vm.CreateUserCommand.Execute(user); }
private async Task Authenticate(MobileServiceAuthenticationProvider provider) { try { WAMSRepositoryService service = Mvx.Resolve <IRepositoryService>() as WAMSRepositoryService; user = await service.MobileService .LoginAsync(this, provider); } catch (InvalidOperationException e) { } var vm = ViewModel as AuthViewModel; if (user != null) { vm.CreateUserCommand.Execute(user); } else { vm.BackCommand.Execute(null); } }
public ConsumerController():base() { IRepositoryService repo = new WAMSRepositoryService(); ml = new MLearningAzureService(repo); }