示例#1
0
        public OAuth2Form(OAuth2 oauth)
        {
            InitializeComponent();

              this.oauth = oauth;

              if (oauth.ServiceIcon != null)
            this.Icon = oauth.ServiceIcon;

              if (oauth.ServiceName != "")
            this.Text = "Authorize " + oauth.ServiceName;

              string authURL = oauth.GetAuthorizeURL();
              if (authURL != "")
            this.webAuth.Navigate(authURL);
              else
            this.webAuth.DocumentText = "<!DOCTYPE html><html><body><center><br/><br/><h1>" + this.oauth.ServiceName + " appears to be offline.</h1><p>Try again in a minute!</p><p><a href=\"" + authURL + "\">Retry now</a></p></center></body></html>";
        }
示例#2
0
        public void LoadSettings()
        {
            MigrateSettings();

              imageFormat = settings.GetString("Format");

              shortCutDragModifiers = settings.GetString("ShortcutDragModifiers");
              shortCutDragKey = settings.GetString("ShortcutDragKey");
              shortCutAnimModifiers = settings.GetString("ShortcutAnimModifiers");
              shortCutAnimKey = settings.GetString("ShortcutAnimKey");
              shortCutPasteModifiers = settings.GetString("ShortcutPasteModifiers");
              shortCutPasteKey = settings.GetString("ShortcutPasteKey");

              jpegCompression = settings.GetBool("JpegCompression");
              jpegCompressionFilesize = settings.GetInt("JpegCompressionFilesize");
              jpegCompressionRate = settings.GetInt("JpegCompressionRate");

              this.oauth = new OAuth2("https://api.imgur.com/oauth2/", this.imgurClientID, this.imgurClientSecret);
              this.oauth.Proxy = GetProxy();
              this.oauth.ServiceIcon = new Icon(AddonPath + "/Icon.ico");
              this.oauth.ServiceName = "Imgur";

              this.username = settings.GetString("Username");
              this.isPro = settings.GetBool("IsPro");
              this.oauth.AccessToken = settings.GetString("AccessToken");
              this.oauth.RefreshNeeded = new DateTime(settings.GetLong("RefreshNeeded"));
              this.oauth.RefreshToken = settings.GetString("RefreshToken");
              authenticated = username != "" && this.oauth.AccessToken != "";
        }