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"); } }
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(); } }