Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
using System;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using Microsoft.Phone.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Media;
using Windows.Storage;
using System.Diagnostics;
using System.IO;
namespace WPCordovaClassLib.Cordova.Commands
{
public class FileOpener2 : BaseCommand
{
public async void open(string options)
{
string[] args = JSON.JsonHelper.Deserialize<string[]>(options);
string aliasCurrentCommandCallbackId = args[2];
try
{
// Get the file.
StorageFile file = await Windows.Storage.StorageFile.GetFileFromPathAsync(args[0]);
// Launch the bug query file.
await Windows.System.Launcher.LaunchFileAsync(file);
DispatchCommandResult(new PluginResult(PluginResult.Status.OK), aliasCurrentCommandCallbackId);
}
catch (FileNotFoundException)
{
DispatchCommandResult(new PluginResult(PluginResult.Status.IO_EXCEPTION), aliasCurrentCommandCallbackId);
}
catch (Exception)
{
DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR), aliasCurrentCommandCallbackId);
}
}
}
}