OSDN Git Service

アカウント追加時に任意のConsumer Keyを設定可能にする
[opentween/open-tween.git] / OpenTween / AuthTypeSelectDialog.cs
index bee2be0..50b2efa 100644 (file)
@@ -30,12 +30,35 @@ using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
 using System.Windows.Forms;
+using OpenTween.Connection;
 
 namespace OpenTween
 {
     public partial class AuthTypeSelectDialog : OTBaseForm
     {
+        public TwitterAppToken? Result { get; private set; }
+
         public AuthTypeSelectDialog()
             => this.InitializeComponent();
+
+        private void OKButton_Click(object sender, EventArgs e)
+        {
+            TwitterAppToken result;
+            if (this.AuthByOAuth1RadioButton.Checked)
+            {
+                result = new()
+                {
+                    AuthType = APIAuthType.OAuth1,
+                    OAuth1ConsumerKey = ApiKey.Create(this.OAuth1ConsumerKeyTextBox.Text),
+                    OAuth1ConsumerSecret = ApiKey.Create(this.OAuth1ConsumerSecretTextBox.Text),
+                };
+            }
+            else
+            {
+                return;
+            }
+            this.DialogResult = DialogResult.OK;
+            this.Result = result;
+        }
     }
 }