Web Control Events

The following table lists and describes web control events.

Note: A control should be available before subscribing to its events. It is possible to subscribe to an event of a given control only if the control has already been bound.

Event

Description

PropertyChanged

Fires when a property has changed on the control.

Clicked

Fires when a clickable button has been clicked.

Loaded

Fires when a webpage has completed loading.

If the webpage is set as a homepage and will be up during the initial start of IE, the Loaded event will not fire, and the user needs to use a URL property in order to get the proper URL from the page.

ReadyStateComplete

Fires when a web document state changes to complete.

This event fires only once, when the main document is complete. The Loaded event fires for every frame in the page.

For example:

protected virtual void WindowOpened(object sender, EventArgs e)

        {

            if (sender is IEMainWindow)

            {

                IEMainWindow ieWnd = sender as IEMainWindow;

 

                ieWnd.Loaded += (o, args) =>

                        {

                            if (args.Uri.ToString() == @"http://build2/webapp/tripadvisor1.html")

                            {

Loggers.EventsLogger.Info("WebFrameLoaded::Loaded");

                                SetResult(Success);

                            }

                        };

                ieWnd.GoTo(new Uri(@"http://build2/webapp/tripadvisor1.html"));

            }

        }

protected virtual void WindowOpened(object sender, EventArgs e)

        {

            if (sender is IEMainWindow)

            {

                IEMainWindow ieWnd = sender as IEMainWindow;

                ieWnd.submitWebButton.Clicked += (o, args) =>

                            {

Loggers.EventsLogger.Info("WebImageClicked::Clicked");

                                SetResult(true);  

                            };

                ieWnd.ExecuteScript(

                    "var e = document.getElementsByName(\"submit\");for (var i = 0; i < e.length; i++) { e[i].click(); }");

            }

        }

void srvc_WindowOpened(object sender, EventArgs e)

        {

            if (sender is IEMainWindow)

            {

                IEMainWindow mainWindow = (IEMainWindow) sender;

                mainWindow.userEmailWebEditBox.PropertyChanged += new EventHandler<PropChangedEventArgs>(userEmailWebEditBox_PropertyChanged);

                mainWindow.userEmailWebEditBox.Text = "a";

            }

        }

 

        void userEmailWebEditBox_PropertyChanged(object sender, PropChangedEventArgs e)

            {

            Loggers.EventsLogger.Info("WebPropChanged::PropertyChanged");

            SetResult(WebFrameLoaded.Success);

        }