Esempio n. 1
0
        private void SubscribeToContentChangedEvents(IHTMLElement2 body)
        {
            try
            {
                ContentChangedEvent = new HtmlEvent();
                body?.SubscribeTo(EventType.onkeydown, ContentChangedEvent);
                body?.SubscribeTo(EventType.onpaste, ContentChangedEvent);
                body?.SubscribeTo(EventType.oncut, ContentChangedEvent);

                Observable
                .FromEventPattern <IControlHtmlEventArgs>(
                    h => ContentChangedEvent.OnEvent += h,
                    h => ContentChangedEvent.OnEvent -= h
                    )
                .Throttle(TimeSpan.FromSeconds(0.6))
                .SubscribeOn(TaskPoolScheduler.Default)
                .Subscribe(_ => UpdateCurrentSuggestionSource());
            }
            catch (UnauthorizedAccessException) { }
            catch (COMException) { }
        }
Esempio n. 2
0
        private void SubscribeToKeyupEvent(IHTMLElement2 body)
        {
            try
            {
                KeyupEvent = new HtmlEvent();
                body?.SubscribeTo(EventType.onkeyup, KeyupEvent);

                Observable
                .FromEventPattern <IControlHtmlEventArgs>(
                    h => KeyupEvent.OnEvent += h,
                    h => KeyupEvent.OnEvent -= h
                    )
                .Select(x => new HtmlKeyInfo(x.EventArgs.EventObj))
                .Throttle(TimeSpan.FromSeconds(0.1))
                .SubscribeOn(TaskPoolScheduler.Default)
                .Subscribe(x => HandleKeyUp(x));
            }
            catch (UnauthorizedAccessException) { }
            catch (COMException) { }
        }
Esempio n. 3
0
 private void SubscribeToKeydownEvent(IHTMLElement2 body)
 {
     KeydownEvent = new HtmlEvent();
     body?.SubscribeTo(EventType.onkeydown, KeydownEvent);
     KeydownEvent.OnEvent += KeydownEventHandler;
 }