diff --git a/plugin.xml b/plugin.xml index a7008e7..3e7ad67 100644 --- a/plugin.xml +++ b/plugin.xml @@ -39,11 +39,19 @@ - - - - - - + + + + + + + + + + + + + + diff --git a/src/windows/fileOpener2Proxy.js b/src/windows/fileOpener2Proxy.js new file mode 100644 index 0000000..71692ca --- /dev/null +++ b/src/windows/fileOpener2Proxy.js @@ -0,0 +1,26 @@ + + var cordova = require('cordova'), + fileOpener2 = require('./FileOpener2'); + + module.exports = { + + open: function (successCallback, errorCallback, args) { + Windows.Storage.StorageFile.getFileFromPathAsync(args[0]).then(function (file) { + var options = new Windows.System.LauncherOptions(); + options.displayApplicationPicker = true; + + Windows.System.Launcher.launchFileAsync(file, options).then(function (success) { + if (success) { + successCallback(); + } else { + errorCallback(); + } + }); + + }); + } + + }; + + require("cordova/exec/proxy").add("FileOpener2", module.exports); + diff --git a/src/wp8/FileOpener2.cs b/src/wp8/FileOpener2.cs index 9c389e7..b19604d 100644 --- a/src/wp8/FileOpener2.cs +++ b/src/wp8/FileOpener2.cs @@ -17,16 +17,13 @@ namespace WPCordovaClassLib.Cordova.Commands public async void open(string options) { string[] args = JSON.JsonHelper.Deserialize(options); - var fileName = System.IO.Path.GetFileName(args[0]); + string aliasCurrentCommandCallbackId = args[2]; try { - // Access isolated storage. - StorageFolder local = Windows.Storage.ApplicationData.Current.LocalFolder; - - // Access the file. - StorageFile file = await local.GetFileAsync(fileName); + // Get the file. + StorageFile file = await Windows.Storage.StorageFile.GetFileFromPathAsync(args[0]); // Launch the bug query file. await Windows.System.Launcher.LaunchFileAsync(file);