public MainWindow()
        {
            InitializeComponent();
            DataContext = this;

            this.genSettings = new GeneralSettings
            {
                CustomWindows         = new StringCollection(),
                Username              = string.Empty,
                FadeChat              = false,
                FadeTime              = "120",
                ShowBotActivity       = false,
                ChatNotificationSound = "None",
                ThemeIndex            = 1,
                ChatType              = 0,
                CustomURL             = string.Empty,
                ZoomLevel             = 0,
                OpacityLevel          = 0,
                AutoHideBorders       = false,
                EnableTrayIcon        = true,
                ConfirmClose          = true,
                HideTaskbarIcon       = false,
                AllowInteraction      = true,
                VersionTracker        = 0.7
            };

            Services.Tracker.Configure(this).IdentifyAs("State").Apply();
            this.genSettingsTrackingConfig = Services.Tracker.Configure(this.genSettings);
            this.genSettingsTrackingConfig.IdentifyAs("MainWindow").Apply();

            var browserSettings = new BrowserSettings
            {
                FileAccessFromFileUrls      = CefState.Enabled,
                UniversalAccessFromFileUrls = CefState.Enabled
            };

            Browser1.BrowserSettings = browserSettings;
            CefSharpSettings.LegacyJavascriptBindingEnabled = true;

            //this.Browser1.RegisterAsyncJsObject("jsCallback", new JsCallbackFunctions());
            this.jsCallbackFunctions = new JsCallbackFunctions();
            Browser1.JavascriptObjectRepository.Register("jsCallback", this.jsCallbackFunctions, isAsync: true, options: BindingOptions.DefaultBinder);
        }
Exemple #2
0
        /*public event PropertyChangedEventHandler PropertyChanged;
         * protected void OnPropertyChanged([CallerMemberName]string propertyName = null)
         * {
         *  PropertyChangedEventHandler handler = this.PropertyChanged;
         *  if (handler != null)
         *  {
         *      var e = new PropertyChangedEventArgs(propertyName);
         *      handler(this, e);
         *  }
         * }*/

        public MainWindow()
        {
            CefSettings settings = new CefSettings()
            {
                PersistSessionCookies  = true,
                PersistUserPreferences = true,
                RootCachePath          = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "TransparentTwitchChatWPF", "cef"),
                CachePath = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "TransparentTwitchChatWPF", "cef", "cache")
            };

            Cef.Initialize(settings);

            InitializeComponent();
            DataContext = this;

            this.currentChat = new CustomURLChat(); // TODO: initializing here needed?

            Services.Tracker.Configure(this).IdentifyAs("State").Apply();
            this.genSettingsTrackingConfig = Services.Tracker.Configure(SettingsSingleton.Instance.genSettings);
            this.genSettingsTrackingConfig.IdentifyAs("MainWindow").Apply();

            var browserSettings = new BrowserSettings
            {
                //ApplicationCache = CefState.Enabled,
                LocalStorage = CefState.Enabled,
                //FileAccessFromFileUrls = CefState.Enabled,
                //UniversalAccessFromFileUrls = CefState.Enabled,
            };

            Browser1.BrowserSettings = browserSettings;
            Browser1.RequestContext  = new RequestContext(new RequestContextSettings()
            {
                CachePath              = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "TransparentTwitchChatWPF", "cef", "cache"),
                PersistSessionCookies  = true,
                PersistUserPreferences = true,
            });
            //this.Browser1.JavascriptObjectRepository.Settings.LegacyBindingEnabled = true;

            //this.Browser1.RegisterAsyncJsObject("jsCallback", new JsCallbackFunctions());
            this.jsCallbackFunctions = new JsCallbackFunctions();
            Browser1.JavascriptObjectRepository.Register("jsCallback", this.jsCallbackFunctions, isAsync: true, options: BindingOptions.DefaultBinder);
        }
        /*public event PropertyChangedEventHandler PropertyChanged;
         * protected void OnPropertyChanged([CallerMemberName]string propertyName = null)
         * {
         *  PropertyChangedEventHandler handler = this.PropertyChanged;
         *  if (handler != null)
         *  {
         *      var e = new PropertyChangedEventArgs(propertyName);
         *      handler(this, e);
         *  }
         * }*/

        public MainWindow()
        {
            InitializeComponent();
            DataContext = this;

            Services.Tracker.Configure(this).IdentifyAs("State").Apply();
            this.genSettingsTrackingConfig = Services.Tracker.Configure(SettingsSingleton.Instance.genSettings);
            this.genSettingsTrackingConfig.IdentifyAs("MainWindow").Apply();

            var browserSettings = new BrowserSettings
            {
                FileAccessFromFileUrls      = CefState.Enabled,
                UniversalAccessFromFileUrls = CefState.Enabled
            };

            Browser1.BrowserSettings = browserSettings;
            CefSharpSettings.LegacyJavascriptBindingEnabled = true;

            //this.Browser1.RegisterAsyncJsObject("jsCallback", new JsCallbackFunctions());
            this.jsCallbackFunctions = new JsCallbackFunctions();
            Browser1.JavascriptObjectRepository.Register("jsCallback", this.jsCallbackFunctions, isAsync: true, options: BindingOptions.DefaultBinder);
        }