/// <summary> /// Creates a channel object and manages everything required for the notifications. /// </summary> public void CreateChannel(string name) { Channel channel = new Channel(Resources.icon); channel.Loaded += ChannelLoaded; channel.GameChanged += ChannelLoaded; channel.Initialise(name); _channels.Add(channel); }
/// <summary> /// Constructs the tray icon and intialises the agent. /// </summary> public TrayAgent() { _trayMenu = new ContextMenu(); _trayMenu.MenuItems.Add("Re-Show Notifications", ReShowNotifications); _trayMenu.MenuItems.Add("-"); _trayMenu.MenuItems.Add("Exit", ExitClicked); _trayIcon = new NotifyIcon(); _trayIcon.Text = "TwitchAgent"; _trayIcon.Icon = Resources.icon; _trayIcon.ContextMenu = _trayMenu; _trayIcon.Visible = true; ChannelManager.Instance.TrayAgent = this; _myChannel = new Channel(Resources.icon); _myChannel.FollowingPopulated += FollowingPopulated; _myChannel.Initialise("cybutek"); _myChannel.PopulateFollowing(); }
/// <summary> /// Changes the channel to the selected channel given. /// </summary> private void ChannelSelected(string name) { _currentChannel = name; TitleProcessor(); this.flashPanel.Controls.Remove(flashPlayer); flashPlayer.Dispose(); flashPlayer = new AxShockwaveFlashObjects.AxShockwaveFlash(); flashPlayer.BeginInit(); flashPlayer.Name = "flashPlayer"; flashPlayer.EndInit(); this.flashPanel.Controls.Add(flashPlayer); flashPlayer.WMode = "Direct"; flashPlayer.EmbedMovie = false; flashPlayer.AllowNetworking = "all"; flashPlayer.AllowScriptAccess = "always"; flashPlayer.FlashVars = "hostname=www.twitch.tv&channel=" + name + "&auto_play=true&start_volume=100"; flashPlayer.LoadMovie(0, "http://www.twitch.tv/widgets/live_embed_player.swf"); FlashPanelResize(null,null); this.chatPanel.DocumentText = "<html><head></head><body style=\"margin: 0px; padding 0px; width: 350px; \"><iframe frameborder=\"0\" scrolling=\"no\" id=\"chat_embed\" src=\"http://twitch.tv/chat/embed?channel=" + name + "&popout_chat=true\" height=\"100%\" width=\"350\"></iframe></body></html>"; // Create a channel object to do all of the Twitch API stuff. if (_channel != null) { _channel.Dispose(); } _channel = new Channel(Properties.Resources.icon); _channel.Loaded += ChannelLoaded; _channel.GameChanged += GameChanged; _channel.Initialise(name); }