Displaying spinner waiting indicator while loading web page - wpf

I have a WPF application that is loading web pages.
Some of the web pages taking long time.
I want to display an indicator like spinner
I have the spinner already and using it in other places of the WPF using the storyboard animation of the WPF.
The question is, can I use it in the web browser control?
Can you let the web browser control load in different thread than the UI thread?
Should I use Frame control or web browser control?
Thanks

Yes, use a Frame and handle the LoadCompleted event. In other words, show the spinner until LoadCompleted fires.
There is no need to use a separate thread for loading: The Frame control already provides for loading the content in the background.

Related

In Silverlight, How can I disable Back and Forward navigation using browser buttons?

I'm using the Navigational Framework in Silverlight 4. I'm starting to believe that this was a mistake as the browser buttons are really screwing things up for users. For instance, when a child window is opened the user believes they can close the window by pressing the back button. It doesn't close the window obviously, it just navigates the parent page back a step. The end result is a messed up data set. I'm fed up with the little control I have over the navigation of my application; forward and back buttons are anachronistic. Web applications don't work that way anymore. Please someone tell me how I can disable their functionality; that is, cancel navigation when it is started from one of these buttons.
Remove this code from your html page which holds your silverlight XAP:
<iframe id="_sl_historyFrame" style="visibility:hidden;height:0px;width:0px;border:0px"></iframe>
This is the history frame.
You will likely have to do this in the actual web/asp.net page, as Silverlight has no real control over the browser.
Some workarounds in this article:
http://lennilobel.wordpress.com/2009/07/26/defeat-the-evil-back-button-in-your-asp-net-applications/

Embedding of Webbrowser in WPF Form with Address bar + Buttons

I wouldlike to embed a webbrowser in a WPF application. The browser should look like a normal browser, with address bar, back and forward button and status bar. Is there a way how that could easily written in XAML, with a direct databinding of the address to a textbox, with a direct routing of events from the buttons to the webbrowser object, and the enabling back?
Why not?
Here and here are uploaded some screenshots from our application which has WebModule inside and is able to work like browser.
In our implementation we used Windows Forms WebBrowser control as browser engine and MVVM as communication pattern. Model has navigation commands (forward, back, ...) that raise proper events. View is handling this events and delegate requested actions to inner WebBrowser component. Additionally view is handling WebBrowser's events (NewWindow, DocumentCompleted, Navigating, Navigated) and setting up model's state.
Model and view together contain about 500 lines of code (I don't think it's very much, do you?).
Of course, I should mention, that due to using IE engine this browser could have some problems on complicated web-sites.
P.S. We didn't use System.Windows.Controls.WebBrowser because it does not provide access to NewWindow event.
P.P.S. I've posted this answer from browser in our WPF application. Good luck!

Silverlight App inside WPF WebBrowser?

I have a hopefully trivial question. Currently, my company works with a rather obscure language (SyngergyDE) and we need to call a SilverLight application inside our product. Unfortunately, this obscure 3rd party language only (currently) supports the opening of WPF screens. So with that said, I thought I'd develop a small WPF user control that contains a "WebBrowser" control and navigate to the silverlight application's URI. This works fine, and I'm able to see the SL application. Here is my question - we have a "Close" button on the SL application, and when users "Click" that button, we want the window to close.
Does anyone have any suggestions on how we can communicate the "Closing of the SL App" to the WPF user control, so that the entire WPF user control closes as well?
Thanks everyone,
-Tom
Attach an event handler to the WebBrowser.Navigated event.
Have the close button in the Silverlight application use:-
HtmlPage.Window.Navigate(new Uri("about:blank", UriKind.Absolute));
When the Navigated event fires in WPF with the url "about:blank" then its time to close the control.
Use Javascript and the HTML DOM as the glue here.
For example, when the SL app close button is clicked, have Silverlight trigger some Javascript code that sets a flag, or alternately, raises some HTML document event.
The WPF control could poll that flag in the HTML + Javascript, or alternately listen for that HTML document event, then close the user control.

Can I embeded IE in my wpf application and interact with it firing events

Can I embeded IE in my wpf application and interact with it firing events?
e.g. can I fill a form and press submit button programmatically?
Below is the link to the web browser control for WPF, this control was not part of the initial release of WPF, and was added in 3.5 SP1. As long as you are targeting 3.5 SP1 you can use this control and interact with the content in it. I have a WPF application that does use this control and we do a lot of JavaScript interactivity with the content from the browser by drawing on a WPF canvas and sending that information to the content API of the web browser control.
If you need an example I can look up some code samples from the application and send them your way.

opening a silverlight childWindow overlay on the viewport of the browser

I would like place a silverlight contol on an HTML page --- something about the size of a typical calendar control. However when the user selects a day on the control a bigger canvas opens up on top of the containing page --- something like a modal dialog box that you might find with the AJAX.
I'm wondering if this is even possible with Silverlight, or is the silverlight content limited in size to the DIV element on the host page?
UPDATE: after doing some poking around, I think the answer will involve using the ChildWindow control introduced with Silverlight 3. However I'm still at a loss how to have the ChildWindow display ontop of the existing content
I know one way, you will need javascript event on the page itself to expand a silverlight object to fit the whole page then build you silverlight event accordingly.

Resources