Пример #1
0
 public BookPdf(Windows.Storage.IStorageFile file)
 {
     Task.Run(async() =>
     {
         await LoadAsync(file ?? throw new ArgumentNullException(nameof(file)));
     });
 }
Пример #2
0
        public async Task Load(Windows.Storage.IStorageFile file)
        {
            Content = await pdf.PdfDocument.LoadFromFileAsync(file);

            OnLoaded(new EventArgs());
            PageLoaded = true;
            ID         = Functions.CombineStringAndDouble(file.Name, Content.PageCount);
        }
Пример #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="StorageFile"/> class.
        /// </summary>
        /// <param name="parentFolder">
        /// The parent folder.
        /// </param>
        /// <param name="file">
        /// The associated <see cref="StorageFile"/>.
        /// </param>
        internal StorageFile(IStorageFolder parentFolder, Windows.Storage.IStorageFile file)
        {
            if (file == null)
            {
                throw new ArgumentNullException(nameof(file));
            }

            this.file   = file;
            this.Parent = parentFolder;
        }
Пример #4
0
        /// <inheritdoc/>
        public async Task <bool> PickFile()
        {
            FileOpenPicker filePicker = new FileOpenPicker();

            filePicker.SuggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.Desktop;
            filePicker.SettingsIdentifier     = "oiwurei223i4u";
            filePicker.FileTypeFilter.Add("*");

            _pickedFile = await filePicker.PickSingleFileAsync();

            return(_pickedFile != null);
        }
Пример #5
0
        /// <summary>
        /// Copy file to destination
        /// </summary>
        /// <param name="Source"></param>
        /// <param name="Destination"></param>
        /// <returns></returns>
        public static async Task <IStorageFile> Copy(String Source, String Destination)
        {
            Windows.Storage.IStorageFile File = await GetFile(Source);

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

            Windows.Storage.IStorageFile CopiedFile = await File.CopyAsync(Windows.Storage.ApplicationData.Current.LocalFolder, Destination, NameCollisionOption.ReplaceExisting);

            return(CopiedFile);
        }
Пример #6
0
        /// <summary>
        /// Store the content to the local storage of this device
        /// </summary>
        /// <param name="Content"></param>
        /// <param name="Filename"></param>
        public static async Task Delete(String Filename)
        {
            try
            {
                Windows.Storage.IStorageFile File = await GetFile(Filename);

                await File.DeleteAsync();
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine(e.Message);
            }
        }
Пример #7
0
 public UwpFile(Windows.Storage.IStorageFile file)
 {
     File    = file;
     HasPath = File.Path != null;
 }
Пример #8
0
 public FileUWP(Windows.Storage.IStorageFile content)
 {
     this.ContentUWP = content ?? throw new ArgumentNullException(nameof(content));
 }