Ejemplo n.º 1
0
        public void CheckAuthorization()
        {
            var args = new AuthorizationEventArgs();

            try {
                token = fr.CheckLogin(oauth_verification_code.Text);
            } catch (FlickrException e) {
                args.Exception = e;
            } catch (Exception e) {
                var md =
                    new HigMessageDialog(Dialog,
                                         Gtk.DialogFlags.Modal |
                                         Gtk.DialogFlags.DestroyWithParent,
                                         Gtk.MessageType.Error, Gtk.ButtonsType.Ok,
                                         Catalog.GetString("Unable to log on"), e.Message);

                md.Run();
                md.Destroy();
                return;
            }

            ThreadAssist.ProxyToMain(() => {
                do_export_flickr.Sensitive = token != null;
                if (token != null)
                {
                    CurrentState = State.Authorized;
                    Preferences.Set(current_service.PreferencePath, token.Token);
                    Preferences.Set(current_service.PreferencePath + "secret", token.TokenSecret);
                    Preferences.Set(current_service.PreferencePath + "userId", token.UserId);
                    Preferences.Set(current_service.PreferencePath + "userName", token.Username);
                }
                else
                {
                    CurrentState = State.Disconnected;
                }
            });
        }
Ejemplo n.º 2
0
        public void CheckAuthorization()
        {
            AuthorizationEventArgs args = new AuthorizationEventArgs();

            try {
                args.Auth = fr.CheckLogin();
            } catch (FlickrException e) {
                args.Exception = e;
            } catch (Exception e) {
                HigMessageDialog md =
                    new HigMessageDialog(Dialog,
                                         Gtk.DialogFlags.Modal |
                                         Gtk.DialogFlags.DestroyWithParent,
                                         Gtk.MessageType.Error, Gtk.ButtonsType.Ok,
                                         Catalog.GetString("Unable to log on"), e.Message);

                md.Run();
                md.Destroy();
                return;
            }

            ThreadAssist.ProxyToMain(() => {
                do_export_flickr.Sensitive = args.Auth != null;
                if (args.Auth != null)
                {
                    token        = args.Auth.Token;
                    auth         = args.Auth;
                    CurrentState = State.Authorized;
                    Preferences.Set(current_service.PreferencePath, token);
                }
                else
                {
                    CurrentState = State.Disconnected;
                }
            });
        }