Example #1
0
 protected HtmlEvents(IElement _element)
 {
     this._element = _element;
     Interop.IHTMLDocument2 _document = _element.HtmlEditor.GetActiveDocument(false);
     if (_document == null)
     {
         return;
     }
     window = _document.GetParentWindow();
 }
Example #2
0
 private Interop.IHTMLEventObj GetEventObject()
 {
     _document = (Interop.IHTMLDocument2) this._element.GetDocument();
     try
     {
         Interop.IHTMLWindow2 window1 = _document.GetParentWindow();
         return(window1.@event);
     }
     catch
     {
         return(null);
     }
 }
Example #3
0
        public int OnChanged(int dispID)
        {
            try {
                switch (dispID)
                {
                case 1005 /*DISPID_FRAMECHANGE*/:
                    if (!_firstChanged)
                    {
                        _firstChanged = true;
                    }
                    //                    string readyState = MSHTMLDocument.GetReadyState();
                    //                    // the method will called after initialisation, this activates the site
                    //                    // for the first time. Subsequent calls does not fire the ready event again.
                    break;

                case DispId.READYSTATE:
                    string newReadyState = this.MSHTMLDocument.GetReadyState();
                    if (newReadyState != this._readyStateString)
                    {
                        _readyStateString = newReadyState;
                        if (_readyStateString.Equals("complete"))
                        {
                            if (winEvents != null)
                            {
                                winEvents.Dispose();
                                winEvents = null;
                            }
                            // global events
                            window    = htmlbaseDocument.GetParentWindow();
                            winEvents = new WindowsEvents(window, htmlEditor, htmlEditor.Window);
                        }
                        this.htmlEditor.OnReadyStateChanged(newReadyState);
                    }
                    break;
                }
            }
            catch {
                return(Interop.S_FALSE);
            }
            return(Interop.S_OK);
        }
Example #4
0
 internal FrameWindow(Interop.IHTMLWindow2 window, MSHTMLSite relatedSite, HtmlEditor htmlEditor)
 {
     this._relatedSite          = relatedSite;
     this.window                = window;
     this.doc                   = (Interop.IHTMLDocument2)window.document;
     this.url                   = ((Interop.IHTMLLocation)((Interop.IHTMLWindow2)doc.GetParentWindow()).location).href;
     this.body                  = (Interop.IHTMLElement3)doc.GetBody();
     this.framebase             = ((Interop.IHTMLWindow4)window).frameElement;
     this.htmlFormatter         = new HtmlFormatter();
     this.CommandTarget         = (Interop.IOleCommandTarget)doc;
     this.winEvents             = new FrameEvents(window, htmlEditor);
     this.winEvents.Activate   += new EventHandler(winEvents_Activate);
     this.winEvents.DeActivate += new EventHandler(winEvents_DeActivate);
     this.nativeElement         = (FrameElement)htmlEditor.GenericElementFactory.CreateElement(framebase as Interop.IHTMLElement);
 }