private async void PickFonts() { var picker = new FileOpenPicker(); foreach (var format in FontFinder.SupportedFormats) { picker.FileTypeFilter.Add(format); } picker.CommitButtonText = Localization.Get("FilePickerConfirm"); var files = await picker.PickMultipleFilesAsync(); if (files.Any()) { ViewModel.IsLoadingFonts = true; try { if (await FontFinder.ImportFontsAsync(files.ToList()) is FontImportResult result && result.Imported.Count > 0) { ViewModel.RefreshFontList(); ViewModel.TrySetSelectionFromImport(result); } } finally { ViewModel.IsLoadingFonts = false; } } }
private async void Grid_Drop(object sender, DragEventArgs e) { if (e.DataView.Contains(StandardDataFormats.StorageItems)) { ViewModel.IsLoadingFonts = true; try { var items = await e.DataView.GetStorageItemsAsync(); if (await FontFinder.ImportFontsAsync(items) is FontImportResult result) { if (result.Imported.Count > 0) { ViewModel.RefreshFontList(); ViewModel.TrySetSelectionFromImport(result); } ShowImportResult(result); } } finally { ViewModel.IsLoadingFonts = false; } } }