コード例 #1
0
 private void SaveAppSettingOnDisk(AppSetting app)
 {
     if (app != null)
     {
         MyHelper.SerializeObject(app, Path.Combine(FB_Image.RelativeDirectory, FB_Image.UserSettingDir,FB_Image.AppSettingFile));
     }
 }
コード例 #2
0
        private void CheckUserSetting()
        {

            string appPath = Path.Combine(FB_Image.RelativeDirectory,FB_Image.UserSettingDir, FB_Image.AppSettingFile);
            if (File.Exists(appPath))
            {
                AppSetting tempApp = MyHelper.DeSerializeObject<AppSetting>(appPath);
                if (tempApp != null && !String.IsNullOrEmpty(tempApp.ActiveUser))
                {
                    string usrPath = Path.Combine(FB_Image.RelativeDirectory, FB_Image.UserSettingDir, tempApp.ActiveUser);
                    MyAppSetting = tempApp;
                    if (File.Exists(usrPath))
                    {
                        UserSetting a = MyHelper.DeSerializeObject<UserSetting>(Path.Combine(FB_Image.RelativeDirectory, FB_Image.UserSettingDir, tempApp.ActiveUser),true);
                        if (a != null)
                        {
                            List<InboxUser> inboxs = MyHelper.DeSerializeObject<List<InboxUser>>(Path.Combine(FB_Image.RelativeDirectory,FB_Image.UserSettingDir,a.UserID+"inbox"));
                            if(inboxs!= null)
                                ListInboxUser = inboxs;
                            UpdateLoginControl(a);
                            LoadFriendList();
                            LoadMessage();
                            return;
                        }
                    }
                    
                }
            }
          
            //LoginFacebook();
            
        }
コード例 #3
0
        private void LoginFacebook()
        {
            if (!isLogin)
            {
                string extendPermission = "user_photos,user_posts,user_status,user_likes,user_friends,publish_actions";
                facebookLoginForm = new FacebookLoginForm(AppID, extendPermission);
                facebookLoginForm.StartPosition = FormStartPosition.CenterParent;
                DialogResult d = facebookLoginForm.ShowDialog();
                if (d.Equals(DialogResult.OK))
                {
                    // Login

                    FacebookOAuthResult r = facebookLoginForm.AuthResult;
                    UpdateLoginControl(r);
                    SaveActiveUserOnDisk(ActiveUser);
                    if (MyAppSetting == null)
                        MyAppSetting = new AppSetting();
                    MyAppSetting.ActiveUser = ActiveUser.UserID;
                    SaveAppSettingOnDisk(MyAppSetting);

                }
                else
                {
                    isLogin = false;
                }

            }
            else
            {
                Logout(ActiveUser.AccessToken);
                if(ListInboxUser != null)
                    ListInboxUser.Clear();
                UpdateLoginControl();

            }
        }