Esempio n. 1
0
        public Preview()
        {
            InitializeComponent();
            Browser.Navigate(UserTemplate.Load());
            UpdatePreview           = Utility.Debounce <string>(s => Dispatcher.InvokeAsync(() => Update(s)));
            Browser.Navigating     += BrowserOnNavigating;
            Browser.PreviewKeyDown += BrowserPreviewKeyDown;

            Task.Factory.StartNew(() =>
            {
                _templateWatcher = new FileSystemWatcher
                {
                    Path         = UserSettings.SettingsFolder,
                    Filter       = Path.GetFileName(UserTemplate.TemplateFile),
                    NotifyFilter = NotifyFilters.LastWrite
                };

                _templateWatcher.Changed            += (sender, args) => Dispatcher.Invoke(UpdateTemplate);
                _templateWatcher.EnableRaisingEvents = true;

                // kill popups
                dynamic activeX = Browser.GetType().InvokeMember("ActiveXInstance",
                                                                 BindingFlags.GetProperty | BindingFlags.Instance | BindingFlags.NonPublic,
                                                                 null, Browser, new object[] {});

                activeX.Silent = true;
            });
        }
Esempio n. 2
0
        public Preview()
        {
            InitializeComponent();
            Browser.Navigate(UserTemplate.Load());
            UpdatePreview           = Utility.Debounce <string>(s => Dispatcher.InvokeAsync(() => Update(s)));
            Browser.Navigating     += BrowserOnNavigating;
            Browser.PreviewKeyDown += BrowserPreviewKeyDown;

            Task.Factory.StartNew(() =>
            {
                _templateWatcher = Utility.WatchFile(UserTemplate.TemplateFile, () => Dispatcher.Invoke(UpdateTemplate));

                // kill popups
                dynamic activeX = Browser.GetType().InvokeMember("ActiveXInstance",
                                                                 BindingFlags.GetProperty | BindingFlags.Instance | BindingFlags.NonPublic,
                                                                 null, Browser, new object[] {});

                activeX.Silent = true;
            });
        }