【发布时间】:2011-07-24 06:48:43
【问题描述】:
好的,我知道这是什么意思,但我不知道如何解决它
这是我的界面
public interface nsIDownloadProgressListener
{
nsIDOMDocument getDocument();
void setDocument(nsIDOMDocument doc);
void OnDownloadStateChange(short state, nsIDownload aDownload);
void OnStateChange(nsIWebProgress aWebProgress, nsIRequest aRequest, uint
aStateFlags, object aStatus, nsIDownload aDownload);
void OnProgressChange(nsIWebProgress WbProgress, nsIRequest aReq, int
curSelfProgress, int maxSelfProgress, int curTotalProgress, int
maxTotalProgress, nsIDownload aDownload);
void OnSecurityChange(nsIWebProgress wbProgress, nsIRequest aReq, uint
aState, nsIDownload aDownload);
}
这是我用来继承接口的类
public class DownloadProgressListenerClass : nsIDownloadProgressListener
{
#region nsIDownloadProgressListener Members
nsIDOMDocument Nothingreturned;
public nsIDOMDocument getDocument()
{
return Nothingreturned;
}
public void setDocument(nsIDOMDocument doc)
{
}
public void OnDownloadStateChange(short state, nsIDownload aDownload)
{
MessageBox.Show(aDownload.getId().ToString());
OnDownloadStateChange(state, aDownload);
}
public void OnStateChange(nsIWebProgress aWebProgress, nsIRequest aRequest, uint aStateFlags, object aStatus, nsIDownload aDownload)
{
MessageBox.Show(aDownload.getId().ToString());
}
public void OnProgressChange(nsIWebProgress WbProgress, nsIRequest aReq, int curSelfProgress, int maxSelfProgress, int curTotalProgress, int maxTotalProgress, nsIDownload aDownload)
{
MessageBox.Show(aDownload.getId().ToString());
}
public void OnSecurityChange(nsIWebProgress wbProgress, nsIRequest aReq, uint aState, nsIDownload aDownload)
{
MessageBox.Show(aDownload.getId().ToString());
}
#endregion nsIDownloadProgressListener Members
}
然后我尝试将侦听器添加到 DLManager,它应该可以工作并报告进度
DownloadProgressListenerClass DLListener = new DownloadProgressListenerClass();
DLManager = Xpcom.GetService<nsIDownloadManager>("@mozilla.org/download-manager;1");
DLManager.addListner(DLListener);
它有什么问题,因为它编译正确,但是当我尝试下载文件时,它不会触发任何东西,也不会按预期显示消息框
【问题讨论】:
-
为什么您的问题标题所指的内容不在您的问题正文中?
标签: c# .net class interface mozilla