コード例 #1
0
ファイル: LocalSource.cs プロジェクト: zhangxin8105/MarkPadRT
        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);
        }
コード例 #2
0
ファイル: LocalSource.cs プロジェクト: modulexcite/MarkPadRT
 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;
 }
コード例 #3
0
ファイル: LocalDocument.cs プロジェクト: kiwipom/MarkPadRT
 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;
     }
 }
コード例 #4
0
        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);
            }
        }
コード例 #5
0
ファイル: LocalSource.cs プロジェクト: zhangxin8105/MarkPadRT
        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);
        }
コード例 #6
0
ファイル: App.xaml.cs プロジェクト: modulexcite/MarkPadRT
        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();
        }
コード例 #7
0
ファイル: LocalSource.cs プロジェクト: JakeGinnivan/MarkPadRT
        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;
        }
コード例 #8
0
ファイル: MainViewModel.cs プロジェクト: kiwipom/MarkPadRT
 private async Task ShowHelp()
 {
     var doc = new LocalDocument(await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///Help.md")));
     await doc.Load();
     Open(doc);
 }