コード例 #1
0
        private void SetChatAddress(string chatChannel)
        {
            string username = chatChannel;

            if (chatChannel.Contains("/"))
            {
                username = chatChannel.Split('/').Last();
            }

            string fade = SettingsSingleton.Instance.genSettings.FadeTime;

            if (!SettingsSingleton.Instance.genSettings.FadeChat)
            {
                fade = "false";
            }

            string theme = string.Empty;

            if ((SettingsSingleton.Instance.genSettings.ThemeIndex >= 0) && (SettingsSingleton.Instance.genSettings.ThemeIndex < KapChat.Themes.Count))
            {
                theme = KapChat.Themes[SettingsSingleton.Instance.genSettings.ThemeIndex];
            }

            string url = @"https://www.nightdev.com/hosted/obschat/?";

            url += @"theme=" + theme;
            url += @"&channel=" + username;
            url += @"&fade=" + fade;
            url += @"&bot_activity=" + SettingsSingleton.Instance.genSettings.ShowBotActivity.ToString();
            url += @"&prevent_clipping=false";
            Browser1.Load(url);
        }
コード例 #2
0
        private void SetupBrowser()
        {
            drawBorders();

            if (this.genSettings.CustomWindows != null)
            {
                foreach (string url in this.genSettings.CustomWindows)
                {
                    OpenNewCustomWindow(url);
                }
            }

            this.Browser1.ZoomLevelIncrement = 0.25;

            if (this.genSettings.isCustomURL && !string.IsNullOrWhiteSpace(this.genSettings.CustomURL))
            {
                SetCustomChatAddress(this.genSettings.CustomURL);
            }
            else if (!string.IsNullOrWhiteSpace(this.genSettings.Username))
            {
                SetChatAddress(this.genSettings.Username);
            }
            else
            {
                Uri    startupPath = new Uri(System.Reflection.Assembly.GetExecutingAssembly().CodeBase);
                string address     = System.IO.Path.GetDirectoryName(startupPath.LocalPath) + "\\index.html";
                Browser1.Load(address);

                //CefSharp.WebBrowserExtensions.LoadHtml(Browser1,
                //"<html><body style=\"font-size: x-large; color: white; text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000; \">Load a channel to connect to by right-clicking the tray icon.<br /><br />You can move and resize the window, then press the [o] button to hide borders, or use the tray icon menu.</body></html>");
            }
        }
コード例 #3
0
        private void SetChatAddress(string chatChannel)
        {
            string url = @"https://www.nightdev.com/hosted/obschat/?theme=bttv_blackchat&channel=";

            url += chatChannel;
            url += @"&fade=" + fade;
            url += @"&bot_activity=" + bot_activity;
            url += @"&prevent_clipping=false";
            Browser1.Load(url);
        }
コード例 #4
0
        private void SetupBrowser()
        {
            if (!this.Browser1.IsInitialized)
            {
                MessageBox.Show(
                    "Error setting up source. The component was not initialized",
                    "Error", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK
                    );
                return;
            }

            this.bgColor    = new SolidColorBrush(Color.FromArgb(SettingsSingleton.Instance.genSettings.OpacityLevel, 0, 0, 0));
            this.Background = this.bgColor;
            this.cOpacity   = SettingsSingleton.Instance.genSettings.OpacityLevel;

            if (SettingsSingleton.Instance.genSettings.AutoHideBorders)
            {
                hideBorders();
            }
            else
            {
                drawBorders();
            }

            if (SettingsSingleton.Instance.genSettings.ChatNotificationSound.ToLower() != "none")
            {
                Uri    startupPath = new Uri(System.Reflection.Assembly.GetExecutingAssembly().CodeBase);
                string file        = System.IO.Path.GetDirectoryName(startupPath.LocalPath) + "\\assets\\" + SettingsSingleton.Instance.genSettings.ChatNotificationSound + ".wav";
                if (System.IO.File.Exists(file))
                {
                    this.jsCallbackFunctions.MediaFile = file;
                }
            }

            if (SettingsSingleton.Instance.genSettings.CustomWindows != null)
            {
                foreach (string url in SettingsSingleton.Instance.genSettings.CustomWindows)
                {
                    OpenNewCustomWindow(url, SettingsSingleton.Instance.genSettings.AutoHideBorders);
                }
            }

            this.Browser1.ZoomLevelIncrement = 0.25;

            if ((SettingsSingleton.Instance.genSettings.ChatType == (int)ChatTypes.CustomURL) && (!string.IsNullOrWhiteSpace(SettingsSingleton.Instance.genSettings.CustomURL)))
            {
                this.currentChat = new CustomURLChat();
                SetCustomChatAddress(SettingsSingleton.Instance.genSettings.CustomURL);
            }
            else if ((SettingsSingleton.Instance.genSettings.ChatType == (int)ChatTypes.TwitchPopout) && (!string.IsNullOrEmpty(SettingsSingleton.Instance.genSettings.Username)))
            {
                this.currentChat = new CustomURLChat();
                SetCustomChatAddress("https://www.twitch.tv/popout/" + SettingsSingleton.Instance.genSettings.Username + "/chat?popout=");
            }
            else if (!string.IsNullOrWhiteSpace(SettingsSingleton.Instance.genSettings.Username))
            { // TODO: need to clean this up to determine which type of chat to load better
                if (SettingsSingleton.Instance.genSettings.ChatType == (int)ChatTypes.KapChat)
                {
                    this.currentChat = new Chats.KapChat();
                    SetChatAddress(SettingsSingleton.Instance.genSettings.Username);
                }
                else if (SettingsSingleton.Instance.genSettings.ChatType == (int)ChatTypes.jChat)
                {
                    this.currentChat = new jChat();
                    SetCustomChatAddress(SettingsSingleton.Instance.genSettings.jChatURL);
                }
                else
                {
                    Uri    startupPath = new Uri(System.Reflection.Assembly.GetExecutingAssembly().CodeBase);
                    string address     = System.IO.Path.GetDirectoryName(startupPath.LocalPath) + "\\index.html";
                    Browser1.Load(address);
                }

                if (SettingsSingleton.Instance.genSettings.RedemptionsEnabled)
                {
                    SetupPubSubRedemptions();
                }
            }
            else if (SettingsSingleton.Instance.genSettings.ChatType == (int)ChatTypes.jChat)
            { // TODO: need to clean this up to determine which type of chat to load better
                this.currentChat = new jChat();
                SetCustomChatAddress(SettingsSingleton.Instance.genSettings.jChatURL);
            }
            else
            {
                Uri    startupPath = new Uri(System.Reflection.Assembly.GetExecutingAssembly().CodeBase);
                string address     = System.IO.Path.GetDirectoryName(startupPath.LocalPath) + "\\index.html";
                Browser1.Load(address);

                //CefSharp.WebBrowserExtensions.LoadHtml(Browser1,
                //"<html><body style=\"font-size: x-large; color: white; text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000; \">Load a channel to connect to by right-clicking the tray icon.<br /><br />You can move and resize the window, then press the [o] button to hide borders, or use the tray icon menu.</body></html>");
            }
        }
コード例 #5
0
 private void SetCustomChatAddress(string url)
 {
     Browser1.Load(url);
 }