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.

Show download manager window [proper?]

#1 November 08, 2008 4:23 PM

softwerx
Member
From: Goshen, IN, US
Registered: September 04, 2008
Posts: 466
Website

Show download manager window [proper?]

Is this the proper way to show the download manager? I'm only asking because it works and without using the navigate("javascript:") hack.

Interface:

Code:

    [Guid("ca7663d5-69e3-4c4a-b754-f462bd36b05f"), ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    interface nsIDownloadManagerUI
    {
        void show(nsIInterfaceRequestor aWindowContext,uint aID,short aReason);
        bool visible();
        void getAttention();
    }

In GeckoWebBrowser.cs:

Code:

//After Region: protected override void Dispose(bool disposing)....

nsIDownloadManagerUI DLManager;

//In: protected override void OnHandleCreated(EventArgs e)...
//After: BaseWindow.Create();
DLManager = Xpcom.CreateInstance<nsIDownloadManagerUI>("@mozilla.org/download-manager-ui;1");
DLManager = Xpcom.QueryInterface<nsIDownloadManagerUI>(DLManager);

//Somewhere in GeckoWebBrowser.cs:
        /// <summary>
        /// Shows the download manager
        /// </summary>
        /// <param name="SelectedDownload">index of the download to select when the manager is shown</param>
        /// <param name="Reason">the reason why the manager is being shown. pass 0 for user interacted or 1 for new download</param>
        public void ShowDownloadManager(uint SelectedDownload, short Reason)
        {
            if (!DLManager.visible())
            {
                DLManager.show(null, SelectedDownload, Reason);
            }
            else
            {
                DLManager.getAttention();
            }
        }

Offline

 

#2 February 21, 2009 12:37 AM

dhfola
Member
Registered: February 21, 2009
Posts: 1

Re: Show download manager window [proper?]

:)

TY ALOT i been trying 2 do this i cannot belived it worked :P

Offline

 

#3 August 21, 2009 1:30 PM

jdogg172
Member
Registered: August 20, 2009
Posts: 5

Re: Show download manager window [proper?]

When I try this method to show the download menu I get an InvalidCaseException was unhandled and DLManager.show(null, SelectedDownload, Reason) is highlighted.

Am I missing something?

Offline

 

#4 August 22, 2009 10:49 AM

websfera.pl
Member
Registered: September 10, 2008
Posts: 22

Re: Show download manager window [proper?]

Try this:

Code:

            
ChromeDialog dialog = new ChromeDialog();
dialog.Name = "DownloadsForm";
dialog.Show();
dialog.WebBrowser.Navigate("chrome://mozapps/content/downloads/downloads.xul");

Last edited by websfera.pl (August 22, 2009 10:50 AM)

Offline

 

#5 August 22, 2009 8:57 PM

softwerx
Member
From: Goshen, IN, US
Registered: September 04, 2008
Posts: 466
Website

Re: Show download manager window [proper?]

jdogg172 wrote:

When I try this method to show the download menu I get an InvalidCaseException was unhandled and DLManager.show(null, SelectedDownload, Reason) is highlighted.

Am I missing something?

Make sure you are placing the interface declaration in nsInterfaces.cs. Also, make sure

Code:

nsIDownloadManagerUI DLManager;

isn't null - the code I provided has no error checking.

Offline

 

#6 August 22, 2009 9:49 PM

jdogg172
Member
Registered: August 20, 2009
Posts: 5

Re: Show download manager window [proper?]

I replaced XULRunner 1.9.1 with 1.9.0 and it worked perfectly. Any reason why? I am going to try it with the new XULRunner later using your suggestions.

One issue however is that the clear list button does nothing on the download manager? Any ideas why?

Offline

 

#7 August 23, 2009 9:40 PM

softwerx
Member
From: Goshen, IN, US
Registered: September 04, 2008
Posts: 466
Website

Re: Show download manager window [proper?]

jdogg172 wrote:

I replaced XULRunner 1.9.1 with 1.9.0 and it worked perfectly. Any reason why? I am going to try it with the new XULRunner later using your suggestions.

I don't know why it isn't working with later versions of xulrunner -- i've used later versions than 1.9.0 and it still worked.

jdogg172 wrote:

One issue however is that the clear list button does nothing on the download manager? Any ideas why?

My suspicion is that xulrunner isn't handling the underlying method that is called when the button is clicked. It isn't anything that can be handled externally by an application that is using GeckoFX -- unless you can hook the api call from an unmanaged dll and handle the call in your application. That would take a lot of work and unless it's worth it to you I wouldn't bother with it and call it a bug.. specially if the project is just personal.. <-- that's just my opinion .. Good luck with your project

Offline

 

#8 August 24, 2009 1:41 PM

websfera.pl
Member
Registered: September 10, 2008
Posts: 22

Re: Show download manager window [proper?]

softwerx wrote:

I don't know why it isn't working with later versions of xulrunner -- i've used later versions than 1.9.0 and it still worked.

But we're talking about 1.9.1 - download manager doesn't work as it is in 1.9.0.* versions. I'm using it under 1.9.0.13.

softwerx wrote:

My suspicion is that xulrunner isn't handling the underlying method that is called when the button is clicked. It isn't anything that can be handled externally by an application that is using GeckoFX -- unless you can hook the api call from an unmanaged dll and handle the call in your application. That would take a lot of work and unless it's worth it to you I wouldn't bother with it and call it a bug.. specially if the project is just personal.. <-- that's just my opinion .. Good luck with your project

Xulrunner soesn't handling any of XUL methods. I've tried many XUL apps, and nothing happens. Isn't it bug in GeckoFX?

Offline

 

#9 December 26, 2009 9:04 PM

Marcello
Member
Registered: December 26, 2009
Posts: 3

Re: Show download manager window [proper?]

Hi all.
Sorry for bumping this topic, but for some reason I can get the Download Manager to show using the code provided in the first post, but unfortunately, I can't seem to download files.

I'm using XULRunner 1.9.0.16
I have a 64-bit OS, but it shouldn't matter since I set my projects to compile only to 32-bit code.

Anyway, If I click on a download link, this dialog appears:
http://osarchive.vndv.com/error.png

Any Ideas?

Thanks,

Marcello

Offline

 

#10 January 04, 2010 2:49 PM

Marcello
Member
Registered: December 26, 2009
Posts: 3

Re: Show download manager window [proper?]

*bump*

Is there any known way to fix it for my program?

Offline

 

#11 January 10, 2010 1:37 PM

JimmyEdmo
Member
From: Kent
Registered: October 23, 2009
Posts: 8
Website

Re: Show download manager window [proper?]

I don't have GeckoWebBrowser.cs anywhere, do I have to create it?

Offline

 

#12 January 10, 2010 10:47 PM

Marcello
Member
Registered: December 26, 2009
Posts: 3

Re: Show download manager window [proper?]

The file you're looking for is part of the geckofx source code.
Your best bet is to DL the source and add it to your solution.

Offline

 

#13 February 05, 2010 4:49 PM

AETCoder
Member
Registered: February 05, 2010
Posts: 6

Re: Show download manager window [proper?]

Which part of GeckoWebrowser.cs do you paste the code to can you give me the line number?

Offline

 

#14 February 22, 2010 3:41 PM

Ryan95
Member
Registered: October 21, 2009
Posts: 14

Re: Show download manager window [proper?]

Does downloading works under 1.9.0.1 if i add this?
I want to know sure before i try :p

Greetz.


My project: www.jaguar-browser.eu < Everything works, popups, tabs, favicons, printing, bookmarks.
If you need help with one of these things, just ask ;)

Offline

 

Board footer