Ejemplo n.º 1
0
 private void client_GetUserProfileCompleted(object sender, GetUserProfileCompletedEventArgs e)
 {
     LayoutRoot.DataContext = e.Result;
     GetUserTimeline(this.UserID);
 }
Ejemplo n.º 2
0
        //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...";
                }
            }
        }
Ejemplo n.º 3
0
 private void client_GetUserProfileCompleted(object sender, GetUserProfileCompletedEventArgs e)
 {
     LayoutRoot.DataContext = e.Result;
     GetUserTimeline(this.UserID);
 }