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");
            }
        }
 public void Logout()
 {
     this.Show();
     talk.Hide();
     twitch.exited = true;
     twitch.tokenSource.Cancel();
     talk = null;
 }
 public void AddMainWindow(TalkaBot m)
 {
     MainWindowHandle = m;
 }