private async void fileOpenButton_Click(object sender, RoutedEventArgs e) { var picker = new Windows.Storage.Pickers.FileOpenPicker(); picker.ViewMode = Windows.Storage.Pickers.PickerViewMode.Thumbnail; picker.SuggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.Desktop; picker.FileTypeFilter.Add(".txt"); var files = await picker.PickMultipleFilesAsync(); { foreach (StorageFile i in files) { UploadedFile nf = new UploadedFile(i); await nf.GetFileSz(); uploadedFileLists.Add(nf); } } }
private async void Canvas_Drop(object sender, DragEventArgs e) { if (e.DataView.Contains(StandardDataFormats.StorageItems)) { var items = await e.DataView.GetStorageItemsAsync(); if (items.Any()) { foreach (var item in items) { var storageFile = item as StorageFile; var FileType = storageFile.FileType; if (FileType == ".txt") { UploadedFile nf = new UploadedFile(storageFile); await nf.GetFileSz(); uploadedFileLists.Add(nf); } } } } }