Пример #1
0
        private void ConnectBot()
        {
            try
            {
                botChat.Abort();
            }
            catch (ThreadAbortException)
            {
            }
            catch (Exception)
            {
            }

            // Disable UI elements
            textBoxBotName.IsEnabled   = false;
            buttonBotConnect.IsEnabled = false;
            tbChannelName.IsEnabled    = false;
            cbServerIP.IsEnabled       = false;
            cbServerPort.IsEnabled     = false;
            cbAutoConnectBot.IsEnabled = false;
            btnBotConnect.Content      = "Disconnect";

            // Twitch Credentials
            accountBot = new TwitchCredentials(Config.BotUsername, Config.BotOAuthKey);

            // Start Bot connection and login
            botChatConnection = new TwitchChatConnection(accountBot);
            botChatConnection.JoinChannel(Config.ChannelName);

            // Create threads for the chat connections
            botChat = new Thread(new ThreadStart(botChatConnection.Run))
            {
                IsBackground = true
            };

            // Start the chat connection threads
            botChat.Start();
        }
Пример #2
0
        private void ConnectStreamer()
        {
            try
            {
                streamerChat.Abort();
            }
            catch (ThreadAbortException)
            {
            }
            catch (Exception)
            {
            }

            // Twitch Credentials
            accountStreamer = new TwitchCredentials(Config.StreamerUsername, Config.StreamerOAuthKey);

            // Start Streamer connection and login
            streamerChatConnection = new TwitchChatConnection(accountStreamer, false);
            streamerChatConnection.JoinChannel(Config.ChannelName);

            // Create threads for the chat connections
            streamerChat = new Thread(new ThreadStart(streamerChatConnection.Run)) { IsBackground = true };

            // Start the chat connection threads
            streamerChat.Start();

            // TODO check on success login/connection
            if (true)
            {
                // Disable Settings UI elements
                textBoxStreamerName.IsEnabled = false;
                buttonStreamerConnect.IsEnabled = false;
                cbAutoConnectStreamer.IsEnabled = false;
                btnStreamerConnect.Content = "Disconnect";

                // Enable Twitch Dashboard tab
                tabMainDashboard.IsEnabled = true;

                try
                {
                    client = new TwitchAuthenticatedClient(Config.StreamerOAuthKey, Config.TwitchClientID);
                    txtTitle.Text = Utils.GetClient().GetMyChannel().Status;
                    cbGame.Text = Utils.GetClient().GetMyChannel().Game;
                    tbStreamDelay.Text = Utils.GetClient().GetMyChannel().Delay.ToString();

                    // Get Streamers Avatar
                    using (WebClient wc = new WebClient())
                    {
                        BitmapImage logo = new BitmapImage();
                        logo.BeginInit();
                        logo.StreamSource = wc.OpenRead(client.GetMyChannel().Logo);
                        logo.CacheOption = BitmapCacheOption.OnLoad;
                        logo.EndInit();
                        imgLogo.Source = logo;
                    }

                    // Enable partnered elements when partnered
                    if (client.GetMyUser().Partnered)
                    {
                        // Stream delay
                        tbStreamDelay.IsEnabled = true;

                        // Manual Commercials
                        gbManualCommercials.IsEnabled = true;
                    }
                }
                catch (Exception ex)
                {
                    Trace.TraceError(ex.ToString());
                }
            }
        }
Пример #3
0
        private void ConnectBot()
        {
            try
            {
                botChat.Abort();
            }
            catch (ThreadAbortException)
            {
            }
            catch (Exception)
            {
            }

            // Disable UI elements
            textBoxBotName.IsEnabled = false;
            buttonBotConnect.IsEnabled = false;
            tbChannelName.IsEnabled = false;
            cbServerIP.IsEnabled = false;
            cbServerPort.IsEnabled = false;
            cbAutoConnectBot.IsEnabled = false;
            btnBotConnect.Content = "Disconnect";

            // Twitch Credentials
            accountBot = new TwitchCredentials(Config.BotUsername, Config.BotOAuthKey);

            // Start Bot connection and login
            botChatConnection = new TwitchChatConnection(accountBot);
            botChatConnection.JoinChannel(Config.ChannelName);

            // Create threads for the chat connections
            botChat = new Thread(new ThreadStart(botChatConnection.Run)) { IsBackground = true };

            // Start the chat connection threads
            botChat.Start();
        }
Пример #4
0
        private void ConnectStreamer()
        {
            try
            {
                streamerChat.Abort();
            }
            catch (ThreadAbortException)
            {
            }
            catch (Exception)
            {
            }

            // Twitch Credentials
            accountStreamer = new TwitchCredentials(Config.StreamerUsername, Config.StreamerOAuthKey);

            // Start Streamer connection and login
            streamerChatConnection = new TwitchChatConnection(accountStreamer, false);
            streamerChatConnection.JoinChannel(Config.ChannelName);

            // Create threads for the chat connections
            streamerChat = new Thread(new ThreadStart(streamerChatConnection.Run))
            {
                IsBackground = true
            };

            // Start the chat connection threads
            streamerChat.Start();

            // TODO check on success login/connection
            if (true)
            {
                // Disable Settings UI elements
                textBoxStreamerName.IsEnabled   = false;
                buttonStreamerConnect.IsEnabled = false;
                cbAutoConnectStreamer.IsEnabled = false;
                btnStreamerConnect.Content      = "Disconnect";

                // Enable Twitch Dashboard tab
                tabMainDashboard.IsEnabled = true;

                try
                {
                    client             = new TwitchAuthenticatedClient(Config.StreamerOAuthKey, Config.TwitchClientID);
                    txtTitle.Text      = Utils.GetClient().GetMyChannel().Status;
                    cbGame.Text        = Utils.GetClient().GetMyChannel().Game;
                    tbStreamDelay.Text = Utils.GetClient().GetMyChannel().Delay.ToString();

                    // Get Streamers Avatar
                    using (WebClient wc = new WebClient())
                    {
                        BitmapImage logo = new BitmapImage();
                        logo.BeginInit();
                        logo.StreamSource = wc.OpenRead(client.GetMyChannel().Logo);
                        logo.CacheOption  = BitmapCacheOption.OnLoad;
                        logo.EndInit();
                        imgLogo.Source = logo;
                    }

                    // Enable partnered elements when partnered
                    if (client.GetMyUser().Partnered)
                    {
                        // Stream delay
                        tbStreamDelay.IsEnabled = true;

                        // Manual Commercials
                        gbManualCommercials.IsEnabled = true;
                    }
                }
                catch (Exception ex)
                {
                    Trace.TraceError(ex.ToString());
                }
            }
        }