示例#1
0
        public LoginResult Login(bool i_RememberUser = false)
        {
            FacebookService.s_FbApiVersion = ApplicationSettings.k_FacebookApiVersion;
            LoginResult result;

            if (string.IsNullOrEmpty(m_userSettings.UserLastAccessToken))
            {
                result = FacebookService.Login(ApplicationSettings.k_ApplicationId, ApplicationSettings.sr_ApplicationPermissions);
            }
            else
            {
                result = FacebookService.Connect(m_userSettings.UserLastAccessToken);
            }

            if (!string.IsNullOrEmpty(result.AccessToken))
            {
                m_NativeClient = result.LoggedInUser;
                m_userSettings.UserLastAccessToken = result.AccessToken;
                if (i_RememberUser == true)
                {
                    m_userSettings.SaveSettings();
                }
            }

            return(result);
        }
示例#2
0
 private void autoLogin()
 {
     CheckBoxRememberMe.Checked = true;
     buttonLogin.Enabled        = false;
     m_LoginResult = FacebookService.Connect(m_AppSettings.AccessToken);
     initializeFormAfterConnection();
 }
        public void LoginUser(bool i_IsNeedToRemember)
        {
            if (SavedAppSettings.RememberMe)
            {
                UserLoginResult = FacebookService.Connect(SavedAppSettings.AccessToken);
            }
            else
            {
                UserLoginResult = FacebookService.Login(
                    "316345936393858",
                    "user_birthday",
                    "user_friends",
                    "user_hometown",
                    "user_likes",
                    "user_photos",
                    "user_posts",
                    "user_videos",
                    "user_link");
            }

            LoggedInUser = UserLoginResult.LoggedInUser;
            SavedAppSettings.RememberMe  = i_IsNeedToRemember;
            SavedAppSettings.AccessToken = UserLoginResult.AccessToken;
            PostedStatuses = new LinkedList <StatusProxy>();
        }
示例#4
0
        private void loginUser()
        {
            String[] permissions = { "public_profile",
                                     "user_birthday",
                                     "user_friends",
                                     "user_events",
                                     "user_posts",
                                     "user_likes",
                                     "user_photos",
                                     "user_posts",
                                     "user_gender",
                                     "email",
                                     "publish_to_groups",
                                     "user_age_range",
                                     "user_link",
                                     "user_tagged_places",
                                     "user_videos",
                                     "publish_to_groups",
                                     "groups_access_member_info" };


            if (!String.IsNullOrEmpty(CurrentAppSettings.LastAccesToken))
            {
                LoginResult = FacebookService.Connect(CurrentAppSettings.LastAccesToken);
            }
            else
            {
                LoginResult = FacebookService.Login(AppID, permissions);
            }
            CurrentAppSettings.LastAccesToken = LoginResult.AccessToken;
        }
示例#5
0
        private void connectToFacebook()
        {
            LoginResult result = FacebookService.Connect(m_AppSettings.LastAccessToken);

            m_LoggedInUser = result.LoggedInUser;
            this.loginUser();
        }
示例#6
0
        private void logIn()
        {
            LoginResult result = null;
            string      lastKnownAccessToken = loadLastKnownAccessToken();

            if (!string.IsNullOrEmpty(lastKnownAccessToken))
            {
                DialogResult quickLogInResult = MessageBox.Show(
                    @"Would you like to quick log in using the same user?",
                    @"Would you like to quick log in?",
                    MessageBoxButtons.YesNo);
                if (quickLogInResult == DialogResult.Yes)
                {
                    result = FacebookService.Connect(lastKnownAccessToken);
                }
            }

            if (result == null || string.IsNullOrEmpty(result.AccessToken))
            {
                result = FacebookService.Login(k_ApplicationId, sr_RequiredPermissions);
            }

            if (string.IsNullOrEmpty(result.AccessToken))
            {
                MessageBox.Show(result.ErrorMessage);
            }
            else
            {
                this.m_LoggedInUser = result.LoggedInUser;
                this.m_UserPaths    = new UserPaths(this.m_LoggedInUser);
                saveAccessToken(result.AccessToken);
                this.initializeUserDirectory();
                this.buttonLogIn.Enabled = false;
            }
        }
示例#7
0
        protected override void OnShown(EventArgs i_EventArgs)
        {
            base.OnShown(i_EventArgs);

            AppConfigService appConfig = AppConfigService.GetInstance();

            Top    = appConfig.WindowPosition.X;
            Left   = appConfig.WindowPosition.Y;
            Height = appConfig.WindowHeight;
            Width  = appConfig.WindowWidth;

            try
            {
                if (!string.IsNullOrEmpty(appConfig.LastAccessTocken))
                {
                    LoginResult loginParams = FacebookService.Connect(appConfig.LastAccessTocken);
                    if (loginParams != null)
                    {
                        r_LoginService.LoggedInUser = loginParams.LoggedInUser;
                        postLogin();
                    }
                }
            }
            catch (Exception)
            {
                MessageBox.Show(Resources.ConnectWithTokenErrorMessage, Resources.FacebookConnectionErrorTitle, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#8
0
        public void LogIntoAccount()
        {
            LoginResult result;

            if (!AppConfig.Instance.KeepUserloggedIn)
            {
                result = FacebookService.Login(
                    k_FaceBookAppID,
                    "public_profile",
                    "user_about_me",
                    "user_friends",
                    "publish_actions",
                    "user_events",
                    "user_posts",
                    "user_photos",
                    "user_status",
                    "user_likes",
                    "user_birthday");
            }
            else
            {
                result = FacebookService.Connect(AppConfig.Instance.AccessToken);
            }

            connectToFaceBook(result);
        }
示例#9
0
        public void Login()
        {
            string accessToken = r_AppSettings.LastAccessToken;

            if (accessToken != null)
            {
                LoggedInUser = FacebookService.Connect(accessToken).LoggedInUser;
            }
            else
            {
                LoginForm loginForm = new LoginForm();
                if (loginForm.ShowDialog() != DialogResult.OK)
                {
                    Environment.Exit(0);
                }

                LoggedInUser = loginForm.LogInInfo.LoggedInUser;
                r_AppSettings.LastAccessToken = loginForm.LogInInfo.AccessToken;

                r_AppSettings.SaveToFile();
            }

            if (LoginEvent != null)
            {
                LoginEvent.Invoke();
            }

            NextPage(Factory.AppPages[0].GetType().Name.ToLower());
        }
示例#10
0
 public void ConnectUserToFacebook(string i_AccessToken)
 {
     m_LoginResult = FacebookService.Connect(i_AccessToken);
     if (IsUserLoggedIn())
     {
         m_LoggedInUser = m_LoginResult.LoggedInUser;
     }
 }
示例#11
0
        private static LoginResult autoLoginWithCertificates()
        {
            LoginResult loginResult = FacebookService.Connect(MainForm.s_AppSettings.LastAccessToken);

            MainFormFacade.GetInstance().m_LoginUser = loginResult.LoggedInUser;
            MainForm.s_AppSettings.RememberUser = true;

            return(loginResult);
        }
示例#12
0
 private void autoLogin()
 {
     LoginResult result = FacebookService.Connect(ApplicationSettings.Instance.AccessToken);
     //getting error because of fb access problem
     //if (string.IsNullOrEmpty(result.ErrorMessage))
     {
         LoggedInUser = result.LoggedInUser;
     }
 }
示例#13
0
 protected override void OnShown(EventArgs e)
 {
     base.OnShown(e);
     if (m_AppSettings.RememberUser && !string.IsNullOrEmpty(m_AppSettings.LastAccessToken))
     {
         m_LoginResult = FacebookService.Connect(m_AppSettings.LastAccessToken);
         populateUIFromData();
     }
 }
示例#14
0
 protected override void OnShown(EventArgs e)
 {
     base.OnShown(e);
     if (!String.IsNullOrEmpty(CurrentAppSettings.LastAccesToken) && CurrentAppSettings.RememberUser)
     {
         LoginResult = FacebookService.Connect(CurrentAppSettings.LastAccesToken);
         UIDataPopulator.PopulateUI();
     }
 }
示例#15
0
        private void connectAsRememberedUser()
        {
            m_LoginResult  = FacebookService.Connect(AppSettings.Instance.LastAccessToken);
            m_LoggedInUser = m_LoginResult.LoggedInUser;
            FormFacebookApplication fbAppForm = new FormFacebookApplication(m_LoggedInUser);

            fbAppForm.ShowDialog();
            this.Invoke(new Action(this.Close));
        }
示例#16
0
        public void autoLogin()
        {
            LoginResult result = FacebookService.Connect(m_ApplicationSettings.AccessToken);

            if (result.LoggedInUser != null)
            {
                LogedInUser = result.LoggedInUser;
            }
        }
示例#17
0
 protected override void OnShown(EventArgs e)
 {
     if (m_AppSetting.RememberUser &&
         !string.IsNullOrEmpty(m_AppSetting.AccessToken))
     {
         m_logInResult = FacebookService.Connect(m_AppSetting.AccessToken);
         PopulateUIFromFaceBookData();
     }
     base.OnShown(e);
 }
示例#18
0
 private void asyncConnect()
 {
     if (AppSettings.RememberUser && !string.IsNullOrEmpty(AppSettings.LastAccessToken))
     {
         LoginResult loginResult = FacebookService.Connect(AppSettings.LastAccessToken);
         LoggedInUser = loginResult.LoggedInUser;
         FacebookCacheProxy.Instace.LoggedInUser = LoggedInUser;
         m_FacebookConnectionNotifier.Invoke(new LoggedInUserData(LoggedInUser, AppSettings.LastAccessToken));
     }
 }
        protected override void OnShown(EventArgs e)
        {
            base.OnShown(e);

            if (this.m_AppSettings.RememberMe && !string.IsNullOrEmpty(this.m_AppSettings.LastAccessToken))
            {
                this.m_LoggedInResult = FacebookService.Connect(this.m_AppSettings.LastAccessToken);
                this.m_LoggedInUser   = this.m_LoggedInResult.LoggedInUser;
                this.setFormInfo();
            }
        }
示例#20
0
 public void Connect(string i_LastAccessToken)
 {
     try
     {
         LoginResult = FacebookService.Connect(i_LastAccessToken);
     }
     catch
     {
         Login();
     }
 }
        private void connectToRememberdUser()
        {
            this.StartPosition = FormStartPosition.Manual;
            this.Size          = m_AppSettings.LastWindowSize;
            this.Location      = m_AppSettings.LastWindowLocation;
            m_LoggedInUser     = FacebookService.Connect(m_AppSettings.LastAccessToken).LoggedInUser;
            this.Invoke(new Action(() => this.Show()));
            m_FacebookServicesFacade = new FacebookServicesFacade();

            loadUserLoggenInDetails();
        }
示例#22
0
        public void FacebookLogin(string i_AccessToken, bool i_RememberUser)
        {
            FacebookService.s_CollectionLimit = k_CollectionLimit;
            User o_LoggedInUser = null;

            if (i_AccessToken != null && i_RememberUser)
            {
                try
                {
                    LoginResult = FacebookService.Connect(i_AccessToken);
                }
                catch (Exception e)
                {
                    throw new FacebookApiException("Connection failed!", e);
                }
            }
            else
            {
                try
                {
                    LoginResult = FacebookService.Login(
                        k_AppId,
                        "public_profile",
                        "email",
                        "publish_to_groups",
                        "user_birthday",
                        "user_age_range",
                        "user_gender",
                        "user_link",
                        "user_tagged_places",
                        "user_videos",
                        "publish_to_groups",
                        "groups_access_member_info",
                        "user_friends",
                        "user_events",
                        "user_likes",
                        "user_location",
                        "user_photos",
                        "user_posts",
                        "user_hometown");
                }
                catch (Exception e)
                {
                    throw new FacebookApiException("Login failed!", e);
                }
            }

            if (!string.IsNullOrEmpty(LoginResult.AccessToken))
            {
                o_LoggedInUser = LoginResult.LoggedInUser;
            }

            LoggedInUser = o_LoggedInUser;
        }
示例#23
0
 public void Login()
 {
     if (m_AppSettings.RememberUser == true)
     {
         LoggedInUser = FacebookService.Connect(m_AppSettings.LastAccessToken).LoggedInUser;
     }
     else
     {
         handleLogin();
     }
 }
示例#24
0
        protected override void OnShown(EventArgs e)
        {
            base.OnShown(e);
            if (m_AppLogicFacade.isLastUserRemembered())
            {
                Location      = m_AppLogicFacade.AppSettings.m_LastWindowLocation;
                m_LoginResult = FacebookService.Connect(m_AppLogicFacade.AppSettings.m_LastAccessToken);

                new Thread(preapreAllAppComponents).Start();
            }
        }
        public static AppEngine AutoLogin()
        {
            AppEngine appEngine = null;

            if (AppSettings.Settings.RememberUser && !string.IsNullOrEmpty(AppSettings.Settings.LastAccessToken))
            {
                LoginResult loginResult = FacebookService.Connect(AppSettings.Settings.LastAccessToken);
                appEngine = new AppEngine(new AppUser(loginResult.LoggedInUser));
            }

            return(appEngine);
        }
示例#26
0
        public bool ConnectUser()
        {
            if (m_AppSettings.RemmemberUser && !string.IsNullOrEmpty(m_AppSettings.AccessToken))
            {
                LoginResult result = FacebookService.Connect(m_AppSettings.AccessToken);
                this.m_LoggedInUser = result.LoggedInUser;
                this.m_accessToken  = result.AccessToken;
                return(true);
            }

            return(false);
        }
示例#27
0
        protected override void OnShown(EventArgs i_EventArgs)
        {
            base.OnShown(i_EventArgs);

            if (m_AppSettings.RememberUser && !string.IsNullOrEmpty(m_AppSettings.LastAccessToken))
            {
                m_LoginResult = FacebookService.Connect(m_AppSettings.LastAccessToken);
                initializeUserData();
            }

            tabsControl.Selected += new TabControlEventHandler(onTabControlSelect);
        }
示例#28
0
 public void Connect(string i_AccesToken)
 {
     if (string.IsNullOrEmpty(AccesToken))
     {
         LoginResult result = FacebookService.Connect(i_AccesToken);
         initUserAndData(result);
     }
     else
     {
         throw new Exception(k_ErrorUserAlredyConnectMsg);
     }
 }
        private void autoLogin()
        {
            m_LoginResult = FacebookService.Connect(m_AppSettings.AccessToken);
            if (string.IsNullOrEmpty(m_LoginResult.ErrorMessage))
            {
                m_User = m_LoginResult.LoggedInUser;
            }

            Invoke(new Action(() => OprogressBarLoginAndFetchData.IncrementByOne()));

            afterLogin();
        }
 public void ReconnectRememberdUser()
 {
     try
     {
         ConnectionResult         = FacebookService.Connect(m_SavedAccessToken);
         IsSuccessfulReconnection = true;
     }
     catch (Exception)
     {
         IsSuccessfulReconnection = false;
     }
 }