|
1 | 1 | // Copyright (c) Files Community |
2 | 2 | // Licensed under the MIT License. |
3 | 3 |
|
| 4 | +using Files.App.Extensions; |
4 | 5 | using Microsoft.UI.Xaml.Controls; |
5 | 6 | using Windows.Foundation.Metadata; |
6 | 7 | using Windows.Storage; |
@@ -40,17 +41,20 @@ public static async void WriteFileTag(string filePath, string[] tag) |
40 | 41 | var result = Win32Helper.WriteStringToFile($"{filePath}:files", string.Join(',', tag)); |
41 | 42 | if (result == false) |
42 | 43 | { |
43 | | - ContentDialog dialog = new() |
| 44 | + await MainWindow.Instance.DispatcherQueue.EnqueueOrInvokeAsync(async () => |
44 | 45 | { |
45 | | - Title = Strings.ErrorApplyingTagTitle.GetLocalizedResource(), |
46 | | - Content = Strings.ErrorApplyingTagContent.GetLocalizedResource(), |
47 | | - PrimaryButtonText = "Ok".GetLocalizedResource() |
48 | | - }; |
| 46 | + ContentDialog dialog = new() |
| 47 | + { |
| 48 | + Title = Strings.ErrorApplyingTagTitle.GetLocalizedResource(), |
| 49 | + Content = Strings.ErrorApplyingTagContent.GetLocalizedResource(), |
| 50 | + PrimaryButtonText = "Ok".GetLocalizedResource() |
| 51 | + }; |
49 | 52 |
|
50 | | - if (ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 8)) |
51 | | - dialog.XamlRoot = MainWindow.Instance.Content.XamlRoot; |
| 53 | + if (ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 8)) |
| 54 | + dialog.XamlRoot = MainWindow.Instance.Content.XamlRoot; |
52 | 55 |
|
53 | | - await dialog.TryShowAsync(); |
| 56 | + await dialog.TryShowAsync(); |
| 57 | + }); |
54 | 58 | } |
55 | 59 | } |
56 | 60 | if (isReadOnly) // Restore read-only attribute (#7534) |
|
0 commit comments