Example #1
0
            public static async Task <List <Reporter> > GetFbInfoForTheseReporters(List <Reporter> list, string accessToken)
            {
                facebookUser user = new facebookUser();

                foreach (Reporter reporter in list)
                {
                    user = await FacebookMethods.getUserInfo(accessToken, reporter.facebookCode);

                    reporter.name    = user.Name;
                    reporter.picture = user.picture.data.url;
                }
                return(list);
            }
Example #2
0
        private async void Border_Tap_1(object sender, System.Windows.Input.GestureEventArgs e)
        {
            prgLoginFacebook.Visibility = System.Windows.Visibility.Collapsed;
            bool isAuthenticated = await FacebookMethods.canAuthenticate();

            if (isAuthenticated)
            {
                App.isAuthenticated     = true;
                App.facebookAccessToken = Main.AccessToken;
                App.facebookId          = Main.FacebookId;
            }
            prgLoginFacebook.Visibility = System.Windows.Visibility.Visible;
            //cambiar el texto a ya esta logueado o algo asi
        }
Example #3
0
        private async void FacebookLoginPage_Loaded(object sender, RoutedEventArgs e)
        {
            bool isAuthenticated = await FacebookMethods.canAuthenticate();

            if (isAuthenticated)
            {
                App.isAuthenticated     = true;
                App.facebookAccessToken = Main.AccessToken;
                App.facebookId          = Main.FacebookId;
                NavigationService.GoBack();
            }
            else
            {
                NavigationService.GoBack();
            }
        }
Example #4
0
        async void AddFriendView_Loaded(object sender, RoutedEventArgs e)
        {
            List <FacebookUser> data = await FacebookMethods.DownloadFriendsList();

            if (data != null)
            {
                List <AlphaKeyGroup <FacebookUser> > DataSource = new List <AlphaKeyGroup <FacebookUser> >();

                DataSource = AlphaKeyGroup <FacebookUser> .CreateGroups(data,
                                                                        System.Threading.Thread.CurrentThread.CurrentUICulture,
                                                                        (FacebookUser s) => { return(s.Name); }, true);

                lstFriends.ItemsSource = DataSource;
            }
            else
            {
                MessageBox.Show(AppResources.FriendAddView_Txt_FriendDownloadError, AppResources.ApplicationTitle, MessageBoxButton.OK);
            }
            pgrbDownloadedCompleted.Visibility = Visibility.Collapsed;
        }
Example #5
0
        async void tileFacebook_Tapped(object sender, TappedRoutedEventArgs e)
        {
            if (App.isAuthenticated)
            {
                MessageBoxResult result = await MessageBox.ShowAsync("You're already logged in. Do you want to sign out of this account?. If yes, press Sign Out. Or press Cancel to return to the main menu", "SmartGuard Account", MessageBoxButton.SignOutCancel);

                if (result == MessageBoxResult.SignOut)
                {
                    App.isAuthenticated = false;
                    FacebookMethods.LogOut();
                    txtProfileName.Text     = string.Empty;
                    imgProfilPicture.Source = null;
                }
            }

            else
            {
                await FacebookMethods.LogIn();
            }

            CheckAuthentication();
        }
        private async void btnWallet_Tap(object sender, System.Windows.Input.GestureEventArgs e)
        {
            if (App.isAuthenticated)
            {
                #region Uso de mock data y descarga de informacion de facebook de los reporteros de un evento dado

                EventResult result = EventsMethods.MockDataGetEvents();
                if (EventsMethods.thereIsNoProblemo(result.status, result.message))
                {
                    result.eventsList = EventsMethods.formatedList(result.eventsList);
                }
                foreach (Event E in result.eventsList)
                {
                    MessageBox.Show(E.description);
                    E.reporters = await FacebookMethods.GetFbInfoForTheseReporters(E.reporters, App.facebookAccessToken);

                    string message = "Reportado por: ";
                    foreach (Reporter R in E.reporters)
                    {
                        message += R.name + " a las " + R.reportedAt + ". ";
                    }
                    MessageBox.Show(message);
                }

                #endregion Uso de mock data y descarga de informacion de facebook de los reporteros de un evento dado

                #region Get a list of facebook friends that are using the same app

                //List<facebookUser> users = await FacebookMethods.downloadFriendsList(App.facebookAccessToken);
                //MessageBox.Show(users.Count().ToString());

                #endregion Get a list of facebook friends that are using the same app
            }
            else
            {
                MessageBox.Show("You're not logged in");
            }
        }
Example #7
0
        async void TileFacebook_Tap(object sender, GestureEventArgs e)
        {
            if (App.isAuthenticated)
            {
                MessageBoxResult result = MessageBox.Show(
                    AppResources.Facebook_LogOut_Question,
                    AppResources.ApplicationTitle,
                    MessageBoxButton.OKCancel);

                if (result == MessageBoxResult.OK)
                {
                    App.isAuthenticated = false;
                    FacebookMethods.LogOut();
                }
            }

            else
            {
                string result = await FacebookMethods.LogIn();

                if (result == "OK")
                {
                    MessageBox.Show(AppResources.Facebook_LogIn_Success,
                                    AppResources.ApplicationTitle,
                                    MessageBoxButton.OK);
                }

                else
                {
                    MessageBox.Show(AppResources.Facebook_LogIn_Error,
                                    AppResources.ApplicationTitle,
                                    MessageBoxButton.OK);
                }
            }
            CheckAuthentication();
        }