Пример #1
0
        public static async Task <BreakdownModel> OpenBreakdown(string path = null)
        {
            StorageFile file = null;

            if (path == null)
            {
                FileOpenPicker openPicker = new FileOpenPicker();

                openPicker.ViewMode = PickerViewMode.Thumbnail;
                openPicker.SuggestedStartLocation = PickerLocationId.Downloads;
                openPicker.FileTypeFilter.Add(".brk");
                openPicker.FileTypeFilter.Add(".xml");


                file = await openPicker.PickSingleFileAsync();
            }
            else
            {
                file = await StorageFile.GetFileFromPathAsync(path);
            }

            if (file == null)
            {
                return(null);
            }

            var result = await StorageIO.OpenBreakdown(file);

            return(result);
        }
Пример #2
0
        public static async Task <FileModel> SelectAndOpenFile()
        {
            FileOpenPicker openPicker = new FileOpenPicker();

            openPicker.ViewMode = PickerViewMode.Thumbnail;
            openPicker.SuggestedStartLocation = PickerLocationId.PicturesLibrary;
            openPicker.FileTypeFilter.Add(".wmv");
            openPicker.FileTypeFilter.Add(".mp4");
            openPicker.FileTypeFilter.Add(".avi");
            openPicker.FileTypeFilter.Add(".mts");

            var openFileResponse = await openPicker.PickSingleFileAsync();

            if (openFileResponse == null)
            {
                return(null);
            }

            var result = await StorageIO.OpenFile(openFileResponse, true);

            return(result);
        }