Использование C # и geckofx autoselect file для загрузки
использование c # и geckofx
Как поместить файл в объект filepicker, не открывая диалоговую форму?
Что я уже пробовал:
internal class myFileDialog: nsIFilePicker, IDisposable { nsIFilePicker filePicker = null; public myFileDialog(): base() { filePicker = _filepicker; } short _mode = 0; public void Init(nsIDOMWindow parent, nsAStringBase title, short mode) { _mode = mode; //_mode = 0; filePicker.Init(parent, title, mode); } public void AppendFilters(int filterMask) { } public void AppendFilter(nsAStringBase title, nsAStringBase filter) { } public void GetDefaultStringAttribute(nsAStringBase aDefaultString) { } public void SetDefaultStringAttribute(nsAStringBase aDefaultString) { } public void GetDefaultExtensionAttribute(nsAStringBase aDefaultExtension) { } public void SetDefaultExtensionAttribute(nsAStringBase aDefaultExtension) { } public int GetFilterIndexAttribute() { return -1; } public void SetFilterIndexAttribute(int aFilterIndex) { } public nsIFile GetDisplayDirectoryAttribute() { throw new NotImplementedException(); } public void SetDisplayDirectoryAttribute(nsIFile aDisplayDirectory) { } public nsIFile GetFileAttribute() { throw new NotImplementedException(); } public nsIURI GetFileURLAttribute() { throw new NotImplementedException(); } public nsISimpleEnumerator GetFilesAttribute() { //return this.filePicker.GetFilesAttribute(); return new myFilesEnum(this.filePicker.GetFilesAttribute()); } public nsISupports GetDomfileAttribute() { return this.filePicker.GetDomfileAttribute(); throw new NotImplementedException(); } public nsISimpleEnumerator GetDomfilesAttribute() //<----- here solution { //_filepicker = Xpcom.CreateInstance<nsIFilePicker>("@mozilla.org/filepicker;1"); //nsISimpleEnumerator nsie = Xpcom.CreateInstance<nsISimpleEnumerator>("@mozilla.org/SimpleEnumerator;1"); //nsISimpleEnumerator rst = this.filePicker.GetDomfilesAttribute(); //nsISupports s = rst.GetNext(); //nsILocalFile fl = Xpcom.QueryInterface<nsILocalFile>(s); //return rst; //nsISimpleEnumerator xb = new myFilesEnum(); nsISimpleEnumerator r = this.filePicker.GetDomfilesAttribute(); //nsISupports rs = r.GetNext(); //return r; return new myFilesEnum(this.filePicker.GetDomfilesAttribute()); } public bool GetAddToRecentDocsAttribute() { throw new NotImplementedException(); } public void SetAddToRecentDocsAttribute(bool aAddToRecentDocs) { throw new NotImplementedException(); } public short Show() { return 0; } public void Open(nsIFilePickerShownCallback aFilePickerShownCallback) { this.filePicker.Open(aFilePickerShownCallback); //aFilePickerShownCallback.Done(0); } public short GetModeAttribute() { //return 0; return _mode; } public void Dispose() { } }