Пример #1
0
        public bool GrantPermission(string permission, Window parent)
        {
            if (facebookSession.HasAppPermission(permission))
            {
                return(true);
            }

            Uri uri = facebookSession.GetGrantUri(permission);

            GtkBeans.Global.ShowUri(parent.Screen, uri.ToString());

            HigMessageDialog mbox = new HigMessageDialog(parent, Gtk.DialogFlags.DestroyWithParent | Gtk.DialogFlags.Modal,
                                                         Gtk.MessageType.Info, Gtk.ButtonsType.Ok, Catalog.GetString("Waiting for authorization"),
                                                         Catalog.GetString("F-Spot will now launch your browser so that you can enable the permission you just selected.\n\nOnce you are directed by Facebook to return to this application, click \"Ok\" below."));

            mbox.Run();
            mbox.Destroy();

            return(facebookSession.HasAppPermission(permission));
        }
Пример #2
0
        public FacebookAccount()
        {
            SessionInfo info = ReadSessionInfo();

            if (info != null)
            {
                facebookSession = new FacebookSession(api_key, info);
                try {
                    /* This basically functions like a ping to ensure the
                     * session is still valid:
                     */
                    facebookSession.HasAppPermission("offline_access");
                    connected = true;
                } catch (FacebookException) {
                    connected = false;
                }
            }
        }