Welcome Guest Search | Active Topics | Sign In | Register

Download Multiple Files Options
audreyruaburo
Posted: Monday, February 13, 2017 3:26:52 AM
Rank: Newbie
Groups: Member

Joined: 2/13/2017
Posts: 3
Hello Good day Support team,

How can i download multiple files using eo webbrowser?

i have a loop which contains multiple links. example 10 links

foreach (var item in ListofLinks){
wb.EvalScript(String.Format("window.location.href = '{0}'", item ));
}

but my problem is it only download a single file,

it doesn't download the last 9 file.


how can i make the eo webbrowser to download all the files? thank you very much.


Regards,
Audrey Ruaburo
eo_support
Posted: Monday, February 13, 2017 9:47:35 AM
Rank: Administration
Groups: Administration

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

You can either try to wait until the previous download has started (after BeforeDownload event has fired) before you start the next download, or use a different iframe for each download.

Thanks!
audreyruaburo
Posted: Monday, February 13, 2017 8:12:15 PM
Rank: Newbie
Groups: Member

Joined: 2/13/2017
Posts: 3
Hi,
Do you have a sample code? And can i download without the save dialog box? the web browser will save the files downloaded in a specified path. thank you
eo_support
Posted: Monday, February 13, 2017 8:14:32 PM
Rank: Administration
Groups: Administration

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

We do not have any sample code for specific user scenarios but if you have any questions in implementation please feel free to ask and we will be happy to point you to the right direction.

For the file dialog, please see here for more details:

https://www.essentialobjects.com/doc/webbrowser/customize/download.aspx

Thanks!
audreyruaburo
Posted: Monday, February 13, 2017 8:31:14 PM
Rank: Newbie
Groups: Member

Joined: 2/13/2017
Posts: 3
Hi,

Thank you for your quick reply,

i am trying to check the progress of download

i put the code on form load

wb.DownloadUpdated += Wb_DownloadUpdated;

and this is the code

private void Wb_DownloadUpdated(object sender, DownloadEventArgs e)
{
Console.WriteLine(e.Item.PercentageComplete);
}

but why does it doesn't update or promp the console? Thank you
eo_support
Posted: Tuesday, February 14, 2017 8:29:00 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,080
audreyruaburo wrote:
but why does it doesn't update or promp the console? Thank you


Please check whether the event handler is fired and whether e.Item.PercentageComplete gives you the right value. If those are correct then our product is functioning as it should and you will need to find out why Console.WriteLine does not work for you yourself.
Dilyan
Posted: Tuesday, February 21, 2017 9:07:27 AM
Rank: Newbie
Groups: Member

Joined: 2/21/2017
Posts: 3
audreyruaburo wrote:
Hi,
Do you have a sample code? And can i download without the save dialog box? the web browser will save the files downloaded in a specified path. thank you


eo_support wrote:
Hi,

We do not have any sample code for specific user scenarios but if you have any questions in implementation please feel free to ask and we will be happy to point you to the right direction.

For the file dialog, please see here for more details:

https://www.essentialobjects.com/doc/webbrowser/customize/download.aspx

Thanks!


Greetings,

I have the same question - how to make the browser save files in a specific path (e.g. C:\Downloads)? How to set its path and operate with it?
Basically what I want is: I have 2 options (radio buttons) - 1st one is for downloading in a specific location, 2nd one is for asking the user where to save the file, as it is by default. Under radio button 1 I have a button, which opens up Folder Browser. There's a text box next to it, the chosen file path goes inside it.

I really love what you have created, but need your help, I couldn't find anything in the documentation that could help me. Looking forward for an answer.

Regards,
Dilyan
eo_support
Posted: Tuesday, February 21, 2017 9:21:29 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,080
Hello Dilyan,

You will need to handle the WebView's FileDialog event. Inside your event handler you can display your own UI such as a small dialog with the two radio buttons you described. We do not care about how you display your UI nor how your UI functions internally. The only thing we need from you is the final file name your user or you have decided.

Here is an example of the flow of things:

1. FileDialog event is fired. Your handler is called;
2. In your handler you display a dialog with 2 radio buttons and file path text box (Let's say the name of the textbox is filePathTextBox);
3. User clicks the Browse button in your dialog and selected a file path;
4. The file path user selected is filled into the filePathTextBox;
5. User clicks OK in your dialog;
6. Your code calls e.Continue(filePathTextBox.Text) to pass the path user selected to the browser engine;

Here step 6 is the only step that matters to us. Step 2 to 5 are completely up to you. For example, you can skip all those steps and simply call e.Continue("c:/temp.dat") in your handler and the download will always be saved as "c:/temp.dat". The key is all you need to do is to give us the final file name (with full path). How you come up with that file name doesn't matter to the browser engine.

Hope this helps. Please let us know if this is clear enough for you.

Thanks!
Dilyan
Posted: Tuesday, February 21, 2017 10:48:18 AM
Rank: Newbie
Groups: Member

Joined: 2/21/2017
Posts: 3
Hello and thanks for the incredibly fast reply,

The two radio buttons are in a form where the user adjusts the settings. I don't want them to be in a FileDialog. I just gave more information about what I want to do, but what I want to know is how to let the browser know where to save files when there's no folder browser coming up for user to choose where. I want a previously set location for files to be saved. What code do I need to write for that, and where? Is it e.Continue? By the way, just to make sure we're clear, I'm working in VB.

Regards,
Dilyan
eo_support
Posted: Tuesday, February 21, 2017 10:51:19 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,080
The "FileDialog" mentioned in our previous reply is an event exposed by our WebView class. It is not a dialog.

The only code you need to write is to call e.Continue with whatever file name you want to use in your FileDialog event handler. The rest we don't care.

Is this clear enough?
Dilyan
Posted: Tuesday, February 21, 2017 11:23:35 AM
Rank: Newbie
Groups: Member

Joined: 2/21/2017
Posts: 3
No, I'm sorry. I'm really confused. I'm actually a student (been 2 years in VB though) that is still learning, but I'm not a beginner. Either way, I don't understand how do I do it, where do I type what. Is there any chance of you giving me an example code or something, please? I can't understand with just theory apparently. :X
eo_support
Posted: Tuesday, February 21, 2017 11:45:00 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,080
Dilyan wrote:
No, I'm sorry. I'm really confused. I'm actually a student (been 2 years in VB though) that is still learning, but I'm not a beginner. Either way, I don't understand how do I do it, where do I type what. Is there any chance of you giving me an example code or something, please? I can't understand with just theory apparently. :X


You will need to know what a .NET event is, and how to handle an event. The single line of code you will need to write will be in your event handler for the WebView's FileDialog event.

If you are not familiar with .NET event or event handler, you will need to learn that first and then come back after you become familiar with it. This is general .NET programming knowledge and skills that you must know in order to use our product. We are not in a position to fill in such gap for you.

Also after you become familiar with .NET event, you can take a look of the source code of the TabbedBrowser sample project in the "Samples" directory. The source code in both VB and C# are provided. The code handles many other WebView events, but not FileDialog event in particular. So do not expect to just copy and paste from our sample. You need to know what you are doing and be able to adapt the sample code to fit your need. This is why you must know basic things such as .NET event first.

If you are already familiar with .NET event, please explain which part you are still not clear about and we will be happy to assist you further if the part is not general .NET programming but is directly related to our product.

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.