private void ShowSettingsWindow(WindowSettings config)
 {
     /*SettingsWindow settingsWindow = new SettingsWindow(config);
      *
      * if (settingsWindow.ShowDialog() == true)
      * {
      *  // update the AppSettings
      *  MessageBox.Show(config.URL);
      * }*/
 }
        private void ShowSettingsWindow(WindowSettings config)
        {
            SettingsWindow settingsWindow = new SettingsWindow(config);

            if (settingsWindow.ShowDialog() == true)
            {
                // update the AppSettings
                MessageBox.Show(config.URL);
            }
        }
Ejemplo n.º 3
0
        private void ShowSettingsWindow()
        {
            WindowSettings config = new WindowSettings {
                Title           = "Main Window",
                isCustomURL     = this.genSettings.isCustomURL,
                URL             = this.genSettings.CustomURL,
                Username        = this.genSettings.Username,
                ChatFade        = this.genSettings.FadeChat,
                FadeTime        = this.genSettings.FadeTime,
                ShowBotActivity = this.genSettings.ShowBotActivity,
                Theme           = this.genSettings.ThemeIndex,
                CustomCSS       = this.genSettings.CustomCSS
            };

            SettingsWindow settingsWindow = new SettingsWindow(config);

            if (settingsWindow.ShowDialog() == true)
            {
                if (config.isCustomURL)
                {
                    this.genSettings.isCustomURL = config.isCustomURL;
                    this.genSettings.CustomURL   = config.URL;
                    this.genSettings.CustomCSS   = config.CustomCSS;

                    if (!string.IsNullOrEmpty(this.genSettings.CustomURL))
                    {
                        SetCustomChatAddress(this.genSettings.CustomURL);
                    }
                }
                else
                {
                    this.genSettings.isCustomURL     = false;
                    this.genSettings.Username        = config.Username;
                    this.genSettings.FadeChat        = config.ChatFade;
                    this.genSettings.FadeTime        = config.FadeTime;
                    this.genSettings.ShowBotActivity = config.ShowBotActivity;
                    this.genSettings.ThemeIndex      = config.Theme;

                    if (this.genSettings.ThemeIndex == 0)
                    {
                        this.genSettings.CustomCSS = config.CustomCSS;
                    }
                    else
                    {
                        this.genSettings.CustomCSS = string.Empty;
                    }


                    if (!string.IsNullOrEmpty(this.genSettings.Username))
                    {
                        SetChatAddress(this.genSettings.Username);
                    }
                }
            }
        }
Ejemplo n.º 4
0
        private void ShowSettingsWindow()
        {
            WindowSettings config = new WindowSettings
            {
                Title    = "Main Window",
                ChatType = SettingsSingleton.Instance.genSettings.ChatType,
                URL      = SettingsSingleton.Instance.genSettings.CustomURL,
                jChatURL = SettingsSingleton.Instance.genSettings.jChatURL,
                Username = SettingsSingleton.Instance.genSettings.Username,
                ChatFade = SettingsSingleton.Instance.genSettings.FadeChat,
                FadeTime = SettingsSingleton.Instance.genSettings.FadeTime,
                //ShowBotActivity = SettingsSingleton.Instance.genSettings.ShowBotActivity,
                ChatNotificationSound = SettingsSingleton.Instance.genSettings.ChatNotificationSound,
                Theme              = SettingsSingleton.Instance.genSettings.ThemeIndex,
                CustomCSS          = SettingsSingleton.Instance.genSettings.CustomCSS,
                AutoHideBorders    = SettingsSingleton.Instance.genSettings.AutoHideBorders,
                ConfirmClose       = SettingsSingleton.Instance.genSettings.ConfirmClose,
                EnableTrayIcon     = SettingsSingleton.Instance.genSettings.EnableTrayIcon,
                HideTaskbarIcon    = SettingsSingleton.Instance.genSettings.HideTaskbarIcon,
                AllowInteraction   = SettingsSingleton.Instance.genSettings.AllowInteraction,
                RedemptionsEnabled = SettingsSingleton.Instance.genSettings.RedemptionsEnabled,
                ChannelID          = SettingsSingleton.Instance.genSettings.ChannelID,
                BetterTtv          = SettingsSingleton.Instance.genSettings.BetterTtv,
                FrankerFaceZ       = SettingsSingleton.Instance.genSettings.FrankerFaceZ,
            };

            SettingsWindow settingsWindow = new SettingsWindow(this, config);

            if (settingsWindow.ShowDialog() == true)
            {
                SettingsSingleton.Instance.genSettings.ChatType = config.ChatType;

                if (config.ChatType == (int)ChatTypes.CustomURL)
                {
                    this.currentChat = new CustomURLChat();
                    SettingsSingleton.Instance.genSettings.CustomURL = config.URL;
                    SettingsSingleton.Instance.genSettings.CustomCSS = config.CustomCSS;

                    if (!string.IsNullOrEmpty(SettingsSingleton.Instance.genSettings.CustomURL))
                    {
                        SetCustomChatAddress(SettingsSingleton.Instance.genSettings.CustomURL);
                    }
                }
                else if (config.ChatType == (int)ChatTypes.TwitchPopout)
                {
                    this.currentChat = new CustomURLChat();
                    SettingsSingleton.Instance.genSettings.Username  = config.Username;
                    SettingsSingleton.Instance.genSettings.CustomCSS = config.TwitchPopoutCSS;

                    if (!string.IsNullOrEmpty(SettingsSingleton.Instance.genSettings.Username))
                    {
                        SetCustomChatAddress("https://www.twitch.tv/popout/" + SettingsSingleton.Instance.genSettings.Username + "/chat?popout=");
                    }

                    SettingsSingleton.Instance.genSettings.BetterTtv    = config.BetterTtv;
                    SettingsSingleton.Instance.genSettings.FrankerFaceZ = config.FrankerFaceZ;
                }
                else if (config.ChatType == (int)ChatTypes.KapChat)
                {
                    this.currentChat = new Chats.KapChat();
                    SettingsSingleton.Instance.genSettings.Username = config.Username;
                    SettingsSingleton.Instance.genSettings.FadeChat = config.ChatFade;
                    SettingsSingleton.Instance.genSettings.FadeTime = config.FadeTime;
                    //SettingsSingleton.Instance.genSettings.ShowBotActivity = config.ShowBotActivity;
                    SettingsSingleton.Instance.genSettings.ChatNotificationSound = config.ChatNotificationSound;
                    SettingsSingleton.Instance.genSettings.ThemeIndex            = config.Theme;

                    if (SettingsSingleton.Instance.genSettings.ThemeIndex == 0)
                    {
                        SettingsSingleton.Instance.genSettings.CustomCSS = config.CustomCSS;
                    }
                    else
                    {
                        SettingsSingleton.Instance.genSettings.CustomCSS = string.Empty;
                    }


                    if (!string.IsNullOrEmpty(SettingsSingleton.Instance.genSettings.Username))
                    {
                        SetChatAddress(SettingsSingleton.Instance.genSettings.Username);

                        if (config.RedemptionsEnabled)
                        {
                            SetupPubSubRedemptions();
                        }
                        else
                        {
                            DisablePubSubRedemptions();
                        }
                    }


                    if (SettingsSingleton.Instance.genSettings.ChatNotificationSound.ToLower() == "none")
                    {
                        this.jsCallbackFunctions.MediaFile = string.Empty;
                    }
                    else
                    {
                        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;
                        }
                    }
                }

                else if (config.ChatType == (int)ChatTypes.jChat)
                {
                    this.currentChat = new jChat();
                    SettingsSingleton.Instance.genSettings.jChatURL = config.jChatURL;
                    SettingsSingleton.Instance.genSettings.ChatNotificationSound = config.ChatNotificationSound;

                    if (!string.IsNullOrEmpty(SettingsSingleton.Instance.genSettings.Username))
                    {
                        SetCustomChatAddress(SettingsSingleton.Instance.genSettings.jChatURL);

                        if (config.RedemptionsEnabled)
                        {
                            SetupPubSubRedemptions();
                        }
                        else
                        {
                            DisablePubSubRedemptions();
                        }
                    }
                    else
                    {
                        SetCustomChatAddress(SettingsSingleton.Instance.genSettings.jChatURL);
                    }


                    if (SettingsSingleton.Instance.genSettings.ChatNotificationSound.ToLower() == "none")
                    {
                        this.jsCallbackFunctions.MediaFile = string.Empty;
                    }
                    else
                    {
                        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;
                        }
                    }
                }

                SettingsSingleton.Instance.genSettings.AutoHideBorders    = config.AutoHideBorders;
                SettingsSingleton.Instance.genSettings.ConfirmClose       = config.ConfirmClose;
                SettingsSingleton.Instance.genSettings.EnableTrayIcon     = config.EnableTrayIcon;
                SettingsSingleton.Instance.genSettings.HideTaskbarIcon    = config.HideTaskbarIcon;
                SettingsSingleton.Instance.genSettings.AllowInteraction   = config.AllowInteraction;
                SettingsSingleton.Instance.genSettings.RedemptionsEnabled = config.RedemptionsEnabled;
                SettingsSingleton.Instance.genSettings.ChannelID          = config.ChannelID;

                this.taskbarControl.Visibility = config.EnableTrayIcon ? Visibility.Visible : Visibility.Hidden;
                this.ShowInTaskbar             = !config.HideTaskbarIcon;

                if (!this.hiddenBorders)
                {
                    this.Browser1.IsEnabled = config.AllowInteraction;
                }

                // Save the new changes for settings
                this.genSettingsTrackingConfig.Persist();
            }
        }
Ejemplo n.º 5
0
        public SettingsWindow(WindowSettings windowConfig)
        {
            this.config = windowConfig;

            InitializeComponent();
        }
Ejemplo n.º 6
0
        private void ShowSettingsWindow()
        {
            WindowSettings config = new WindowSettings {
                Title                 = "Main Window",
                isCustomURL           = this.genSettings.isCustomURL,
                URL                   = this.genSettings.CustomURL,
                Username              = this.genSettings.Username,
                ChatFade              = this.genSettings.FadeChat,
                FadeTime              = this.genSettings.FadeTime,
                ShowBotActivity       = this.genSettings.ShowBotActivity,
                ChatNotificationSound = this.genSettings.ChatNotificationSound,
                Theme                 = this.genSettings.ThemeIndex,
                CustomCSS             = this.genSettings.CustomCSS,
                AutoHideBorders       = this.genSettings.AutoHideBorders,
                ConfirmClose          = this.genSettings.ConfirmClose,
                EnableTrayIcon        = this.genSettings.EnableTrayIcon
            };

            SettingsWindow settingsWindow = new SettingsWindow(this, config);

            if (settingsWindow.ShowDialog() == true)
            {
                if (config.isCustomURL)
                {
                    this.genSettings.isCustomURL = config.isCustomURL;
                    this.genSettings.CustomURL   = config.URL;
                    this.genSettings.CustomCSS   = config.CustomCSS;

                    if (!string.IsNullOrEmpty(this.genSettings.CustomURL))
                    {
                        SetCustomChatAddress(this.genSettings.CustomURL);
                    }
                }
                else
                {
                    this.genSettings.isCustomURL           = false;
                    this.genSettings.Username              = config.Username;
                    this.genSettings.FadeChat              = config.ChatFade;
                    this.genSettings.FadeTime              = config.FadeTime;
                    this.genSettings.ShowBotActivity       = config.ShowBotActivity;
                    this.genSettings.ChatNotificationSound = config.ChatNotificationSound;
                    this.genSettings.ThemeIndex            = config.Theme;

                    if (this.genSettings.ThemeIndex == 0)
                    {
                        this.genSettings.CustomCSS = config.CustomCSS;
                    }
                    else
                    {
                        this.genSettings.CustomCSS = string.Empty;
                    }


                    if (!string.IsNullOrEmpty(this.genSettings.Username))
                    {
                        SetChatAddress(this.genSettings.Username);
                    }
                }

                this.genSettings.AutoHideBorders = config.AutoHideBorders;
                this.genSettings.ConfirmClose    = config.ConfirmClose;
                this.genSettings.EnableTrayIcon  = config.EnableTrayIcon;

                this.taskbarControl.Visibility = config.EnableTrayIcon ? Visibility.Visible : Visibility.Hidden;
            }
        }