private void client_GetUserProfileCompleted(object sender, GetUserProfileCompletedEventArgs e) { LayoutRoot.DataContext = e.Result; GetUserTimeline(this.UserID); }
//for now, just accepts a correct user, and moves to main page void client_GetUserProfileCompleted(object sender, GetUserProfileCompletedEventArgs e) { alreadyClicked = false; if (e.Result != null) { List<User> users = e.Result.ToList<User>(); if (users.Count() == 1) { App.currentUser = users[0]; App.userVerified = true; tryAgainBlock.Text = ""; try { IsolatedStorageFile myIsolatedStorage = IsolatedStorageFile.GetUserStoreForApplication(); StreamWriter writeFile; if (!myIsolatedStorage.DirectoryExists("MyScience/UserProfile")) { myIsolatedStorage.CreateDirectory("MyScience/UserProfile"); } if (myIsolatedStorage.FileExists("MyScience/UserProfile/" + App.currentUser.Name + ".txt")) { myIsolatedStorage.DeleteFile("MyScience/UserProfile/" + App.currentUser.Name+ ".txt"); } writeFile = new StreamWriter(new IsolatedStorageFileStream("MyScience/UserProfile/" + App.currentUser.Name + ".txt", FileMode.CreateNew, myIsolatedStorage)); writeFile.WriteLine(App.currentUser.ID); writeFile.WriteLine(App.currentUser.Name); writeFile.WriteLine(App.currentUser.Score); writeFile.Close(); } catch (Exception ex) { // do something with exception } NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative)); } else { //tell the user to retry tryAgainBlock.Text = "Username not found..."; } } }