Example #1
0
        public void LoggedIn(string sessionKey, string secret, int expires, long userId)
        {
            this.SessionKey    = sessionKey;
            this.UserId        = userId;
            this.ExpiryTime    = DateHelper.ConvertUnixTimeToDateTime(expires);
            this.SessionSecret = secret;

            if (this._permissions != null && this._permissions.Length != 0)
            {
                string query = string.Format("select {0} from permissions where uid = {1}", PermissionsToString(this._permissions), this.UserId);;

                Fql fql = new Fql(this);

                fql.QueryAsync(query,
                               new Fql.QueryCallback <permissions_response>(PermissionCheckCallBack),
                               null);
            }
            else
            {
                this.OnLoggedIn(null);
            }
        }
        public void LoggedIn(string sessionKey, string secret, int expires, long userId)
        {
            this.SessionKey = sessionKey;
            this.UserId = userId;
            this.ExpiryTime = DateHelper.ConvertUnixTimeToDateTime(expires);
            this.SessionSecret = secret;

            if (this._permissions != null && this._permissions.Length != 0)
            {
                string query = string.Format("select {0} from permissions where uid = {1}", PermissionsToString(this._permissions), this.UserId); ;

                Fql fql = new Fql(this);

                fql.QueryAsync(query,
                            new Fql.QueryCallback<permissions_response>(PermissionCheckCallBack),
                            null);
            }
            else
            {
                this.OnLoggedIn(null);
            }
        }
        public IFacebookApi Initialize(IFacebookSession session)
        {
            AuthToken = string.Empty;

            #if !SILVERLIGHT
            InstalledCulture = CultureInfo.InstalledUICulture;
            #else
            InstalledCulture = CultureInfo.CurrentUICulture;
            #endif

            Session = session;

            Auth = new Auth(Session);
            Video = new Video(Session);
            Marketplace = new Marketplace(Session);
            Admin = new Admin(Session);
            Photos = new Photos(Session);
            Users = new Users(Session);
            Friends = new Friends(Users, Session);
            Events = new Events(Session);
            Groups = new Groups(Session);
            Notifications = new Notifications(Session);
            Profile = new Profile(Session);
            Fbml = new Fbml(Session);
            Feed = new Feed(Session);
            Fql = new Fql(Session);
            LiveMessage = new LiveMessage(Session);
            Message = new Message(Session);
            Batch = new Batch(Session);
            Pages = new Pages(Session);
            Application = new Application(Session);
            Data = new Data(Session);
            Permissions = new Permissions(Session);
            Connect = new Connect(Session);
            Comments = new Comments(Session);
            Stream = new Stream(Session);
            Status = new Status(Session);
            Links = new Links(Session);
            Notes = new Notes(Session);
            Intl = new Intl(Session);

            Batch.Batch = Batch;
            Permissions.Permissions = Permissions;
            Batch.Permissions = Permissions;
            Permissions.Batch = Batch;

            foreach (IRestBase restBase in new IRestBase[] {Auth, Video, Marketplace, Admin, Photos, Users, Friends, Events,
                Groups, Notifications, Profile, Fbml, Feed, Fql, LiveMessage, Message, Pages, Application, Data, Connect, Comments,
                Stream, Status, Links, Notes})
            {
                restBase.Batch = Batch;
                restBase.Permissions = Permissions;
            }

            return this;
        }