public async Task <IEnumerable <Document> > Open() { var docs = new List <Document>(); var filepicker = new FileOpenPicker { ViewMode = PickerViewMode.List, SuggestedStartLocation = PickerLocationId.DocumentsLibrary, FileTypeFilter = { ".md", ".mdown", ".markdown", ".mkd" } }; var files = await filepicker.PickMultipleFilesAsync(); foreach (var file in files) { var d = new LocalDocument(file); await d.Load(); docs.Add(d); string token = StorageApplicationPermissions.FutureAccessList.Add(file, file.Name); _localSettings.Values[file.Name] = token; d.Token = token; } return(docs); }
public async Task<IEnumerable<Document>> Restore() { var docs = new List<Document>(); foreach (var f in _localSettings.Values) { var file = await StorageApplicationPermissions.FutureAccessList.GetFileAsync((string)f.Value); var d = new LocalDocument(file) { Token = (string)f.Value }; await d.Load(); docs.Add(d); } return docs; }
public static async Task<LocalDocument> FromPath(string path) { try { var file = await StorageApplicationPermissions.FutureAccessList.GetFileAsync(path, AccessCacheOptions.None); var d = new LocalDocument(file); await d.Load(); return d; }catch(Exception o_0) { return null; } }
public static async Task <LocalDocument> FromPath(string path) { try { var file = await StorageApplicationPermissions.FutureAccessList.GetFileAsync(path, AccessCacheOptions.None); var d = new LocalDocument(file); await d.Load(); return(d); }catch (Exception o_0) { return(null); } }
public async Task <IEnumerable <Document> > Restore() { var docs = new List <Document>(); foreach (var f in _localSettings.Values) { var file = await StorageApplicationPermissions.FutureAccessList.GetFileAsync((string)f.Value); var d = new LocalDocument(file) { Token = (string)f.Value }; await d.Load(); docs.Add(d); } return(docs); }
protected override void OnFileActivated(FileActivatedEventArgs args) { var locator = (ViewModelLocator)Resources["Locator"]; var files = args.Files; foreach (StorageFile file in files) { var x = new LocalDocument(file); x.Load(); locator.Main.Open(x); } var rootFrame = Window.Current.Content as Frame; if (rootFrame == null) { rootFrame = new Frame(); rootFrame.Navigate(typeof(MainPage)); Window.Current.Content = rootFrame; } Window.Current.Activate(); }
public async Task<IEnumerable<Document>> Open() { var docs = new List<Document>(); var filepicker = new FileOpenPicker { ViewMode = PickerViewMode.List, SuggestedStartLocation = PickerLocationId.DocumentsLibrary, FileTypeFilter = { ".md", ".mdown", ".markdown", ".mkd" } }; var files = await filepicker.PickMultipleFilesAsync(); foreach (var file in files) { var d = new LocalDocument(file); await d.Load(); docs.Add(d); string token = StorageApplicationPermissions.FutureAccessList.Add(file, file.Name); _localSettings.Values[file.Name] = token; } return docs; }
private async Task ShowHelp() { var doc = new LocalDocument(await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///Help.md"))); await doc.Load(); Open(doc); }