예제 #1
0
        private void twitterPost(string value)
        {
            btnNext.Enabled = btnPost.Enabled = textProfanity.Enabled = false;
            if (!LoginPanel.Login())
            {
                MessageBox.Show("Could not connect to Twitter account", "Shitpost", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                btnNext.Enabled = btnPost.Enabled = textProfanity.Enabled = true;
                return;
            }
            ITweet result = Tweet.PublishTweet(value);

            if (result.IsTweetPublished)
            {
                MessageBox.Show("Tweet published", "Shitpost", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("Tweet could not be published", "Shitpost", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            btnNext.Enabled = btnPost.Enabled = textProfanity.Enabled = true;
        }
예제 #2
0
        public static bool Login()
        {
            if (Auth.Credentials != null)
            {
                return(true);
            }

            registry = new Registry();

            string consumerSecret = registry.Read("consumerSecret");
            string accessSecret   = registry.Read("accessSecret");

            if (!string.IsNullOrEmpty(consumerSecret) && !string.IsNullOrEmpty(accessSecret))
            {
                Auth.SetUserCredentials("R4OCY4qm2RJPisvX9rlXhF7mc", consumerSecret, "797867980356980736-zoF6SWbU1tzSEtRzEMr46noMooYcOXM", accessSecret);
                return(true);
            }

            LoginPanel   loginPanel = new LoginPanel();
            DialogResult result     = loginPanel.ShowDialog();

            return(result == DialogResult.OK);
        }