public void MinusAuth() { if (!string.IsNullOrEmpty(txtMinusUsername.Text) && !string.IsNullOrEmpty(txtMinusPassword.Text)) { btnMinusAuth.Enabled = false; try { Minus minus = new Minus(Config.MinusConfig, new OAuthInfo(APIKeys.MinusConsumerKey, APIKeys.MinusConsumerSecret), txtMinusUsername.Text, txtMinusPassword.Text); string url = minus.GetAuthorizationURL(); if (!string.IsNullOrEmpty(url)) { if (minus.GetAccessToken()) { minus.ReadFolderList(MinusScope.upload_new); MinusUpdateControls(); MessageBox.Show("Login successful.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show("Login failed.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception ex) { MessageBox.Show("Error: " + ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { btnMinusAuth.Enabled = true; } } }