public string[] showOpenDialog(BrowserWindow browserWindow, OpenDialogOptions options) { object[] result = null; if (browserWindow == null) { result = API.Apply <object[]>("showOpenDialog", options); } else { result = API.Apply <object[]>("showOpenDialog", browserWindow, options); } if (result == null) { return(null); } return(Array.ConvertAll(result, value => Convert.ToString(value))); }
public string[] showOpenDialog(BrowserWindow browserWindow, OpenDialogOptions options, Action <string[], string[]> callback) { if (callback == null) { return(showOpenDialog(browserWindow, options)); } string eventName = "_showOpenDialog"; CallbackItem item = null; item = API.CreateCallbackItem(eventName, (object[] args) => { API.RemoveCallbackItem(eventName, item); string[] filePaths = null; string[] bookmarks = null; if (args[0] != null) { JSObject _filesPaths = API.CreateObject <JSObject>(args[0]); filePaths = Array.ConvertAll( _filesPaths.API.GetValue() as object[], value => Convert.ToString(value) ); } if (args.Length > 1 && args[1] != null) { JSObject _bookmarks = API.CreateObject <JSObject>(args[0]); bookmarks = Array.ConvertAll( _bookmarks.API.GetValue() as object[], value => Convert.ToString(value) ); } callback?.Invoke(filePaths, bookmarks); }); if (browserWindow == null) { API.Apply("showOpenDialog", options, item); } else { API.Apply("showOpenDialog", browserWindow, options, item); } return(null); }
public string[] showOpenDialog(OpenDialogOptions options, Action <string[], string[]> callback) { return(showOpenDialog(null, options, callback)); }
/// <summary> /// Returns String[], an array of file paths chosen by the user, /// if the callback is provided it returns undefined. /// </summary> /// <param name="options"></param> /// <returns></returns> public string[] showOpenDialog(OpenDialogOptions options) { return(showOpenDialog(null, options)); }