GeckoFX

Skybound

Skybound Software is looking to hire experienced C# developers to work on Stylizer and other forthcoming Skybound products. Click here for details.

GeckoFX is an open-source component which makes it easy to embed Mozilla Gecko (Firefox) into any .NET Windows Forms application. Written in clean, fully commented C#, GeckoFX is the perfect replacement for the default Internet Explorer-based WebBrowser control. Download GeckoFX @ Google Code >

GeckoFX is made by Skybound Software, authors of Stylizer—the professional CSS editor with a strong focus on visual control, error-free workflow, and productivity. Learn About Stylizer >

GeckoFX Forum

Discuss GeckoFX, the Open-Source Gecko Control for .NET

You are not logged in.

nsIDOMLoadStatus

#1 January 07, 2010 6:02 PM

Cmachine
Member
Registered: November 17, 2009
Posts: 22

nsIDOMLoadStatus

Hi everyone?

Do anybody know how to implement the nsIDOMLoadStatus interface properly??? I need to catch the Loaded attribute. Can it be associated to the nsIDOMEventTarget too? (check GeckoWebBrowser, OnHandleCreated method for reference)

Please describe if possible

Thanks in advance for your time.

Offline

 

#2 January 08, 2010 3:14 AM

KrippZ
Member
Registered: December 29, 2009
Posts: 10

Re: nsIDOMLoadStatus

Can't you use the DOMContentLoaded event instead, much easier to implement, or do you need the specifics of the other event?

/Cheers

Offline

 

#3 January 08, 2010 9:31 AM

Cmachine
Member
Registered: November 17, 2009
Posts: 22

Re: nsIDOMLoadStatus

Well, in fact I need to detect the DOMContentLoaded and load event to set some metrics in my application (as detected by firebug for example) http://www.softwareishard.com/blog/fire … e-monitor/.

I tried to implement this event (as referred here http://geckofx.org/viewtopic.php?id=434) without sucess.

Any other ideas?

Thanks in advance

Offline

 

#4 January 11, 2010 4:18 AM

KrippZ
Member
Registered: December 29, 2009
Posts: 10

Re: nsIDOMLoadStatus

Hi, I glad to help!

Well I've done it this way:

inside GeckoDomEvents.cs add:

Code:

public delegate void GeckoDOMContentLoadedEventHandler(object sender, GeckoDomEventArgs e);

inside GeckoWebBrowser.cs find:

Code:

protected override void OnHandleCreated(EventArgs e)

find

Code:

target.AddEventListener(new nsAString("click"), this, true);

add this

Code:

 target.AddEventListener(new nsAString("DOMContentLoaded"), this, true);

sets the event listner, I found that the DOMContentLoaded gets fired per default, without any interface adding.

find the method

Code:

void nsIDOMEventListener.HandleEvent(nsIDOMEvent e)

add to the switch

Code:

case "DOMContentLoaded": OnDOMContentLoaded(ea = new GeckoDomEventArgs(e)); break;

find the region "public event GeckoDomEventHandler DomSubmit" as you can see I've just copied the structure.
Add the following

Code:

region public event DOMContentLoadedEventHandler DOMContentLoaded
        [Category("DOM Events")]
        public event GeckoDOMContentLoadedEventHandler DOMContentLoaded
        {
            add { this.Events.AddHandler(DOMContentLoadedEvent, value); }
            remove { this.Events.RemoveHandler(DOMContentLoadedEvent, value); }
        }
        private static object DOMContentLoadedEvent = new object();

        protected virtual void OnDOMContentLoaded(GeckoDomEventArgs e)
        {
            if (((GeckoDOMContentLoadedEventHandler)this.Events[DOMContentLoadedEvent]) != null)
                ((GeckoDOMContentLoadedEventHandler)this.Events[DOMContentLoadedEvent])(this, e);
        }
        #endregion

Hope this helps

//Cheers
Krippz

Offline

 

#5 January 11, 2010 9:03 AM

Cmachine
Member
Registered: November 17, 2009
Posts: 22

Re: nsIDOMLoadStatus

Thank you so much my friend!!!

Best regards

:cool:

Offline

 

#6 January 30, 2010 7:56 PM

TimNZ
Member
Registered: January 28, 2010
Posts: 4

Re: nsIDOMLoadStatus

Big thanks to KrippZ,

With all your posts, I have managed to hook into all the normal and custom events I need to wrap up the system.

Offline

 

#7 February 02, 2010 9:59 AM

JeffJohnson
Member
Registered: January 15, 2010
Posts: 9

Re: nsIDOMLoadStatus

I added this to my compile of GeckoFX and it works a treat.

@KrippZ...great work man. It's a fairly simple solution but you have saved me loads of time thus far! Thanks again!!!!!!!!

Offline

 

#8 March 31, 2010 6:50 PM

hex
Member
Registered: March 13, 2010
Posts: 13

Re: nsIDOMLoadStatus

Does this event fires on AJAX requests ?

I need a way to detect when AJAX loading finishes....

Offline

 

Board footer