Exemplo n.º 1
0
        private void EnterTokenButton_Click(object sender, RoutedEventArgs e)
        {
            if (!(string.IsNullOrEmpty(tokenTextBox.Password) || string.IsNullOrEmpty(UsernameTextBox.Text) || string.IsNullOrEmpty(ChannelTextBox.Text)))
            {
                string token    = tokenTextBox.Password;
                string username = UsernameTextBox.Text;
                string channel  = ChannelTextBox.Text;

                twitch = new TwitchIRC(username, token, channel);
                if (!twitch.Connect())
                {
                    System.Windows.Forms.MessageBox.Show("An error occured while connecting to Twitch.");
                    tokenTextBox.Password = "";
                    UsernameTextBox.Text  = "";
                    ChannelTextBox.Text   = "";
                }
                else
                {
                    talk = new TalkaBot(ChannelTextBox.Text, this, twitch);
                    talk.Show();
                    this.Hide();
                    List <Command> commands = new List <Command>();
                    smg.SaveConfig(commands, username, token, channel);
                }
            }
            else
            {
                MessageBox.Show("Please fill the fields");
            }
        }
Exemplo n.º 2
0
 public void Logout()
 {
     this.Show();
     talk.Hide();
     twitch.exited = true;
     twitch.tokenSource.Cancel();
     talk = null;
 }
Exemplo n.º 3
0
 public void AddMainWindow(TalkaBot m)
 {
     MainWindowHandle = m;
 }