Welcome Guest Search | Active Topics | Sign In | Register

How to apply spinner for loading a page in WebBrowser Options
Mohammed Ayyub
Posted: Friday, February 24, 2023 6:15:31 AM
Rank: Member
Groups: Member

Joined: 2/8/2023
Posts: 14
Hi,

I am evaluating the EO WebBrowser for our product.
I want to apply the spinner while page is loading, should start on initiating the request and finish when the page is completely loaded.

Can you please help on this, which events I can use for that?

Regards
eo_support
Posted: Friday, February 24, 2023 10:56:42 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,071
Hi,

There are several different ways to do that. The easiest way is to use LoadUrlAsync. The code will be something like this:

Code: C#
//Reference EO.Extensions.dll and import namespace
//EO.Extensions is needed to use WebView.LoadUrlAsync
using EO.Extensions;

async void LoadUrl(WebView webView, string url)
{
    //Display the spinner
    ShowSpinner();
 
    try
    {
        //Load the url and wait for it to finish
        await webView.LoadUrlAsync(url);
    }
    finally
    {
        //Hide the spinner
        HideSpinner();
    }
}


Note that this uses async feature provided by .NET and it requires .NET Framework 4.6 or newer. You would also need to reference EO.Extension.dll in order to use LoadUrlAsync.

If you can not use async feature due to your project is based on older .NET Framework, then you would need to handle both LoadCompleted event and LoadFailed event.

Please feel free to let us know if you still have any more questions.

Thanks!
Mohammed Ayyub
Posted: Sunday, February 26, 2023 7:18:10 AM
Rank: Member
Groups: Member

Joined: 2/8/2023
Posts: 14
Hi,

Thank you so much for your quick response.
You answered my query, and it is working fine.

I have one more query, that is, I want to disable the browser context menu.
The reason is we have our own context menu and we do not want to display the default browser context menu.
Can you please assist on this?

Thanks.
Mohammed Ayyub
Posted: Monday, February 27, 2023 9:07:02 AM
Rank: Member
Groups: Member

Joined: 2/8/2023
Posts: 14
Hi,

Today morning I tried the shared example of loading spinner with 22.1.94.0 version, and it was working fine.

Now I downloaded the latest Nuget pkg 23.1.21.0, but it is not loading the page.
Can you please help on this?

One observation:
Version 22.1.94.0 does not required EO.Extension whereas the latest version requires it.

Thanks.
eo_support
Posted: Monday, February 27, 2023 11:05:24 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,071
Hi,

Please always use the latest version.

As to context menu, you can handle WebView.BeforeContextMenu event and call e.Menu.Items.Clear() in your event handler. You can check the source code in MainWindow.xaml.cs inside TabbedBrowser sample application source code for example of handling this event.

Thanks!
Mohammed Ayyub
Posted: Monday, February 27, 2023 9:41:23 PM
Rank: Member
Groups: Member

Joined: 2/8/2023
Posts: 14
Hi,

I am using the latest version only (Nuget pkg 23.1.21.0), but await webView.LoadUrlAsync(url); is not working.

I have included the reference of EO.Extensions also.

Can you please help on this?

Code: C#
using EO.Extensions;
        async void LoadUrl(WebView webView, string url)
        {
            //Display the spinner
            this.ShowProgressBar();

            try
            {
                //Load the url and wait for it to finish
                await webView.LoadUrlAsync(url); // The response is not coming from this API
            }
            finally
            {
                //Hide the spinner
                this.HideProgressBar();
            }
        }


The same code was working in previous version.
Thanks.
eo_support
Posted: Tuesday, February 28, 2023 10:45:56 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,071
Can you try to isolate the problem into a test project and then send the test project to us? See here for instructions:

https://www.essentialobjects.com/forum/test_project.aspx

Thanks
Mohammed Ayyub
Posted: Wednesday, March 1, 2023 11:31:16 PM
Rank: Member
Groups: Member

Joined: 2/8/2023
Posts: 14
Hi,

I have shared the sample project, can you please check that?

Regards,
eo_support
Posted: Thursday, March 2, 2023 11:27:36 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,071
Hi,

We ran your test project here and it successfully loaded Google's home page when you click the button. What problem do you have?

Thanks!
Mohammed Ayyub
Posted: Thursday, March 2, 2023 10:10:55 PM
Rank: Member
Groups: Member

Joined: 2/8/2023
Posts: 14
Hi,

For me it is not loading the page. And there is response after the below statement:

Code: C#
await webView.LoadUrlAsync(url);


If I use
Code: C#
webView.Url = url;
then it works fine. But this will not load the spinner.
eo_support
Posted: Friday, March 3, 2023 10:04:28 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,071
The code you sent to us does not have any code to load the spinner and when we run it it loads the page successfully. In order for us to investigate further we must have a sample project that can reproduce the problem first.
Mohammed Ayyub
Posted: Friday, March 3, 2023 10:37:24 PM
Rank: Member
Groups: Member

Joined: 2/8/2023
Posts: 14
Hi,

No need of spinner, without that also it is not working.

I crossed checked again and found that, on Form load it is not working, if I click on Go button then it is working.

So in my case I need to make it work on Form load itself. Can you please check whether the page is loading on Form load for you?

Thanks.
eo_support
Posted: Saturday, March 4, 2023 10:46:05 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,071
Mohammed Ayyub wrote:
I crossed checked again and found that, on Form load it is not working, if I click on Go button then it is working.


This is exactly why we ask you to send a test project to reproduce the problem. You can't just send us a test project that does one thing and then tell us by the way the problem occurs when you do something else. This is a waste of time for both of us.

Please resubmit a test project that can demonstrate the problem as well as detailed step by step instruction on how to reproduce the problem and we will investigate further.
Mohammed Ayyub
Posted: Saturday, March 4, 2023 10:07:14 PM
Rank: Member
Groups: Member

Joined: 2/8/2023
Posts: 14
Hi,

Got it.
I have sent the modified project where the actual issue is happening.

Steps to reproduce:
You need to just run the project, on load Google page should be loaded, but it is not loading.

Regards
eo_support
Posted: Monday, March 6, 2023 2:15:26 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,071
Hi,

We have received the new test project and confirmed this to be an issue in our library. This issue will be fixed in our next build.

Thanks!
Mohammed Ayyub
Posted: Monday, March 6, 2023 9:56:45 PM
Rank: Member
Groups: Member

Joined: 2/8/2023
Posts: 14
Hi,

Thanks for the update.
Can you please let us know when the next build will be available?

Regards,
eo_support
Posted: Tuesday, March 7, 2023 12:43:03 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,071
Yes. We will reply here again when the new build is available.
eo_support
Posted: Thursday, March 16, 2023 2:38:01 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,071
Hi,

This is just to let you know that we have posted build 23.1.45 that should resolve this issue. You can download the new build from our download page. Please take a look and let us know how it goes.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.