Beispiel #1
0
        private void button3_Click(object sender, EventArgs e)
        {
            SiteInfo si = comboBox1.SelectedItem as SiteInfo;

            if (si != null)
            {
                _token        = "";
                _tokenSecret  = "";
                textBox3.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_NO);
                using (KeyRequestForm dlg = new KeyRequestForm(si))
                {
                    dlg.ShowDialog();
                    _tokenSecret = dlg.TokenSecret;
                    _token       = dlg.Token;
                    bool isAuthorized = (!string.IsNullOrEmpty(_tokenSecret) && !string.IsNullOrEmpty(_tokenSecret));
                    textBox3.Text = isAuthorized ? Utils.LanguageSupport.Instance.GetTranslation(STR_YES) : Utils.LanguageSupport.Instance.GetTranslation(STR_NO);
                    if (isAuthorized)
                    {
                        string uuid     = "";
                        string username = "";
                        if (OKAPIService.GetAuthorizedUser(si, _token, _tokenSecret, out username, out uuid))
                        {
                            textBox1.Text = username;
                            textBox2.Text = uuid;
                        }
                    }
                }
            }
        }
Beispiel #2
0
 private void button3_Click(object sender, EventArgs e)
 {
     SiteInfo si = comboBox1.SelectedItem as SiteInfo;
     if (si != null)
     {
         _token = "";
         _tokenSecret = "";
         textBox3.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_NO);
         using (KeyRequestForm dlg = new KeyRequestForm(si))
         {
             dlg.ShowDialog();
             _tokenSecret = dlg.TokenSecret;
             _token = dlg.Token;
             bool isAuthorized = (!string.IsNullOrEmpty(_tokenSecret) && !string.IsNullOrEmpty(_tokenSecret));
             textBox3.Text = isAuthorized ? Utils.LanguageSupport.Instance.GetTranslation(STR_YES) : Utils.LanguageSupport.Instance.GetTranslation(STR_NO);
             if (isAuthorized)
             {
                 string uuid = "";
                 string username = "";
                 if (OKAPIService.GetAuthorizedUser(si, _token, _tokenSecret, out username, out uuid))
                 {
                     textBox1.Text = username;
                     textBox2.Text = uuid;
                 }
             }
         }
     }
 }