コード例 #1
0
        private void AddAccount()
        {
START:
            var form = new AuthBrowser();
            var s = OAuth.Authorize(SecretKeys.ConsumerKey, SecretKeys.ConsumerSecret);

            form.URL = s.AuthorizeUri.AbsoluteUri;
            form.ShowDialog();
            if (form.Success)
            {
                var _tokens = s.GetTokens(form.PIN);
                SetAccountTokens(_tokens);
            }
            else if (settings.Twitter.Count == 0)
            {
                var result = MessageBox.Show(Resources.yetAdded1 + NewLine + Resources.yetAdded2, Information.Title, MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                switch (result)
                {
                case DialogResult.Yes:
                    goto START;

                case DialogResult.No:
                    Environment.Exit(0);
                    break;
                }
            }
            form.Dispose();
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: mystasly48/Mystter_SendTweet
        private void AddAccount()
        {
START:
            var s = OAuth.Authorize(SecretKeys.ConsumerKey, SecretKeys.ConsumerSecret);
            var form = new AuthBrowser(s.AuthorizeUri.AbsoluteUri + "&lang=" + Localization.CurrentLanguage);

            form.ShowDialog();
            if (form.Success)
            {
                var _tokens = s.GetTokens(form.PIN);
                SetAccountTokens(_tokens);
            }
            else if (settings.Twitter.Count == 0)
            {
                if (IsRetryAddingAccount())
                {
                    goto START;
                }
                else
                {
                    Environment.Exit(0);
                }
            }
            else
            {
                MessageBox.Show(Resources.FailedToAddAccount);
            }
            form.Dispose();
        }