private void ButtonNext_Click(object sender, EventArgs e)
        {
            string channelUrl = textBoxChannelUrl.Text.ToLower();

            string[] channelUrlSplit = channelUrl.Split(new string[] { "twitch.tv/" }, StringSplitOptions.None);
            if (channelUrlSplit.Count() > 1)
            {
                string       channelName = channelUrlSplit[1].Split('/')[0];
                DialogResult result      = MessageBox.Show($"Is this your channel name?\n\n{channelName}", "Channel name confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
                if (result.Equals(DialogResult.Yes))
                {
                    Properties.Settings.Default.TwitchChannelName = channelName;
                    if (mainLink.IsTwitchConnectionNull())
                    {
                        mainLink.ConnectTwitchBot();
                    }
                    else
                    {
                        mainLink.ReconnectTwitchBot();
                    }
                    Hide();
                }
            }
            else
            {
                MessageBox.Show("The URL doesn't seem to be valid. Check your provided URL.", "An error has occurred");
            }
        }
예제 #2
0
        private async Task AskNameToConfirm(string input)
        {
            var result = MessageBox.Show($"Is this your channel name?\n\n{input}", "Channel name confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);

            if (result.Equals(DialogResult.Yes))
            {
                ApplicationSettings.Current.Twitch.ChannelName = input;
                ApplicationSettings.Current.Save();
                if (mainLink.IsTwitchConnectionNull())
                {
                    await mainLink.ConnectTwitchBot();
                }
                else
                {
                    await mainLink.ReconnectTwitchBot();
                }
                Hide();
            }
        }
예제 #3
0
 private void FormCustomName_FormClosing(object sender, FormClosingEventArgs e)
 {
     e.Cancel = true;
     Hide();
     Properties.Settings.Default.CustomTwitchName          = textBoxCustomName.Text.ToLower();
     Properties.Settings.Default.CustomTwitchOAuthPassword = textBoxCustomOAuth.Text;
     if (!mainLink.IsTwitchConnectionNull())
     {
         mainLink.ReconnectTwitchBot();
     }
 }
 private async void FormCustomName_FormClosing(object sender, FormClosingEventArgs e)
 {
     e.Cancel = true;
     Hide();
     ApplicationSettings.Current.Twitch.Custom.Name = textBoxCustomName.Text.ToLower();
     if (!textBoxCustomOAuth.Text.StartsWith("oauth:"))
     {
         textBoxCustomOAuth.Text = $"oauth:{textBoxCustomOAuth.Text}";
     }
     ApplicationSettings.Current.Twitch.Custom.OAuthPassword = textBoxCustomOAuth.Text;
     ApplicationSettings.Current.Save();
     if (!mainLink.IsTwitchConnectionNull())
     {
         await mainLink.ReconnectTwitchBot();
     }
 }