From 2a3f63967089a5d9b5b3fef3270756a67229d412 Mon Sep 17 00:00:00 2001 From: Marco Gavelli Date: Mon, 15 Aug 2022 02:31:19 +0200 Subject: [PATCH 01/99] Run update assistant --- .../Files.Uwp.Storage.csproj | 100 +- .../FtpStorage/FtpFileSystemService.cs | 2 +- .../FtpStorage/FtpHelpers.cs | 2 +- .../FtpStorage/FtpManager.cs | 2 +- .../FtpStorage/FtpStorable.cs | 2 +- .../FtpStorage/FtpStorageFile.cs | 2 +- .../FtpStorage/FtpStorageFolder.cs | 2 +- src/Files.Uwp.Storage/IsExternalInit.cs | 2 +- .../Properties/AssemblyInfo.cs | 29 - .../WindowsStorage/WindowsStorable.cs | 2 +- .../WindowsStorage/WindowsStorageFile.cs | 2 +- .../WindowsStorage/WindowsStorageFolder.cs | 2 +- src/Files.Uwp/App.xaml.cs | 781 +-------- src/Files.Uwp/App.xaml.old.cs | 758 +++++++++ src/Files.Uwp/BaseLayout.cs | 36 +- .../Behaviors/StickyHeaderBehavior.cs | 20 +- .../CommandLine/CommandLineParser.cs | 2 +- src/Files.Uwp/CommandLine/ParsedCommand.cs | 2 +- .../CommandLine/ParsedCommandType.cs | 2 +- src/Files.Uwp/CommandLine/ParsedCommands.cs | 2 +- src/Files.Uwp/Constants.cs | 2 +- src/Files.Uwp/Controllers/IJson.cs | 2 +- .../Controllers/SidebarPinnedController.cs | 2 +- .../Controllers/TerminalController.cs | 2 +- .../Converters/BoolToSelectionMode.cs | 6 +- src/Files.Uwp/Converters/Converters.cs | 6 +- .../Converters/DateTimeOffsetToString.cs | 4 +- .../Converters/DoubleArrayToString.cs | 4 +- src/Files.Uwp/Converters/DoubleToString.cs | 4 +- src/Files.Uwp/Converters/IntToGroupOption.cs | 4 +- .../Converters/IntToSortDirection.cs | 4 +- src/Files.Uwp/Converters/IntToSortOption.cs | 4 +- .../Converters/MiddleTextEllipsisConverter.cs | 4 +- .../Converters/MultiBooleanConverter.cs | 4 +- .../StorageDeleteOptionToBooleanConverter.cs | 4 +- .../Converters/StringArrayToString.cs | 4 +- src/Files.Uwp/Converters/UInt32ToString.cs | 4 +- .../Converters/VisibilityInvertConverter.cs | 6 +- .../Converters/WidthToRightMargin.cs | 6 +- .../DataModels/DefaultLanguageModel.cs | 2 +- .../NavigationControlItems/DriveItem.cs | 6 +- .../NavigationControlItems/FileTagItem.cs | 2 +- .../INavigationControlItem.cs | 2 +- .../NavigationControlItems/LocationItem.cs | 6 +- .../NavigationControlItems/WslDistroItem.cs | 2 +- .../DataModels/SidebarPinnedModel.cs | 2 +- src/Files.Uwp/DataModels/Terminal.cs | 2 +- src/Files.Uwp/DataModels/TerminalFileModel.cs | 2 +- src/Files.Uwp/Dialogs/AddItemDialog.xaml.cs | 14 +- .../Dialogs/CredentialDialog.xaml.cs | 14 +- .../Dialogs/DecompressArchiveDialog.xaml.cs | 4 +- src/Files.Uwp/Dialogs/DynamicDialog.xaml.cs | 6 +- .../Dialogs/ElevateConfirmDialog.xaml.cs | 14 +- .../Dialogs/FilesystemOperationDialog.xaml.cs | 28 +- .../Dialogs/PropertiesDialog.xaml.cs | 4 +- src/Files.Uwp/Dialogs/SettingsDialog.xaml.cs | 30 +- .../Bundles/BundlesOpenPathEventArgs.cs | 2 +- .../EventArguments/LayoutModeEventArgs.cs | 2 +- .../LayoutPreferenceEventArgs.cs | 2 +- src/Files.Uwp/Extensions/EnumExtensions.cs | 2 +- .../Extensions/ImageSourceExtensions.cs | 2 +- .../KeyboardAcceleratorExtensions.cs | 14 +- .../Extensions/ShellNewEntryExtensions.cs | 2 +- src/Files.Uwp/Extensions/StringExtensions.cs | 2 +- src/Files.Uwp/Files.Uwp.csproj | 1512 +---------------- .../BaseStorage/BaseBasicProperties.cs | 2 +- .../BaseBasicStorageItemExtraProperties.cs | 2 +- .../Filesystem/BaseStorage/BaseStorageFile.cs | 2 +- .../BaseStorage/BaseStorageFolder.cs | 2 +- .../BaseStorageItemExtraProperties.cs | 2 +- .../BaseStorage/IBaseStorageFile.cs | 2 +- .../BaseStorage/IBaseStorageFolder.cs | 2 +- .../Cloud/CloudDriveSyncStatusUI.cs | 2 +- .../Cloud/Detector/AbstractCloudDetector.cs | 2 +- .../Cloud/Detector/AppleCloudDetector.cs | 2 +- .../Cloud/Detector/BoxCloudDetector.cs | 2 +- .../Cloud/Detector/CloudDetector.cs | 2 +- .../Cloud/Detector/DropBoxCloudDetector.cs | 2 +- .../Cloud/Detector/GenericCloudDetector.cs | 2 +- .../Detector/GoogleDriveCloudDetector.cs | 2 +- .../Detector/SynologyDriveCloudDetector.cs | 2 +- src/Files.Uwp/Filesystem/FileTagsHelper.cs | 2 +- src/Files.Uwp/Filesystem/FileTagsManager.cs | 2 +- .../FilesystemItemType.cs | 2 +- .../FilesystemOperations.cs | 16 +- .../Helpers/FilesystemHelpers.cs | 2 +- .../Helpers/IFilesystemHelpers.cs | 2 +- .../IFilesystemOperations.cs | 2 +- .../ShellFilesystemOperations.cs | 2 +- src/Files.Uwp/Filesystem/FolderHelpers.cs | 2 +- src/Files.Uwp/Filesystem/FtpManager.cs | 2 +- .../Filesystem/LibraryLocationItem.cs | 2 +- src/Files.Uwp/Filesystem/LibraryManager.cs | 2 +- src/Files.Uwp/Filesystem/ListedItem.cs | 6 +- .../Filesystem/NetworkDrivesManager.cs | 2 +- .../Permissions/FilePermissionsManager.cs | 2 +- .../Permissions/FileSystemAccessRule.cs | 2 +- .../Permissions/FileSystemAccessRuleForUI.cs | 2 +- .../Filesystem/Permissions/RulesForUser.cs | 2 +- .../Filesystem/Permissions/UserGroup.cs | 2 +- src/Files.Uwp/Filesystem/RecentItem.cs | 4 +- .../Filesystem/RecentItemsManager.cs | 4 +- .../Filesystem/Search/FolderSearch.cs | 2 +- .../UniversalStorageEnumerator.cs | 4 +- .../Win32StorageEnumerator.cs | 4 +- .../StorageFileHelpers/FilesystemResult.cs | 2 +- .../StorageFileHelpers/FilesystemTasks.cs | 2 +- .../IStorageItemWithPath.cs | 2 +- .../StorageFileExtensions.cs | 2 +- .../StorageFileHelpers/StorageFileWithPath.cs | 2 +- .../StorageFolderWithPath.cs | 2 +- .../Helpers/StorageHistoryHelpers.cs | 2 +- .../StorageHistory/IStorageHistory.cs | 2 +- .../IStorageHistoryOperations.cs | 2 +- .../StorageHistory/StorageHistory.cs | 2 +- .../StorageHistoryOperations.cs | 2 +- .../StorageHistory/StorageHistoryWrapper.cs | 2 +- .../StorageItems/BaseQueryResults.cs | 2 +- .../Filesystem/StorageItems/FtpStorageFile.cs | 2 +- .../StorageItems/FtpStorageFolder.cs | 2 +- .../StorageItems/NativeStorageFile.cs | 2 +- .../StorageItems/ShellStorageFile.cs | 2 +- .../StorageItems/ShellStorageFolder.cs | 2 +- .../StorageItems/StreamWithContentType.cs | 2 +- .../StorageItems/SystemStorageFile.cs | 2 +- .../StorageItems/SystemStorageFolder.cs | 2 +- .../StorageItems/VirtualStorageItem.cs | 2 +- .../Filesystem/StorageItems/ZipStorageFile.cs | 2 +- .../StorageItems/ZipStorageFolder.cs | 2 +- src/Files.Uwp/Filesystem/WSLDistroManager.cs | 2 +- .../Helpers/AdaptiveLayoutHelpers.cs | 2 +- .../Helpers/AppServiceConnectionHelper.cs | 6 +- src/Files.Uwp/Helpers/AppUpdater.cs | 14 +- .../Helpers/AsyncManualResetEvent.cs | 2 +- src/Files.Uwp/Helpers/BitmapHelper.cs | 4 +- src/Files.Uwp/Helpers/CollectionDebugView.cs | 2 +- src/Files.Uwp/Helpers/ColorHelpers.cs | 2 +- src/Files.Uwp/Helpers/CommonPaths.cs | 2 +- .../Helpers/ContextFlyoutItemHelper.cs | 6 +- .../Helpers/Convert/ErrorCodeConverter.cs | 2 +- src/Files.Uwp/Helpers/DialogDisplayHelper.cs | 8 +- src/Files.Uwp/Helpers/DispatcherHelper.cs | 6 +- src/Files.Uwp/Helpers/DriveHelpers.cs | 2 +- src/Files.Uwp/Helpers/DynamicDialogFactory.cs | 14 +- .../Helpers/EnumConversionHelpers.cs | 2 +- .../Helpers/ExternalResourcesHelper.cs | 6 +- src/Files.Uwp/Helpers/FileExtensionHelpers.cs | 2 +- .../FileListCache/FileListCacheController.cs | 2 +- .../Helpers/FileListCache/IFileListCache.cs | 2 +- .../Helpers/FilePropertiesHelpers.cs | 58 +- src/Files.Uwp/Helpers/FileThumbnailHelper.cs | 2 +- src/Files.Uwp/Helpers/Fractions.cs | 2 +- src/Files.Uwp/Helpers/FtpHelpers.cs | 2 +- src/Files.Uwp/Helpers/IntervalSampler.cs | 2 +- .../BlockingListEnumerator.cs | 2 +- .../GroupedCollection.cs | 4 +- .../ItemListDisplayHelpers/GroupingHelper.cs | 2 +- .../ItemListDisplayHelpers/SortingHelper.cs | 2 +- .../ItemModelListToContextFlyoutHelper.cs | 8 +- .../Helpers/ItemsDataTemplateSelector.cs | 6 +- src/Files.Uwp/Helpers/KnownTypesBinder.cs | 2 +- .../LayoutPreferences/LayoutPreferences.cs | 2 +- .../LayoutPreferences/LayoutPrefsDb.cs | 2 +- src/Files.Uwp/Helpers/LibraryHelper.cs | 6 +- src/Files.Uwp/Helpers/LocalizedEnumHelper.cs | 2 +- src/Files.Uwp/Helpers/MenuFlyoutHelper.cs | 10 +- .../Helpers/MultitaskingTabsHelpers.cs | 2 +- .../Helpers/NativeDirectoryChangesHelper.cs | 2 +- .../Helpers/NativeFileOperationsHelper.cs | 2 +- .../Helpers/NativeIoDeviceControlHelper.cs | 2 +- src/Files.Uwp/Helpers/NativeWinApiHelper.cs | 10 +- .../Helpers/NaturalStringComparer.cs | 2 +- src/Files.Uwp/Helpers/NavigationHelpers.cs | 13 +- src/Files.Uwp/Helpers/PackageHelper.cs | 2 +- src/Files.Uwp/Helpers/PathNormalization.cs | 2 +- src/Files.Uwp/Helpers/PostBannerHelpers.cs | 2 +- src/Files.Uwp/Helpers/QuickLookHelpers.cs | 2 +- src/Files.Uwp/Helpers/RecycleBinHelpers.cs | 14 +- src/Files.Uwp/Helpers/ResourceHelpers.cs | 4 +- src/Files.Uwp/Helpers/SecondaryTileHelper.cs | 11 +- .../Helpers/ShellContextMenuHelper.cs | 2 +- src/Files.Uwp/Helpers/SidebarHelpers.cs | 2 +- .../Helpers/StorageItemIconHelpers.cs | 2 +- src/Files.Uwp/Helpers/StorageSenseHelper.cs | 2 +- src/Files.Uwp/Helpers/ThemeHelper.cs | 19 +- src/Files.Uwp/Helpers/UIFilesystemHelpers.cs | 2 +- src/Files.Uwp/Helpers/UIHelpers.cs | 22 +- src/Files.Uwp/Helpers/UniversalLogWriter.cs | 2 +- src/Files.Uwp/Helpers/WallpaperHelpers.cs | 2 +- src/Files.Uwp/Helpers/WidgetsHelpers.cs | 2 +- src/Files.Uwp/Helpers/Win32Helpers.cs | 2 +- .../Helpers/WindowDecorationsHelper.cs | 2 +- .../XamlHelpers/DependencyObjectHelpers.cs | 6 +- .../Helpers/XamlHelpers/SystemTypeToXaml.cs | 2 +- src/Files.Uwp/Helpers/ZipHelpers.cs | 2 +- src/Files.Uwp/IAddressToolbar.cs | 4 +- src/Files.Uwp/IBaseLayout.cs | 2 +- src/Files.Uwp/ISearchBox.cs | 4 +- src/Files.Uwp/IShellPage.cs | 2 +- src/Files.Uwp/Imaging/BitmapImageModel.cs | 4 +- .../BaseLayoutCommandImplementationModel.cs | 25 +- .../Interacts/BaseLayoutCommandsViewModel.cs | 6 +- .../IBaseLayoutCommandImplementationModel.cs | 6 +- .../Interacts/IStatusCenterActions.cs | 2 +- .../Interacts/ItemManipulationModel.cs | 2 +- src/Files.Uwp/Interacts/RemovableDevice.cs | 2 +- src/Files.Uwp/IsExternalInit.cs | 2 +- src/Files.Uwp/MainWindow.xaml | 43 + src/Files.Uwp/MainWindow.xaml.cs | 153 ++ src/Files.Uwp/Package.appxmanifest | 14 +- src/Files.Uwp/Program.cs | 4 +- src/Files.Uwp/Properties/AssemblyInfo.cs | 30 - .../Serialization/BaseJsonSettings.cs | 2 +- .../BaseObservableJsonSettings.cs | 2 +- .../Serialization/IJsonSettingsDatabase.cs | 2 +- .../Serialization/IJsonSettingsSerializer.cs | 2 +- .../Serialization/ISettingsSerializer.cs | 2 +- .../Serialization/ISettingsSharingContext.cs | 2 +- .../CachingJsonSettingsDatabase.cs | 2 +- .../DefaultJsonSettingsDatabase.cs | 2 +- .../DefaultJsonSettingsSerializer.cs | 2 +- .../DefaultSettingsSerializer.cs | 2 +- .../AbstractDateTimeFormatter.cs | 2 +- .../ApplicationDateTimeFormatter.cs | 2 +- .../DateTimeFormatterFactory.cs | 2 +- .../SystemDateTimeFormatter.cs | 2 +- .../UniversalDateTimeFormatter.cs | 2 +- .../UserDateTimeFormatter.cs | 2 +- .../ServicesImplementation/DialogService.cs | 4 +- .../FileExplorerService.cs | 16 +- .../ServicesImplementation/ImagingService.cs | 2 +- .../LocalizationService.cs | 2 +- .../Settings/AppearanceSettingsService.cs | 2 +- .../Settings/ApplicationSettingsService.cs | 2 +- .../Settings/BundlesSettingsService.cs | 2 +- .../Settings/FileTagsSettingsService.cs | 2 +- .../Settings/LayoutSettingsService.cs | 2 +- .../Settings/MultitaskingSettingsService.cs | 2 +- .../Settings/PaneSettingsService.cs | 2 +- .../Settings/PreferencesSettingsService.cs | 2 +- .../Settings/UserSettingsService.cs | 2 +- .../Settings/WidgetsSettingsService.cs | 2 +- .../SideloadUpdateService.cs | 2 +- .../ThreadingService.cs | 2 +- .../ServicesImplementation/UpdateService.cs | 14 +- .../UserSizeProvider.cs | 2 +- .../VolumeInfoFactory.cs | 2 +- .../TemplateSelectors/BaseTemplateSelector.cs | 4 +- .../FileSystemDialogItemSelector.cs | 4 +- src/Files.Uwp/UWPToWinAppSDKUpgradeHelpers.cs | 19 + .../UserControls/AddressToolbar.xaml.cs | 12 +- .../UserControls/ColoredIcon.xaml.cs | 6 +- .../UserControls/DataGridHeader.xaml.cs | 6 +- src/Files.Uwp/UserControls/FileIcon.xaml.cs | 8 +- .../FilePreviews/BasicPreview.xaml.cs | 4 +- .../FilePreviews/CodePreview.xaml.cs | 8 +- .../FilePreviews/FolderPreview.xaml.cs | 4 +- .../FilePreviews/HtmlPreview.xaml.cs | 6 +- .../FilePreviews/ImagePreview.xaml.cs | 4 +- .../FilePreviews/MarkdownPreview.xaml.cs | 4 +- .../FilePreviews/MediaPreview.xaml.cs | 8 +- .../FilePreviews/PDFPreview.xaml.cs | 4 +- .../FilePreviews/RichTextPreview.xaml.cs | 6 +- .../FilePreviews/TextPreview.xaml.cs | 4 +- .../UserControls/FolderEmptyIndicator.xaml.cs | 6 +- src/Files.Uwp/UserControls/ImageFromBytes.cs | 6 +- .../InnerNavigationToolbar.xaml.cs | 17 +- .../MenuFlyoutItemWithImage.xaml.cs | 6 +- .../Menus/FileTagsContextMenu.xaml.cs | 8 +- .../BaseMultitaskingControl.cs | 6 +- .../HorizontalMultitaskingControl.xaml.cs | 4 +- .../IMultitaskingControl.cs | 2 +- .../MultitaskingControl/TabItem/ITabItem.cs | 4 +- .../TabItem/ITabItemControl.cs | 2 +- .../MultitaskingControl/TabItem/TabItem.cs | 2 +- .../TabItem/TabItemControl.xaml.cs | 6 +- .../VerticalTabViewControl.xaml.cs | 4 +- .../UserControls/OngoingTasksFlyout.xaml.cs | 6 +- src/Files.Uwp/UserControls/Pane/Pane.cs | 2 +- .../UserControls/Pane/PaneControl.xaml.cs | 4 +- .../UserControls/Pane/PreviewPane.xaml.cs | 8 +- .../UserControls/PathBreadcrumb.xaml.cs | 8 +- .../UserControls/RestartControl.xaml.cs | 6 +- src/Files.Uwp/UserControls/SearchBox.xaml.cs | 8 +- .../ExtendPreviousItemSelectionStrategy.cs | 2 +- .../IgnorePreviousItemSelectionStrategy.cs | 2 +- .../InvertPreviousItemSelectionStrategy.cs | 2 +- .../Selection/ItemSelectionStrategy.cs | 2 +- .../Selection/RectangleSelection.cs | 8 +- .../RectangleSelection_ListViewBase.cs | 10 +- .../Settings/SettingsBlockControl.xaml.cs | 10 +- .../Settings/SettingsDisplayControl.xaml.cs | 6 +- .../ThemeSampleDisplayControl.xaml.cs | 6 +- .../UserControls/SidebarControl.xaml.cs | 26 +- .../UserControls/StatusBarControl.xaml.cs | 8 +- .../UserControls/StringEncodedImage.xaml.cs | 8 +- .../Widgets/BundlesWidget.xaml.cs | 4 +- .../UserControls/Widgets/DrivesWidget.xaml.cs | 16 +- .../UserControls/Widgets/FolderWidget.xaml.cs | 12 +- .../UserControls/Widgets/IWidgetCardItem.cs | 4 +- .../Widgets/RecentFilesWidget.xaml.cs | 12 +- .../Widgets/WidgetsListControl.xaml.cs | 4 +- .../ColorModelToColorConverter.cs | 6 +- .../ConflictResolveOptionToIndexConverter.cs | 4 +- .../ValueConverters/GenericEnumConverter.cs | 4 +- .../ImageModelToImageConverter.cs | 6 +- src/Files.Uwp/ViewModels/ColumnsViewModel.cs | 4 +- .../ContextMenuFlyoutItemViewModel.cs | 6 +- .../ViewModels/CurrentInstanceViewModel.cs | 2 +- .../DecompressArchiveDialogViewModel.cs | 9 +- .../Dialogs/DynamicDialogViewModel.cs | 8 +- .../DirectoryPropertiesViewModel.cs | 2 +- .../ViewModels/FolderSettingsViewModel.cs | 2 +- src/Files.Uwp/ViewModels/ItemViewModel.cs | 6 +- src/Files.Uwp/ViewModels/MainPageViewModel.cs | 15 +- src/Files.Uwp/ViewModels/MainViewModel.cs | 14 +- .../ViewModels/Pages/YourHomeViewModel.cs | 4 +- src/Files.Uwp/ViewModels/PaneViewModel.cs | 2 +- .../ViewModels/PreviewPaneViewModel.cs | 6 +- .../Previews/ArchivePreviewViewModel.cs | 2 +- .../ViewModels/Previews/BasePreviewModel.cs | 6 +- .../Previews/BasicPreviewViewModel.cs | 2 +- .../Previews/CodePreviewViewModel.cs | 2 +- .../Previews/FolderPreviewViewModel.cs | 4 +- .../Previews/HtmlPreviewViewModel.cs | 2 +- .../Previews/ImagePreviewViewModel.cs | 6 +- .../Previews/MarkdownPreviewViewModel.cs | 2 +- .../Previews/MediaPreviewViewModel.cs | 4 +- .../Previews/PDFPreviewViewModel.cs | 6 +- .../Previews/RichTextPreviewViewModel.cs | 2 +- .../Previews/ShortcutPreviewViewModel.cs | 2 +- .../Previews/TextPreviewViewModel.cs | 2 +- .../ViewModels/Properties/BaseProperties.cs | 6 +- .../Properties/CombinedProperties.cs | 6 +- .../Properties/CompatibilityProperties.cs | 2 +- .../ViewModels/Properties/DriveProperties.cs | 2 +- .../ViewModels/Properties/FileProperties.cs | 8 +- .../ViewModels/Properties/FileProperty.cs | 6 +- .../Properties/FilePropertySection.cs | 4 +- .../ViewModels/Properties/FolderProperties.cs | 6 +- .../Properties/LibraryProperties.cs | 6 +- .../ViewModels/Properties/PropertiesTab.cs | 8 +- .../Properties/SecurityProperties.cs | 2 +- .../ViewModels/SearchBoxViewModel.cs | 6 +- .../SelectedItemsPropertiesViewModel.cs | 2 +- .../SettingsViewModels/AboutViewModel.cs | 18 +- .../SettingsViewModels/AppearanceViewModel.cs | 8 +- .../ExperimentalViewModel.cs | 2 +- .../MultitaskingViewModel.cs | 2 +- .../PreferencesViewModel.cs | 11 +- src/Files.Uwp/ViewModels/SidebarViewModel.cs | 6 +- .../ViewModels/StatusCenterViewModel.cs | 8 +- src/Files.Uwp/ViewModels/ToolbarViewModel.cs | 22 +- .../Bundles/BundleContainerViewModel.cs | 20 +- .../Widgets/Bundles/BundleItemViewModel.cs | 6 +- .../Widgets/Bundles/BundlesViewModel.cs | 22 +- .../Widgets/ICustomWidgetItemModel.cs | 2 +- .../ViewModels/Widgets/IWidgetItemModel.cs | 2 +- .../WidgetsListControlItemViewModel.cs | 2 +- .../Widgets/WidgetsListControlViewModel.cs | 2 +- src/Files.Uwp/Views/Brushes/MicaBrush.cs | 35 +- src/Files.Uwp/Views/ColumnParam.cs | 2 +- src/Files.Uwp/Views/ColumnShellPage.xaml.cs | 55 +- src/Files.Uwp/Views/CustomFolderIcons.xaml.cs | 12 +- .../Views/LayoutModes/ColumnViewBase.xaml.cs | 20 +- .../LayoutModes/ColumnViewBrowser.xaml.cs | 8 +- .../LayoutModes/DetailsLayoutBrowser.xaml.cs | 20 +- .../Views/LayoutModes/GridViewBrowser.xaml.cs | 22 +- src/Files.Uwp/Views/MainPage.xaml.cs | 71 +- src/Files.Uwp/Views/ModernShellPage.xaml.cs | 57 +- src/Files.Uwp/Views/Pages/Properties.xaml.cs | 68 +- .../Pages/PropertiesCompatibility.xaml.cs | 6 +- .../Pages/PropertiesCustomization.xaml.cs | 8 +- .../Views/Pages/PropertiesDetails.xaml.cs | 4 +- .../Views/Pages/PropertiesGeneral.xaml.cs | 2 +- .../Views/Pages/PropertiesLibrary.xaml.cs | 11 +- .../Views/Pages/PropertiesSecurity.xaml.cs | 41 +- .../Pages/PropertiesSecurityAdvanced.xaml.cs | 53 +- .../Views/Pages/PropertiesShortcut.xaml.cs | 2 +- src/Files.Uwp/Views/PaneHolderPage.xaml.cs | 20 +- .../Views/SettingsPages/About.xaml.cs | 4 +- .../Views/SettingsPages/Appearance.xaml.cs | 10 +- .../Views/SettingsPages/Experimental.xaml.cs | 2 +- .../Views/SettingsPages/Multitasking.xaml.cs | 4 +- .../Views/SettingsPages/Preferences.xaml.cs | 2 +- src/Files.Uwp/Views/WidgetsPage.xaml.cs | 8 +- src/Files.Uwp/app.manifest | 15 + 387 files changed, 2417 insertions(+), 3260 deletions(-) delete mode 100644 src/Files.Uwp.Storage/Properties/AssemblyInfo.cs create mode 100644 src/Files.Uwp/App.xaml.old.cs create mode 100644 src/Files.Uwp/MainWindow.xaml create mode 100644 src/Files.Uwp/MainWindow.xaml.cs delete mode 100644 src/Files.Uwp/Properties/AssemblyInfo.cs create mode 100644 src/Files.Uwp/UWPToWinAppSDKUpgradeHelpers.cs create mode 100644 src/Files.Uwp/app.manifest diff --git a/src/Files.Uwp.Storage/Files.Uwp.Storage.csproj b/src/Files.Uwp.Storage/Files.Uwp.Storage.csproj index 3d75966b3987..958a12084518 100644 --- a/src/Files.Uwp.Storage/Files.Uwp.Storage.csproj +++ b/src/Files.Uwp.Storage/Files.Uwp.Storage.csproj @@ -1,73 +1,51 @@ - - - + - Debug + net6.0-windows10.0.22000.0 x86 - {DEDFB63C-7A8D-4E1F-A143-7B61CAC1F2A7} Library - Properties - Files.Uwp.Storage - Files.Uwp.Storage en-US - UAP - 10.0.22000.0 10.0.17763.0 - 14 - 512 - {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 9 enable + true + app.manifest + true + x86;x64;arm64 + win10-$(Platform).pubxml + win10-x86;win10-x64;win10-arm64 - x86 - true bin\x86\Debug\ DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP ;2008 - full false - prompt - x86 bin\x86\Release\ TRACE;NETFX_CORE;WINDOWS_UWP - true ;2008 - pdbonly false - prompt - x86 bin\x86\Sideload\ TRACE;NETFX_CORE;WINDOWS_UWP;SIDELOAD true ;2008 - pdbonly false - prompt arm64 - true bin\arm64\Debug\ DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP ;2008 - full false - prompt arm64 bin\arm64\Release\ TRACE;NETFX_CORE;WINDOWS_UWP - true ;2008 - pdbonly false - prompt arm64 @@ -75,85 +53,49 @@ TRACE;NETFX_CORE;WINDOWS_UWP;SIDELOAD true ;2008 - pdbonly false - prompt - x64 - true bin\x64\Debug\ DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP ;2008 - full false - prompt - x64 bin\x64\Release\ TRACE;NETFX_CORE;WINDOWS_UWP - true ;2008 - pdbonly false - prompt - x64 bin\x64\Sideload\ TRACE;NETFX_CORE;WINDOWS_UWP;SIDELOAD true ;2008 - pdbonly false - prompt - - - PackageReference - - - - - - - - - - - 37.1.0 - - 6.2.13 + + + + all + - - {93b7a21c-a6ca-4a21-a69c-b5bd26bddb79} - Files.Sdk.Storage - - - {0533133F-2559-4B53-A0FD-0970BC0E312E} - Files.Shared - + + + + + + + + - - - 14.0 - - - \ No newline at end of file diff --git a/src/Files.Uwp.Storage/FtpStorage/FtpFileSystemService.cs b/src/Files.Uwp.Storage/FtpStorage/FtpFileSystemService.cs index 8418972d9958..3059806551a7 100644 --- a/src/Files.Uwp.Storage/FtpStorage/FtpFileSystemService.cs +++ b/src/Files.Uwp.Storage/FtpStorage/FtpFileSystemService.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; using System.Threading; using System.Threading.Tasks; diff --git a/src/Files.Uwp.Storage/FtpStorage/FtpHelpers.cs b/src/Files.Uwp.Storage/FtpStorage/FtpHelpers.cs index 2c34285c59a1..182436d5d937 100644 --- a/src/Files.Uwp.Storage/FtpStorage/FtpHelpers.cs +++ b/src/Files.Uwp.Storage/FtpStorage/FtpHelpers.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Threading; using System.Threading.Tasks; using Files.Shared.Extensions; diff --git a/src/Files.Uwp.Storage/FtpStorage/FtpManager.cs b/src/Files.Uwp.Storage/FtpStorage/FtpManager.cs index 02d656ccfd97..23f571a247a5 100644 --- a/src/Files.Uwp.Storage/FtpStorage/FtpManager.cs +++ b/src/Files.Uwp.Storage/FtpStorage/FtpManager.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Net; namespace Files.Uwp.Storage.FtpStorage diff --git a/src/Files.Uwp.Storage/FtpStorage/FtpStorable.cs b/src/Files.Uwp.Storage/FtpStorage/FtpStorable.cs index de3bb69c1eaf..ce3089a5a002 100644 --- a/src/Files.Uwp.Storage/FtpStorage/FtpStorable.cs +++ b/src/Files.Uwp.Storage/FtpStorage/FtpStorable.cs @@ -1,4 +1,4 @@ -using System.Threading; +using System.Threading; using System.Threading.Tasks; using Files.Sdk.Storage.LocatableStorage; using FluentFTP; diff --git a/src/Files.Uwp.Storage/FtpStorage/FtpStorageFile.cs b/src/Files.Uwp.Storage/FtpStorage/FtpStorageFile.cs index 06ab772c0e3b..41cb66adda96 100644 --- a/src/Files.Uwp.Storage/FtpStorage/FtpStorageFile.cs +++ b/src/Files.Uwp.Storage/FtpStorage/FtpStorageFile.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; using System.Threading; using System.Threading.Tasks; diff --git a/src/Files.Uwp.Storage/FtpStorage/FtpStorageFolder.cs b/src/Files.Uwp.Storage/FtpStorage/FtpStorageFolder.cs index 777c1660e98a..ccbd48e61944 100644 --- a/src/Files.Uwp.Storage/FtpStorage/FtpStorageFolder.cs +++ b/src/Files.Uwp.Storage/FtpStorage/FtpStorageFolder.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.IO; using System.Runtime.CompilerServices; diff --git a/src/Files.Uwp.Storage/IsExternalInit.cs b/src/Files.Uwp.Storage/IsExternalInit.cs index a9397250b877..f2bd3c295454 100644 --- a/src/Files.Uwp.Storage/IsExternalInit.cs +++ b/src/Files.Uwp.Storage/IsExternalInit.cs @@ -1,4 +1,4 @@ -using System.ComponentModel; +using System.ComponentModel; namespace System.Runtime.CompilerServices { diff --git a/src/Files.Uwp.Storage/Properties/AssemblyInfo.cs b/src/Files.Uwp.Storage/Properties/AssemblyInfo.cs deleted file mode 100644 index 140458f21633..000000000000 --- a/src/Files.Uwp.Storage/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Files.Uwp.Storage")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Files.Uwp.Storage")] -[assembly: AssemblyCopyright("Copyright © 2022")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] -[assembly: ComVisible(false)] \ No newline at end of file diff --git a/src/Files.Uwp.Storage/WindowsStorage/WindowsStorable.cs b/src/Files.Uwp.Storage/WindowsStorage/WindowsStorable.cs index 45d3ac7c1aed..4b98280d95cb 100644 --- a/src/Files.Uwp.Storage/WindowsStorage/WindowsStorable.cs +++ b/src/Files.Uwp.Storage/WindowsStorage/WindowsStorable.cs @@ -1,4 +1,4 @@ -using System.Threading; +using System.Threading; using Files.Sdk.Storage.LocatableStorage; using System.Threading.Tasks; using Windows.Storage; diff --git a/src/Files.Uwp.Storage/WindowsStorage/WindowsStorageFile.cs b/src/Files.Uwp.Storage/WindowsStorage/WindowsStorageFile.cs index c5fee07d13ba..caac57a43f62 100644 --- a/src/Files.Uwp.Storage/WindowsStorage/WindowsStorageFile.cs +++ b/src/Files.Uwp.Storage/WindowsStorage/WindowsStorageFile.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; using System.Threading; using System.Threading.Tasks; diff --git a/src/Files.Uwp.Storage/WindowsStorage/WindowsStorageFolder.cs b/src/Files.Uwp.Storage/WindowsStorage/WindowsStorageFolder.cs index fabba3e71574..658873d9b1d4 100644 --- a/src/Files.Uwp.Storage/WindowsStorage/WindowsStorageFolder.cs +++ b/src/Files.Uwp.Storage/WindowsStorage/WindowsStorageFolder.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Runtime.CompilerServices; using System.Threading; diff --git a/src/Files.Uwp/App.xaml.cs b/src/Files.Uwp/App.xaml.cs index 3d6277112d77..c1ee548ee0b9 100644 --- a/src/Files.Uwp/App.xaml.cs +++ b/src/Files.Uwp/App.xaml.cs @@ -1,758 +1,89 @@ -using CommunityToolkit.Mvvm.DependencyInjection; -using Files.Backend.Services; -using Files.Backend.Services.Settings; -using Files.Backend.Services.SizeProvider; -using Files.Shared; -using Files.Shared.Cloud; -using Files.Shared.Extensions; -using Files.Shared.Services.DateTimeFormatter; -using Files.Uwp.CommandLine; -using Files.Uwp.Controllers; -using Files.Uwp.Filesystem; -using Files.Uwp.Filesystem.Cloud; -using Files.Uwp.Filesystem.FilesystemHistory; -using Files.Uwp.Helpers; -using Files.Uwp.ServicesImplementation; -using Files.Uwp.ServicesImplementation.DateTimeFormatter; -using Files.Uwp.ServicesImplementation.Settings; -using Files.Uwp.UserControls.MultitaskingControl; -using Files.Uwp.ViewModels; -using Files.Uwp.ViewModels.SettingsViewModels; -using Files.Uwp.Views; -using Microsoft.AppCenter; -using Microsoft.AppCenter.Analytics; -using Microsoft.AppCenter.Crashes; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Toolkit.Uwp; -using Microsoft.Toolkit.Uwp.Helpers; -using Microsoft.Toolkit.Uwp.Notifications; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Controls.Primitives; +using Microsoft.UI.Xaml.Data; +using Microsoft.UI.Xaml.Input; +using Microsoft.UI.Xaml.Media; +using Microsoft.UI.Xaml.Navigation; +using Microsoft.UI.Xaml.Shapes; +using Microsoft.Windows.AppLifecycle; using System; -using System.Diagnostics; +using System.Collections.Generic; using System.IO; using System.Linq; -using System.Threading.Tasks; +using System.Runtime.InteropServices.WindowsRuntime; using Windows.ApplicationModel; using Windows.ApplicationModel.Activation; -using Windows.ApplicationModel.Core; -using Windows.ApplicationModel.DataTransfer; -using Windows.Foundation.Metadata; -using Windows.Storage; -using Windows.System; -using Windows.UI.Core; -using Windows.UI.Notifications; -using Windows.UI.ViewManagement; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Media.Animation; -using Windows.UI.Xaml.Navigation; +using Windows.Foundation; +using Windows.Foundation.Collections; +using Files.Uwp; -namespace Files.Uwp +// To learn more about WinUI, the WinUI project structure, +// and more about our project templates, see: http://aka.ms/winui-project-info. + +namespace Files { - sealed partial class App : Application + /// + /// Provides application-specific behavior to supplement the default Application class. + /// + public partial class App : Application { - private static bool ShowErrorNotification = false; - private static string OutputPath = null; - - public static StorageHistoryWrapper HistoryWrapper = new StorageHistoryWrapper(); - public static SettingsViewModel AppSettings { get; private set; } - public static MainViewModel MainViewModel { get; private set; } - public static PaneViewModel PaneViewModel { get; private set; } - public static PreviewPaneViewModel PreviewPaneViewModel { get; private set; } - public static JumpListManager JumpList { get; private set; } - public static RecentItemsManager RecentItemsManager { get; private set; } - public static SidebarPinnedController SidebarPinnedController { get; private set; } - public static TerminalController TerminalController { get; private set; } - public static CloudDrivesManager CloudDrivesManager { get; private set; } - public static NetworkDrivesManager NetworkDrivesManager { get; private set; } - public static DrivesManager DrivesManager { get; private set; } - public static WSLDistroManager WSLDistroManager { get; private set; } - public static LibraryManager LibraryManager { get; private set; } - public static FileTagsManager FileTagsManager { get; private set; } - public static ExternalResourcesHelper ExternalResourcesHelper { get; private set; } - - public static ILogger Logger { get; private set; } - private static readonly UniversalLogWriter logWriter = new UniversalLogWriter(); - - public static OngoingTasksViewModel OngoingTasksViewModel { get; } = new OngoingTasksViewModel(); - public static SecondaryTileHelper SecondaryTileHelper { get; private set; } = new SecondaryTileHelper(); - - public static string AppVersion = $"{Package.Current.Id.Version.Major}.{Package.Current.Id.Version.Minor}.{Package.Current.Id.Version.Build}.{Package.Current.Id.Version.Revision}"; - - public IServiceProvider Services { get; private set; } - + /// + /// Initializes the singleton application object. This is the first line of authored code + /// executed, and as such is the logical equivalent of main() or WinMain(). + /// public App() { - // Initialize logger - Logger = new Logger(logWriter); - - UnhandledException += OnUnhandledException; - TaskScheduler.UnobservedTaskException += OnUnobservedException; - InitializeComponent(); - Suspending += OnSuspending; - LeavingBackground += OnLeavingBackground; - - AppServiceConnectionHelper.Register(); - - this.Services = ConfigureServices(); - Ioc.Default.ConfigureServices(Services); - } - - private IServiceProvider ConfigureServices() - { - ServiceCollection services = new ServiceCollection(); - - services - // TODO: Loggers: - - // Settings: - // Base IUserSettingsService as parent settings store (to get ISettingsSharingContext from) - .AddSingleton() - // Children settings (from IUserSettingsService) - .AddSingleton((sp) => new MultitaskingSettingsService((sp.GetService() as UserSettingsService).GetSharingContext())) - .AddSingleton((sp) => new WidgetsSettingsService((sp.GetService() as UserSettingsService).GetSharingContext())) - .AddSingleton((sp) => new AppearanceSettingsService((sp.GetService() as UserSettingsService).GetSharingContext())) - .AddSingleton((sp) => new PreferencesSettingsService((sp.GetService() as UserSettingsService).GetSharingContext())) - .AddSingleton((sp) => new ApplicationSettingsService((sp.GetService() as UserSettingsService).GetSharingContext())) - .AddSingleton((sp) => new PaneSettingsService((sp.GetService() as UserSettingsService).GetSharingContext())) - .AddSingleton((sp) => new LayoutSettingsService((sp.GetService() as UserSettingsService).GetSharingContext())) - // Settings not related to IUserSettingsService: - .AddSingleton() - .AddSingleton() - - // Other services - .AddSingleton(Logger) - .AddSingleton() - .AddSingleton() - .AddSingleton() - .AddSingleton() - .AddSingleton() -#if SIDELOAD - .AddSingleton() -#else - .AddSingleton() -#endif - .AddSingleton() - .AddSingleton() - .AddSingleton() - - // TODO(i): FileSystem operations: - // (IFilesystemHelpersService, IFilesystemOperationsService) - // (IStorageEnumerator, IFallbackStorageEnumerator) - .AddSingleton() - - ; // End of service configuration - - - return services.BuildServiceProvider(); - } - - private static async Task EnsureSettingsAndConfigurationAreBootstrapped() - { - AppSettings ??= new SettingsViewModel(); - - ExternalResourcesHelper ??= new ExternalResourcesHelper(); - await ExternalResourcesHelper.LoadSelectedTheme(); - new AppearanceViewModel().SetCompactStyles(updateTheme: false); - - JumpList ??= new JumpListManager(); - RecentItemsManager ??= new RecentItemsManager(); - MainViewModel ??= new MainViewModel(); - PaneViewModel ??= new PaneViewModel(); - PreviewPaneViewModel ??= new PreviewPaneViewModel(); - LibraryManager ??= new LibraryManager(); - DrivesManager ??= new DrivesManager(); - NetworkDrivesManager ??= new NetworkDrivesManager(); - CloudDrivesManager ??= new CloudDrivesManager(); - WSLDistroManager ??= new WSLDistroManager(); - FileTagsManager ??= new FileTagsManager(); - SidebarPinnedController ??= new SidebarPinnedController(); - TerminalController ??= new TerminalController(); - } - - private static async Task StartAppCenter() - { - try - { - if (!AppCenter.Configured) - { - var file = await StorageFile.GetFileFromApplicationUriAsync(new Uri(@"ms-appx:///Resources/AppCenterKey.txt")); - var lines = await FileIO.ReadTextAsync(file); - var obj = Newtonsoft.Json.Linq.JObject.Parse(lines); - AppCenter.Start((string)obj.SelectToken("key"), typeof(Analytics), typeof(Crashes)); - } - } - catch (Exception ex) - { - Logger.Warn(ex, "AppCenter could not be started."); - } - } - - private static async Task InitializeAppComponentsAsync() - { - var userSettingsService = Ioc.Default.GetRequiredService(); - var appearanceSettingsService = userSettingsService.AppearanceSettingsService; - - // Start off a list of tasks we need to run before we can continue startup - await Task.Run(async () => - { - await Task.WhenAll( - StartAppCenter(), - DrivesManager.UpdateDrivesAsync(), - OptionalTask(CloudDrivesManager.UpdateDrivesAsync(), appearanceSettingsService.ShowCloudDrivesSection), - LibraryManager.UpdateLibrariesAsync(), - OptionalTask(NetworkDrivesManager.UpdateDrivesAsync(), appearanceSettingsService.ShowNetworkDrivesSection), - OptionalTask(WSLDistroManager.UpdateDrivesAsync(), appearanceSettingsService.ShowWslSection), - OptionalTask(FileTagsManager.UpdateFileTagsAsync(), appearanceSettingsService.ShowFileTagsSection), - SidebarPinnedController.InitializeAsync() - ); - await Task.WhenAll( - AppSettings.DetectQuickLook(), - TerminalController.InitializeAsync(), - JumpList.InitializeAsync(), - ExternalResourcesHelper.LoadOtherThemesAsync(), - ContextFlyoutItemHelper.CachedNewContextMenuEntries - ); - - userSettingsService.ReportToAppCenter(); - }); - - // Check for required updates - var updateService = Ioc.Default.GetRequiredService(); - await updateService.CheckForUpdates(); - await updateService.DownloadMandatoryUpdates(); - - static async Task OptionalTask(Task task, bool condition) - { - if (condition) - { - await task; - } - } - } - - private void OnLeavingBackground(object sender, LeavingBackgroundEventArgs e) - { - DrivesManager?.ResumeDeviceWatcher(); + this.InitializeComponent(); } /// /// Invoked when the application is launched normally by the end user. Other entry points /// will be used such as when the application is launched to open a specific file. /// - /// Details about the launch request and process. - protected override async void OnLaunched(LaunchActivatedEventArgs e) + /// Details about the launch request and process. + protected override async void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs e) { - await logWriter.InitializeAsync("debug.log"); - Logger.Info($"App launched. Prelaunch: {e.PrelaunchActivated}"); - - //start tracking app usage - SystemInformation.Instance.TrackAppUse(e); - - bool canEnablePrelaunch = ApiInformation.IsMethodPresent("Windows.ApplicationModel.Core.CoreApplication", "EnablePrelaunch"); + // TODO This code defaults the app to a single instance app. If you need multi instance app, remove this part. + // Read: https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/guides/applifecycle#single-instancing-in-applicationonlaunched + // If this is the first instance launched, then register it as the "main" instance. + // If this isn't the first instance launched, then "main" will already be registered, + // so retrieve it. + var mainInstance = Microsoft.Windows.AppLifecycle.AppInstance.FindOrRegisterForKey("main"); + var activatedEventArgs = Microsoft.Windows.AppLifecycle.AppInstance.GetCurrent().GetActivatedEventArgs(); - await EnsureSettingsAndConfigurationAreBootstrapped(); - _ = InitializeAppComponentsAsync().ContinueWith(t => Logger.Warn(t.Exception, "Error during InitializeAppComponentsAsync()"), TaskContinuationOptions.OnlyOnFaulted); - - var rootFrame = EnsureWindowIsInitialized(); - - if (e.PrelaunchActivated == false) - { - if (canEnablePrelaunch) - { - TryEnablePrelaunch(); - } - - if (rootFrame.Content == null) - { - // When the navigation stack isn't restored navigate to the first page, - // configuring the new page by passing required information as a navigation - // parameter - rootFrame.Navigate(typeof(MainPage), e.Arguments, new SuppressNavigationTransitionInfo()); - } - else - { - if (!(string.IsNullOrEmpty(e.Arguments) && MainPageViewModel.AppInstances.Count > 0)) - { - await MainPageViewModel.AddNewTabByPathAsync(typeof(PaneHolderPage), e.Arguments); - } - } - - // Ensure the current window is active - Window.Current.Activate(); - Window.Current.CoreWindow.Activated += CoreWindow_Activated; - } - else + // If the instance that's executing the OnLaunched handler right now + // isn't the "main" instance. + if (!mainInstance.IsCurrent) { - if (rootFrame.Content == null) - { - // When the navigation stack isn't restored navigate to the first page, - // configuring the new page by passing required information as a navigation - // parameter - rootFrame.Navigate(typeof(MainPage), e.Arguments, new SuppressNavigationTransitionInfo()); - } - else - { - if (!(string.IsNullOrEmpty(e.Arguments) && MainPageViewModel.AppInstances.Count > 0)) - { - await MainPageViewModel.AddNewTabByPathAsync(typeof(PaneHolderPage), e.Arguments); - } - } + // Redirect the activation (and args) to the "main" instance, and exit. + await mainInstance.RedirectActivationToAsync(activatedEventArgs); + System.Diagnostics.Process.GetCurrentProcess().Kill(); + return; } - WindowDecorationsHelper.RequestWindowDecorationsAccess(); - } - - protected override async void OnFileActivated(FileActivatedEventArgs e) - { - await logWriter.InitializeAsync("debug.log"); - Logger.Info("App activated by file"); - - //start tracking app usage - SystemInformation.Instance.TrackAppUse(e); - - await EnsureSettingsAndConfigurationAreBootstrapped(); - _ = InitializeAppComponentsAsync().ContinueWith(t => Logger.Warn(t.Exception, "Error during InitializeAppComponentsAsync()"), TaskContinuationOptions.OnlyOnFaulted); - - var rootFrame = EnsureWindowIsInitialized(); - - var index = 0; - if (rootFrame.Content == null) - { - // When the navigation stack isn't restored navigate to the first page, - // configuring the new page by passing required information as a navigation - // parameter - rootFrame.Navigate(typeof(MainPage), e.Files.First().Path, new SuppressNavigationTransitionInfo()); - index = 1; - } - for (; index < e.Files.Count; index++) + // TODO This code handles app activation types. Add any other activation kinds you want to handle. + // Read: https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/guides/applifecycle#file-type-association + if (activatedEventArgs.Kind == ExtendedActivationKind.File) { - await MainPageViewModel.AddNewTabByPathAsync(typeof(PaneHolderPage), e.Files[index].Path); + OnFileActivated(activatedEventArgs); } - // Ensure the current window is active - Window.Current.Activate(); - Window.Current.CoreWindow.Activated += CoreWindow_Activated; - - WindowDecorationsHelper.RequestWindowDecorationsAccess(); + // Initialize MainWindow here + Window = new MainWindow(); + Window.Activate(); + WindowHandle = WinRT.Interop.WindowNative.GetWindowHandle(Window); } - private Frame EnsureWindowIsInitialized() + // TODO This is an example method for the case when app is activated through a file. + // Feel free to remove this if you do not need this. + public void OnFileActivated(AppActivationArguments activatedEventArgs) { - // Do not repeat app initialization when the Window already has content, - // just ensure that the window is active - if (!(Window.Current.Content is Frame rootFrame)) - { - // Create a Frame to act as the navigation context and navigate to the first page - rootFrame = new Frame(); - rootFrame.CacheSize = 1; - rootFrame.NavigationFailed += OnNavigationFailed; - - //if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) - //{ - // //TODO: Load state from previously suspended application - //} - - // Place the frame in the current Window - Window.Current.Content = rootFrame; - } - return rootFrame; } - private void CoreWindow_Activated(CoreWindow sender, WindowActivatedEventArgs args) - { - if (args.WindowActivationState == CoreWindowActivationState.CodeActivated || - args.WindowActivationState == CoreWindowActivationState.PointerActivated) - { - ShowErrorNotification = true; - ApplicationData.Current.LocalSettings.Values["INSTANCE_ACTIVE"] = Process.GetCurrentProcess().Id; - if (MainViewModel != null) - { - MainViewModel.Clipboard_ContentChanged(null, null); - } - } - } + public static MainWindow Window { get; private set; } - protected override async void OnActivated(IActivatedEventArgs args) - { - await logWriter.InitializeAsync("debug.log"); - Logger.Info($"App activated by {args.Kind.ToString()}"); - - await EnsureSettingsAndConfigurationAreBootstrapped(); - _ = InitializeAppComponentsAsync().ContinueWith(t => Logger.Warn(t.Exception, "Error during InitializeAppComponentsAsync()"), TaskContinuationOptions.OnlyOnFaulted); - - var rootFrame = EnsureWindowIsInitialized(); - - switch (args.Kind) - { - case ActivationKind.Protocol: - var eventArgs = args as ProtocolActivatedEventArgs; - - if (eventArgs.Uri.AbsoluteUri == "files-uwp:") - { - rootFrame.Navigate(typeof(MainPage), null, new SuppressNavigationTransitionInfo()); - } - else - { - var parsedArgs = eventArgs.Uri.Query.TrimStart('?').Split('='); - var unescapedValue = Uri.UnescapeDataString(parsedArgs[1]); - var folder = (StorageFolder)await FilesystemTasks.Wrap(() => StorageFolder.GetFolderFromPathAsync(unescapedValue).AsTask()); - if (folder != null && !string.IsNullOrEmpty(folder.Path)) - { - unescapedValue = folder.Path; // Convert short name to long name (#6190) - } - switch (parsedArgs[0]) - { - case "tab": - rootFrame.Navigate(typeof(MainPage), TabItemArguments.Deserialize(unescapedValue), new SuppressNavigationTransitionInfo()); - break; - - case "folder": - rootFrame.Navigate(typeof(MainPage), unescapedValue, new SuppressNavigationTransitionInfo()); - break; - - case "cmd": - var ppm = CommandLineParser.ParseUntrustedCommands(unescapedValue); - if (ppm.IsEmpty()) - { - ppm = new ParsedCommands() { new ParsedCommand() { Type = ParsedCommandType.Unknown, Args = new() { "." } } }; - } - await InitializeFromCmdLineArgs(rootFrame, ppm); - break; - } - } - - if (rootFrame.Content != null) - { - // Ensure the current window is active. - Window.Current.Activate(); - Window.Current.CoreWindow.Activated += CoreWindow_Activated; - return; - } - break; - - case ActivationKind.CommandLineLaunch: - var cmdLineArgs = args as CommandLineActivatedEventArgs; - var operation = cmdLineArgs.Operation; - var cmdLineString = operation.Arguments; - var activationPath = operation.CurrentDirectoryPath; - - var parsedCommands = CommandLineParser.ParseUntrustedCommands(cmdLineString); - if (parsedCommands != null && parsedCommands.Count > 0) - { - await InitializeFromCmdLineArgs(rootFrame, parsedCommands, activationPath); - - if (rootFrame.Content != null) - { - // Ensure the current window is active. - Window.Current.Activate(); - Window.Current.CoreWindow.Activated += CoreWindow_Activated; - return; - } - } - break; - - case ActivationKind.ToastNotification: - var eventArgsForNotification = args as ToastNotificationActivatedEventArgs; - if (eventArgsForNotification.Argument == "report") - { - await Launcher.LaunchUriAsync(new Uri(Constants.GitHub.FeedbackUrl)); - } - break; - - case ActivationKind.StartupTask: - break; - } - - rootFrame.Navigate(typeof(MainPage), null, new SuppressNavigationTransitionInfo()); - - // Ensure the current window is active. - Window.Current.Activate(); - Window.Current.CoreWindow.Activated += CoreWindow_Activated; - - WindowDecorationsHelper.RequestWindowDecorationsAccess(); - } - - private async Task InitializeFromCmdLineArgs(Frame rootFrame, ParsedCommands parsedCommands, string activationPath = "") - { - async Task PerformNavigation(string payload, string selectItem = null) - { - if (!string.IsNullOrEmpty(payload)) - { - payload = CommonPaths.ShellPlaces.Get(payload.ToUpperInvariant(), payload); - var folder = (StorageFolder)await FilesystemTasks.Wrap(() => StorageFolder.GetFolderFromPathAsync(payload).AsTask()); - if (folder != null && !string.IsNullOrEmpty(folder.Path)) - { - payload = folder.Path; // Convert short name to long name (#6190) - } - } - var paneNavigationArgs = new PaneNavigationArguments - { - LeftPaneNavPathParam = payload, - LeftPaneSelectItemParam = selectItem, - }; - if (rootFrame.Content != null) - { - await MainPageViewModel.AddNewTabByParam(typeof(PaneHolderPage), paneNavigationArgs); - } - else - { - rootFrame.Navigate(typeof(MainPage), paneNavigationArgs, new SuppressNavigationTransitionInfo()); - } - } - foreach (var command in parsedCommands) - { - switch (command.Type) - { - case ParsedCommandType.OpenDirectory: - case ParsedCommandType.OpenPath: - case ParsedCommandType.ExplorerShellCommand: - var selectItemCommand = parsedCommands.FirstOrDefault(x => x.Type == ParsedCommandType.SelectItem); - await PerformNavigation(command.Payload, selectItemCommand?.Payload); - break; - - case ParsedCommandType.SelectItem: - if (Path.IsPathRooted(command.Payload)) - { - await PerformNavigation(Path.GetDirectoryName(command.Payload), Path.GetFileName(command.Payload)); - } - break; - - case ParsedCommandType.TagFiles: - var tagService = Ioc.Default.GetService(); - var tag = tagService.GetTagsByName(command.Payload).FirstOrDefault(); - foreach (var file in command.Args.Skip(1)) - { - var fileFRN = await FilesystemTasks.Wrap(() => StorageHelpers.ToStorageItem(file)) - .OnSuccess(item => FileTagsHelper.GetFileFRN(item)); - if (fileFRN is not null) - { - var tagUid = tag is not null ? new[] { tag.Uid } : null; - FileTagsHelper.DbInstance.SetTags(file, fileFRN, tagUid); - FileTagsHelper.WriteFileTag(file, tagUid); - } - } - break; - - case ParsedCommandType.Unknown: - if (command.Payload.Equals(".")) - { - await PerformNavigation(activationPath); - } - else - { - var target = Path.GetFullPath(Path.Combine(activationPath, command.Payload)); - if (!string.IsNullOrEmpty(command.Payload)) - { - await PerformNavigation(target); - } - else - { - await PerformNavigation(null); - } - } - break; - - case ParsedCommandType.OutputPath: - OutputPath = command.Payload; - break; - } - } - } - - private void TryEnablePrelaunch() - { - CoreApplication.EnablePrelaunch(true); - } - - /// - /// Invoked when Navigation to a certain page fails - /// - /// The Frame which failed navigation - /// Details about the navigation failure - private void OnNavigationFailed(object sender, NavigationFailedEventArgs e) - { - throw new Exception("Failed to load Page " + e.SourcePageType.FullName); - } - - /// - /// Invoked when application execution is being suspended. Application state is saved - /// without knowing whether the application will be terminated or resumed with the contents - /// of memory still intact. - /// - /// The source of the suspend request. - /// Details about the suspend request. - private async void OnSuspending(object sender, SuspendingEventArgs e) - { - // Save application state and stop any background activity - var deferral = e.SuspendingOperation.GetDeferral(); - - SaveSessionTabs(); - - if (OutputPath != null) - { - await SafetyExtensions.IgnoreExceptions(async () => - { - var instance = MainPageViewModel.AppInstances.FirstOrDefault(x => x.Control.TabItemContent.IsCurrentInstance); - if (instance == null) - { - return; - } - var items = (instance.Control.TabItemContent as PaneHolderPage)?.ActivePane?.SlimContentPage?.SelectedItems; - if (items == null) - { - return; - } - await FileIO.WriteLinesAsync(await StorageFile.GetFileFromPathAsync(OutputPath), items.Select(x => x.ItemPath)); - }, Logger); - } - - DrivesManager?.Dispose(); - PaneViewModel?.Dispose(); - PreviewPaneViewModel?.Dispose(); - - // Try to maintain clipboard data after app close - SafetyExtensions.IgnoreExceptions(() => - { - var dataPackage = Clipboard.GetContent(); - if (dataPackage.Properties.PackageFamilyName == Package.Current.Id.FamilyName) - { - if (dataPackage.Contains(StandardDataFormats.StorageItems)) - { - Clipboard.Flush(); - } - } - }, Logger); - - deferral.Complete(); - } - - public static void SaveSessionTabs() // Enumerates through all tabs and gets the Path property and saves it to AppSettings.LastSessionPages - { - IUserSettingsService userSettingsService = Ioc.Default.GetService(); - IBundlesSettingsService bundlesSettingsService = Ioc.Default.GetService(); - - if (bundlesSettingsService != null) - { - bundlesSettingsService.FlushSettings(); - } - if (userSettingsService?.PreferencesSettingsService != null) - { - userSettingsService.PreferencesSettingsService.LastSessionTabList = MainPageViewModel.AppInstances.DefaultIfEmpty().Select(tab => - { - if (tab != null && tab.TabItemArguments != null) - { - return tab.TabItemArguments.Serialize(); - } - else - { - var defaultArg = new TabItemArguments() { InitialPageType = typeof(PaneHolderPage), NavigationArg = "Home".GetLocalized() }; - return defaultArg.Serialize(); - } - }).ToList(); - } - } - - // Occurs when an exception is not handled on the UI thread. - private static void OnUnhandledException(object sender, Windows.UI.Xaml.UnhandledExceptionEventArgs e) => AppUnhandledException(e.Exception); - - // Occurs when an exception is not handled on a background thread. - // ie. A task is fired and forgotten Task.Run(() => {...}) - private static void OnUnobservedException(object sender, UnobservedTaskExceptionEventArgs e) => AppUnhandledException(e.Exception); - - private static void AppUnhandledException(Exception ex) - { - string formattedException = string.Empty; - - formattedException += "--------- UNHANDLED EXCEPTION ---------"; - if (ex != null) - { - formattedException += $"\n>>>> HRESULT: {ex.HResult}\n"; - if (ex.Message != null) - { - formattedException += "\n--- MESSAGE ---"; - formattedException += ex.Message; - } - if (ex.StackTrace != null) - { - formattedException += "\n--- STACKTRACE ---"; - formattedException += ex.StackTrace; - } - if (ex.Source != null) - { - formattedException += "\n--- SOURCE ---"; - formattedException += ex.Source; - } - if (ex.InnerException != null) - { - formattedException += "\n--- INNER ---"; - formattedException += ex.InnerException; - } - } - else - { - formattedException += "\nException is null!\n"; - } - - formattedException += "---------------------------------------"; - - Debug.WriteLine(formattedException); - - Debugger.Break(); // Please check "Output Window" for exception details (View -> Output Window) (CTRL + ALT + O) - - SaveSessionTabs(); - Logger.UnhandledError(ex, ex.Message); - if (ShowErrorNotification) - { - var toastContent = new ToastContent() - { - Visual = new ToastVisual() - { - BindingGeneric = new ToastBindingGeneric() - { - Children = - { - new AdaptiveText() - { - Text = "ExceptionNotificationHeader".GetLocalized() - }, - new AdaptiveText() - { - Text = "ExceptionNotificationBody".GetLocalized() - } - }, - AppLogoOverride = new ToastGenericAppLogo() - { - Source = "ms-appx:///Assets/error.png" - } - } - }, - Actions = new ToastActionsCustom() - { - Buttons = - { - new ToastButton("ExceptionNotificationReportButton".GetLocalized(), "report") - { - ActivationType = ToastActivationType.Foreground - } - } - } - }; - - // Create the toast notification - var toastNotif = new ToastNotification(toastContent.GetXml()); - - // And send the notification - ToastNotificationManager.CreateToastNotifier().Show(toastNotif); - } - } - - public static async void CloseApp() - { - if (!await ApplicationView.GetForCurrentView().TryConsolidateAsync()) - { - Application.Current.Exit(); - } - } + public static IntPtr WindowHandle { get; private set; } } } diff --git a/src/Files.Uwp/App.xaml.old.cs b/src/Files.Uwp/App.xaml.old.cs new file mode 100644 index 000000000000..9c7bb214b5b0 --- /dev/null +++ b/src/Files.Uwp/App.xaml.old.cs @@ -0,0 +1,758 @@ +using CommunityToolkit.Mvvm.DependencyInjection; +using Files.Backend.Services; +using Files.Backend.Services.Settings; +using Files.Backend.Services.SizeProvider; +using Files.Shared; +using Files.Shared.Cloud; +using Files.Shared.Extensions; +using Files.Shared.Services.DateTimeFormatter; +using Files.Uwp.CommandLine; +using Files.Uwp.Controllers; +using Files.Uwp.Filesystem; +using Files.Uwp.Filesystem.Cloud; +using Files.Uwp.Filesystem.FilesystemHistory; +using Files.Uwp.Helpers; +using Files.Uwp.ServicesImplementation; +using Files.Uwp.ServicesImplementation.DateTimeFormatter; +using Files.Uwp.ServicesImplementation.Settings; +using Files.Uwp.UserControls.MultitaskingControl; +using Files.Uwp.ViewModels; +using Files.Uwp.ViewModels.SettingsViewModels; +using Files.Uwp.Views; +using Microsoft.AppCenter; +using Microsoft.AppCenter.Analytics; +using Microsoft.AppCenter.Crashes; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Toolkit.Uwp; +using Microsoft.Toolkit.Uwp.Helpers; +using Microsoft.Toolkit.Uwp.Notifications; +using System; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Threading.Tasks; +using Windows.ApplicationModel; +using Windows.ApplicationModel.Activation; +using Windows.ApplicationModel.Core; +using Windows.ApplicationModel.DataTransfer; +using Windows.Foundation.Metadata; +using Windows.Storage; +using Windows.System; +using Windows.UI.Core; +using Windows.UI.Notifications; +using Windows.UI.ViewManagement; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Media.Animation; +using Microsoft.UI.Xaml.Navigation; + +namespace Files.Uwp +{ + sealed partial class App : Application + { + private static bool ShowErrorNotification = false; + private static string OutputPath = null; + + public static StorageHistoryWrapper HistoryWrapper = new StorageHistoryWrapper(); + public static SettingsViewModel AppSettings { get; private set; } + public static MainViewModel MainViewModel { get; private set; } + public static PaneViewModel PaneViewModel { get; private set; } + public static PreviewPaneViewModel PreviewPaneViewModel { get; private set; } + public static JumpListManager JumpList { get; private set; } + public static RecentItemsManager RecentItemsManager { get; private set; } + public static SidebarPinnedController SidebarPinnedController { get; private set; } + public static TerminalController TerminalController { get; private set; } + public static CloudDrivesManager CloudDrivesManager { get; private set; } + public static NetworkDrivesManager NetworkDrivesManager { get; private set; } + public static DrivesManager DrivesManager { get; private set; } + public static WSLDistroManager WSLDistroManager { get; private set; } + public static LibraryManager LibraryManager { get; private set; } + public static FileTagsManager FileTagsManager { get; private set; } + public static ExternalResourcesHelper ExternalResourcesHelper { get; private set; } + + public static ILogger Logger { get; private set; } + private static readonly UniversalLogWriter logWriter = new UniversalLogWriter(); + + public static OngoingTasksViewModel OngoingTasksViewModel { get; } = new OngoingTasksViewModel(); + public static SecondaryTileHelper SecondaryTileHelper { get; private set; } = new SecondaryTileHelper(); + + public static string AppVersion = $"{Package.Current.Id.Version.Major}.{Package.Current.Id.Version.Minor}.{Package.Current.Id.Version.Build}.{Package.Current.Id.Version.Revision}"; + + public IServiceProvider Services { get; private set; } + + public App() + { + // Initialize logger + Logger = new Logger(logWriter); + + UnhandledException += OnUnhandledException; + TaskScheduler.UnobservedTaskException += OnUnobservedException; + InitializeComponent(); + Suspending += OnSuspending; + LeavingBackground += OnLeavingBackground; + + AppServiceConnectionHelper.Register(); + + this.Services = ConfigureServices(); + Ioc.Default.ConfigureServices(Services); + } + + private IServiceProvider ConfigureServices() + { + ServiceCollection services = new ServiceCollection(); + + services + // TODO: Loggers: + + // Settings: + // Base IUserSettingsService as parent settings store (to get ISettingsSharingContext from) + .AddSingleton() + // Children settings (from IUserSettingsService) + .AddSingleton((sp) => new MultitaskingSettingsService((sp.GetService() as UserSettingsService).GetSharingContext())) + .AddSingleton((sp) => new WidgetsSettingsService((sp.GetService() as UserSettingsService).GetSharingContext())) + .AddSingleton((sp) => new AppearanceSettingsService((sp.GetService() as UserSettingsService).GetSharingContext())) + .AddSingleton((sp) => new PreferencesSettingsService((sp.GetService() as UserSettingsService).GetSharingContext())) + .AddSingleton((sp) => new ApplicationSettingsService((sp.GetService() as UserSettingsService).GetSharingContext())) + .AddSingleton((sp) => new PaneSettingsService((sp.GetService() as UserSettingsService).GetSharingContext())) + .AddSingleton((sp) => new LayoutSettingsService((sp.GetService() as UserSettingsService).GetSharingContext())) + // Settings not related to IUserSettingsService: + .AddSingleton() + .AddSingleton() + + // Other services + .AddSingleton(Logger) + .AddSingleton() + .AddSingleton() + .AddSingleton() + .AddSingleton() + .AddSingleton() +#if SIDELOAD + .AddSingleton() +#else + .AddSingleton() +#endif + .AddSingleton() + .AddSingleton() + .AddSingleton() + + // TODO(i): FileSystem operations: + // (IFilesystemHelpersService, IFilesystemOperationsService) + // (IStorageEnumerator, IFallbackStorageEnumerator) + .AddSingleton() + + ; // End of service configuration + + + return services.BuildServiceProvider(); + } + + private static async Task EnsureSettingsAndConfigurationAreBootstrapped() + { + AppSettings ??= new SettingsViewModel(); + + ExternalResourcesHelper ??= new ExternalResourcesHelper(); + await ExternalResourcesHelper.LoadSelectedTheme(); + new AppearanceViewModel().SetCompactStyles(updateTheme: false); + + JumpList ??= new JumpListManager(); + RecentItemsManager ??= new RecentItemsManager(); + MainViewModel ??= new MainViewModel(); + PaneViewModel ??= new PaneViewModel(); + PreviewPaneViewModel ??= new PreviewPaneViewModel(); + LibraryManager ??= new LibraryManager(); + DrivesManager ??= new DrivesManager(); + NetworkDrivesManager ??= new NetworkDrivesManager(); + CloudDrivesManager ??= new CloudDrivesManager(); + WSLDistroManager ??= new WSLDistroManager(); + FileTagsManager ??= new FileTagsManager(); + SidebarPinnedController ??= new SidebarPinnedController(); + TerminalController ??= new TerminalController(); + } + + private static async Task StartAppCenter() + { + try + { + if (!AppCenter.Configured) + { + var file = await StorageFile.GetFileFromApplicationUriAsync(new Uri(@"ms-appx:///Resources/AppCenterKey.txt")); + var lines = await FileIO.ReadTextAsync(file); + var obj = Newtonsoft.Json.Linq.JObject.Parse(lines); + AppCenter.Start((string)obj.SelectToken("key"), typeof(Analytics), typeof(Crashes)); + } + } + catch (Exception ex) + { + Logger.Warn(ex, "AppCenter could not be started."); + } + } + + private static async Task InitializeAppComponentsAsync() + { + var userSettingsService = Ioc.Default.GetRequiredService(); + var appearanceSettingsService = userSettingsService.AppearanceSettingsService; + + // Start off a list of tasks we need to run before we can continue startup + await Task.Run(async () => + { + await Task.WhenAll( + StartAppCenter(), + DrivesManager.UpdateDrivesAsync(), + OptionalTask(CloudDrivesManager.UpdateDrivesAsync(), appearanceSettingsService.ShowCloudDrivesSection), + LibraryManager.UpdateLibrariesAsync(), + OptionalTask(NetworkDrivesManager.UpdateDrivesAsync(), appearanceSettingsService.ShowNetworkDrivesSection), + OptionalTask(WSLDistroManager.UpdateDrivesAsync(), appearanceSettingsService.ShowWslSection), + OptionalTask(FileTagsManager.UpdateFileTagsAsync(), appearanceSettingsService.ShowFileTagsSection), + SidebarPinnedController.InitializeAsync() + ); + await Task.WhenAll( + AppSettings.DetectQuickLook(), + TerminalController.InitializeAsync(), + JumpList.InitializeAsync(), + ExternalResourcesHelper.LoadOtherThemesAsync(), + ContextFlyoutItemHelper.CachedNewContextMenuEntries + ); + + userSettingsService.ReportToAppCenter(); + }); + + // Check for required updates + var updateService = Ioc.Default.GetRequiredService(); + await updateService.CheckForUpdates(); + await updateService.DownloadMandatoryUpdates(); + + static async Task OptionalTask(Task task, bool condition) + { + if (condition) + { + await task; + } + } + } + + private void OnLeavingBackground(object sender, LeavingBackgroundEventArgs e) + { + DrivesManager?.ResumeDeviceWatcher(); + } + + /// + /// Invoked when the application is launched normally by the end user. Other entry points + /// will be used such as when the application is launched to open a specific file. + /// + /// Details about the launch request and process. + protected override async void OnLaunched(LaunchActivatedEventArgs e) + { + await logWriter.InitializeAsync("debug.log"); + Logger.Info($"App launched. Prelaunch: {e.PrelaunchActivated}"); + + //start tracking app usage + SystemInformation.Instance.TrackAppUse(e); + + bool canEnablePrelaunch = ApiInformation.IsMethodPresent("Windows.ApplicationModel.Core.CoreApplication", "EnablePrelaunch"); + + await EnsureSettingsAndConfigurationAreBootstrapped(); + _ = InitializeAppComponentsAsync().ContinueWith(t => Logger.Warn(t.Exception, "Error during InitializeAppComponentsAsync()"), TaskContinuationOptions.OnlyOnFaulted); + + var rootFrame = EnsureWindowIsInitialized(); + + if (e.PrelaunchActivated == false) + { + if (canEnablePrelaunch) + { + TryEnablePrelaunch(); + } + + if (rootFrame.Content == null) + { + // When the navigation stack isn't restored navigate to the first page, + // configuring the new page by passing required information as a navigation + // parameter + rootFrame.Navigate(typeof(MainPage), e.Arguments, new SuppressNavigationTransitionInfo()); + } + else + { + if (!(string.IsNullOrEmpty(e.Arguments) && MainPageViewModel.AppInstances.Count > 0)) + { + await MainPageViewModel.AddNewTabByPathAsync(typeof(PaneHolderPage), e.Arguments); + } + } + + // Ensure the current window is active + App.Window.Activate(); + App.Window.CoreWindow.Activated += CoreWindow_Activated; + } + else + { + if (rootFrame.Content == null) + { + // When the navigation stack isn't restored navigate to the first page, + // configuring the new page by passing required information as a navigation + // parameter + rootFrame.Navigate(typeof(MainPage), e.Arguments, new SuppressNavigationTransitionInfo()); + } + else + { + if (!(string.IsNullOrEmpty(e.Arguments) && MainPageViewModel.AppInstances.Count > 0)) + { + await MainPageViewModel.AddNewTabByPathAsync(typeof(PaneHolderPage), e.Arguments); + } + } + } + + WindowDecorationsHelper.RequestWindowDecorationsAccess(); + } + + protected override async void OnFileActivated(FileActivatedEventArgs e) + { + await logWriter.InitializeAsync("debug.log"); + Logger.Info("App activated by file"); + + //start tracking app usage + SystemInformation.Instance.TrackAppUse(e); + + await EnsureSettingsAndConfigurationAreBootstrapped(); + _ = InitializeAppComponentsAsync().ContinueWith(t => Logger.Warn(t.Exception, "Error during InitializeAppComponentsAsync()"), TaskContinuationOptions.OnlyOnFaulted); + + var rootFrame = EnsureWindowIsInitialized(); + + var index = 0; + if (rootFrame.Content == null) + { + // When the navigation stack isn't restored navigate to the first page, + // configuring the new page by passing required information as a navigation + // parameter + rootFrame.Navigate(typeof(MainPage), e.Files.First().Path, new SuppressNavigationTransitionInfo()); + index = 1; + } + for (; index < e.Files.Count; index++) + { + await MainPageViewModel.AddNewTabByPathAsync(typeof(PaneHolderPage), e.Files[index].Path); + } + + // Ensure the current window is active + App.Window.Activate(); + App.Window.CoreWindow.Activated += CoreWindow_Activated; + + WindowDecorationsHelper.RequestWindowDecorationsAccess(); + } + + private Frame EnsureWindowIsInitialized() + { + // Do not repeat app initialization when the Window already has content, + // just ensure that the window is active + if (!(App.Window.Content is Frame rootFrame)) + { + // Create a Frame to act as the navigation context and navigate to the first page + rootFrame = new Frame(); + rootFrame.CacheSize = 1; + rootFrame.NavigationFailed += OnNavigationFailed; + + //if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) + //{ + // //TODO: Load state from previously suspended application + //} + + // Place the frame in the current Window + App.Window.Content = rootFrame; + } + + return rootFrame; + } + + private void CoreWindow_Activated(CoreWindow sender, WindowActivatedEventArgs args) + { + if (args.WindowActivationState == CoreWindowActivationState.CodeActivated || + args.WindowActivationState == CoreWindowActivationState.PointerActivated) + { + ShowErrorNotification = true; + ApplicationData.Current.LocalSettings.Values["INSTANCE_ACTIVE"] = Process.GetCurrentProcess().Id; + if (MainViewModel != null) + { + MainViewModel.Clipboard_ContentChanged(null, null); + } + } + } + + protected override async void OnActivated(IActivatedEventArgs args) + { + await logWriter.InitializeAsync("debug.log"); + Logger.Info($"App activated by {args.Kind.ToString()}"); + + await EnsureSettingsAndConfigurationAreBootstrapped(); + _ = InitializeAppComponentsAsync().ContinueWith(t => Logger.Warn(t.Exception, "Error during InitializeAppComponentsAsync()"), TaskContinuationOptions.OnlyOnFaulted); + + var rootFrame = EnsureWindowIsInitialized(); + + switch (args.Kind) + { + case ActivationKind.Protocol: + var eventArgs = args as ProtocolActivatedEventArgs; + + if (eventArgs.Uri.AbsoluteUri == "files-uwp:") + { + rootFrame.Navigate(typeof(MainPage), null, new SuppressNavigationTransitionInfo()); + } + else + { + var parsedArgs = eventArgs.Uri.Query.TrimStart('?').Split('='); + var unescapedValue = Uri.UnescapeDataString(parsedArgs[1]); + var folder = (StorageFolder)await FilesystemTasks.Wrap(() => StorageFolder.GetFolderFromPathAsync(unescapedValue).AsTask()); + if (folder != null && !string.IsNullOrEmpty(folder.Path)) + { + unescapedValue = folder.Path; // Convert short name to long name (#6190) + } + switch (parsedArgs[0]) + { + case "tab": + rootFrame.Navigate(typeof(MainPage), TabItemArguments.Deserialize(unescapedValue), new SuppressNavigationTransitionInfo()); + break; + + case "folder": + rootFrame.Navigate(typeof(MainPage), unescapedValue, new SuppressNavigationTransitionInfo()); + break; + + case "cmd": + var ppm = CommandLineParser.ParseUntrustedCommands(unescapedValue); + if (ppm.IsEmpty()) + { + ppm = new ParsedCommands() { new ParsedCommand() { Type = ParsedCommandType.Unknown, Args = new() { "." } } }; + } + await InitializeFromCmdLineArgs(rootFrame, ppm); + break; + } + } + + if (rootFrame.Content != null) + { + // Ensure the current window is active. + App.Window.Activate(); + App.Window.CoreWindow.Activated += CoreWindow_Activated; + return; + } + break; + + case ActivationKind.CommandLineLaunch: + var cmdLineArgs = args as CommandLineActivatedEventArgs; + var operation = cmdLineArgs.Operation; + var cmdLineString = operation.Arguments; + var activationPath = operation.CurrentDirectoryPath; + + var parsedCommands = CommandLineParser.ParseUntrustedCommands(cmdLineString); + if (parsedCommands != null && parsedCommands.Count > 0) + { + await InitializeFromCmdLineArgs(rootFrame, parsedCommands, activationPath); + + if (rootFrame.Content != null) + { + // Ensure the current window is active. + App.Window.Activate(); + App.Window.CoreWindow.Activated += CoreWindow_Activated; + return; + } + } + break; + + case ActivationKind.ToastNotification: + var eventArgsForNotification = args as ToastNotificationActivatedEventArgs; + if (eventArgsForNotification.Argument == "report") + { + await Launcher.LaunchUriAsync(new Uri(Constants.GitHub.FeedbackUrl)); + } + break; + + case ActivationKind.StartupTask: + break; + } + + rootFrame.Navigate(typeof(MainPage), null, new SuppressNavigationTransitionInfo()); + + // Ensure the current window is active. + App.Window.Activate(); + App.Window.CoreWindow.Activated += CoreWindow_Activated; + + WindowDecorationsHelper.RequestWindowDecorationsAccess(); + } + + private async Task InitializeFromCmdLineArgs(Frame rootFrame, ParsedCommands parsedCommands, string activationPath = "") + { + async Task PerformNavigation(string payload, string selectItem = null) + { + if (!string.IsNullOrEmpty(payload)) + { + payload = CommonPaths.ShellPlaces.Get(payload.ToUpperInvariant(), payload); + var folder = (StorageFolder)await FilesystemTasks.Wrap(() => StorageFolder.GetFolderFromPathAsync(payload).AsTask()); + if (folder != null && !string.IsNullOrEmpty(folder.Path)) + { + payload = folder.Path; // Convert short name to long name (#6190) + } + } + var paneNavigationArgs = new PaneNavigationArguments + { + LeftPaneNavPathParam = payload, + LeftPaneSelectItemParam = selectItem, + }; + if (rootFrame.Content != null) + { + await MainPageViewModel.AddNewTabByParam(typeof(PaneHolderPage), paneNavigationArgs); + } + else + { + rootFrame.Navigate(typeof(MainPage), paneNavigationArgs, new SuppressNavigationTransitionInfo()); + } + } + foreach (var command in parsedCommands) + { + switch (command.Type) + { + case ParsedCommandType.OpenDirectory: + case ParsedCommandType.OpenPath: + case ParsedCommandType.ExplorerShellCommand: + var selectItemCommand = parsedCommands.FirstOrDefault(x => x.Type == ParsedCommandType.SelectItem); + await PerformNavigation(command.Payload, selectItemCommand?.Payload); + break; + + case ParsedCommandType.SelectItem: + if (Path.IsPathRooted(command.Payload)) + { + await PerformNavigation(Path.GetDirectoryName(command.Payload), Path.GetFileName(command.Payload)); + } + break; + + case ParsedCommandType.TagFiles: + var tagService = Ioc.Default.GetService(); + var tag = tagService.GetTagsByName(command.Payload).FirstOrDefault(); + foreach (var file in command.Args.Skip(1)) + { + var fileFRN = await FilesystemTasks.Wrap(() => StorageHelpers.ToStorageItem(file)) + .OnSuccess(item => FileTagsHelper.GetFileFRN(item)); + if (fileFRN is not null) + { + var tagUid = tag is not null ? new[] { tag.Uid } : null; + FileTagsHelper.DbInstance.SetTags(file, fileFRN, tagUid); + FileTagsHelper.WriteFileTag(file, tagUid); + } + } + break; + + case ParsedCommandType.Unknown: + if (command.Payload.Equals(".")) + { + await PerformNavigation(activationPath); + } + else + { + var target = Path.GetFullPath(Path.Combine(activationPath, command.Payload)); + if (!string.IsNullOrEmpty(command.Payload)) + { + await PerformNavigation(target); + } + else + { + await PerformNavigation(null); + } + } + break; + + case ParsedCommandType.OutputPath: + OutputPath = command.Payload; + break; + } + } + } + + private void TryEnablePrelaunch() + { + CoreApplication.EnablePrelaunch(true); + } + + /// + /// Invoked when Navigation to a certain page fails + /// + /// The Frame which failed navigation + /// Details about the navigation failure + private void OnNavigationFailed(object sender, NavigationFailedEventArgs e) + { + throw new Exception("Failed to load Page " + e.SourcePageType.FullName); + } + + /// + /// Invoked when application execution is being suspended. Application state is saved + /// without knowing whether the application will be terminated or resumed with the contents + /// of memory still intact. + /// + /// The source of the suspend request. + /// Details about the suspend request. + private async void OnSuspending(object sender, SuspendingEventArgs e) + { + // Save application state and stop any background activity + var deferral = e.SuspendingOperation.GetDeferral(); + + SaveSessionTabs(); + + if (OutputPath != null) + { + await SafetyExtensions.IgnoreExceptions(async () => + { + var instance = MainPageViewModel.AppInstances.FirstOrDefault(x => x.Control.TabItemContent.IsCurrentInstance); + if (instance == null) + { + return; + } + var items = (instance.Control.TabItemContent as PaneHolderPage)?.ActivePane?.SlimContentPage?.SelectedItems; + if (items == null) + { + return; + } + await FileIO.WriteLinesAsync(await StorageFile.GetFileFromPathAsync(OutputPath), items.Select(x => x.ItemPath)); + }, Logger); + } + + DrivesManager?.Dispose(); + PaneViewModel?.Dispose(); + PreviewPaneViewModel?.Dispose(); + + // Try to maintain clipboard data after app close + SafetyExtensions.IgnoreExceptions(() => + { + var dataPackage = Clipboard.GetContent(); + if (dataPackage.Properties.PackageFamilyName == Package.Current.Id.FamilyName) + { + if (dataPackage.Contains(StandardDataFormats.StorageItems)) + { + Clipboard.Flush(); + } + } + }, Logger); + + deferral.Complete(); + } + + public static void SaveSessionTabs() // Enumerates through all tabs and gets the Path property and saves it to AppSettings.LastSessionPages + { + IUserSettingsService userSettingsService = Ioc.Default.GetService(); + IBundlesSettingsService bundlesSettingsService = Ioc.Default.GetService(); + + if (bundlesSettingsService != null) + { + bundlesSettingsService.FlushSettings(); + } + if (userSettingsService?.PreferencesSettingsService != null) + { + userSettingsService.PreferencesSettingsService.LastSessionTabList = MainPageViewModel.AppInstances.DefaultIfEmpty().Select(tab => + { + if (tab != null && tab.TabItemArguments != null) + { + return tab.TabItemArguments.Serialize(); + } + else + { + var defaultArg = new TabItemArguments() { InitialPageType = typeof(PaneHolderPage), NavigationArg = "Home".GetLocalized() }; + return defaultArg.Serialize(); + } + }).ToList(); + } + } + + // Occurs when an exception is not handled on the UI thread. + private static void OnUnhandledException(object sender, Microsoft.UI.Xaml.UnhandledExceptionEventArgs e) => AppUnhandledException(e.Exception); + + // Occurs when an exception is not handled on a background thread. + // ie. A task is fired and forgotten Task.Run(() => {...}) + private static void OnUnobservedException(object sender, UnobservedTaskExceptionEventArgs e) => AppUnhandledException(e.Exception); + + private static void AppUnhandledException(Exception ex) + { + string formattedException = string.Empty; + + formattedException += "--------- UNHANDLED EXCEPTION ---------"; + if (ex != null) + { + formattedException += $"\n>>>> HRESULT: {ex.HResult}\n"; + if (ex.Message != null) + { + formattedException += "\n--- MESSAGE ---"; + formattedException += ex.Message; + } + if (ex.StackTrace != null) + { + formattedException += "\n--- STACKTRACE ---"; + formattedException += ex.StackTrace; + } + if (ex.Source != null) + { + formattedException += "\n--- SOURCE ---"; + formattedException += ex.Source; + } + if (ex.InnerException != null) + { + formattedException += "\n--- INNER ---"; + formattedException += ex.InnerException; + } + } + else + { + formattedException += "\nException is null!\n"; + } + + formattedException += "---------------------------------------"; + + Debug.WriteLine(formattedException); + + Debugger.Break(); // Please check "Output Window" for exception details (View -> Output Window) (CTRL + ALT + O) + + SaveSessionTabs(); + Logger.UnhandledError(ex, ex.Message); + if (ShowErrorNotification) + { + var toastContent = new ToastContent() + { + Visual = new ToastVisual() + { + BindingGeneric = new ToastBindingGeneric() + { + Children = + { + new AdaptiveText() + { + Text = "ExceptionNotificationHeader".GetLocalized() + }, + new AdaptiveText() + { + Text = "ExceptionNotificationBody".GetLocalized() + } + }, + AppLogoOverride = new ToastGenericAppLogo() + { + Source = "ms-appx:///Assets/error.png" + } + } + }, + Actions = new ToastActionsCustom() + { + Buttons = + { + new ToastButton("ExceptionNotificationReportButton".GetLocalized(), "report") + { + ActivationType = ToastActivationType.Foreground + } + } + } + }; + + // Create the toast notification + var toastNotif = new ToastNotification(toastContent.GetXml()); + + // And send the notification + ToastNotificationManager.CreateToastNotifier().Show(toastNotif); + } + } + + public static async void CloseApp() + { + if (!await ApplicationView.GetForCurrentView().TryConsolidateAsync()) + { + Application.Current.Exit(); + } + } + } +} diff --git a/src/Files.Uwp/BaseLayout.cs b/src/Files.Uwp/BaseLayout.cs index 517a5d99e992..8f66b24452ab 100644 --- a/src/Files.Uwp/BaseLayout.cs +++ b/src/Files.Uwp/BaseLayout.cs @@ -1,4 +1,4 @@ -using CommunityToolkit.Mvvm.DependencyInjection; +using CommunityToolkit.Mvvm.DependencyInjection; using Files.Backend.Services.Settings; using Files.Uwp.EventArguments; using Files.Uwp.Extensions; @@ -29,12 +29,12 @@ using Windows.Storage; using Windows.System; using Windows.UI.Core; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Controls.Primitives; -using Windows.UI.Xaml.Data; -using Windows.UI.Xaml.Input; -using Windows.UI.Xaml.Navigation; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Controls.Primitives; +using Microsoft.UI.Xaml.Data; +using Microsoft.UI.Xaml.Input; +using Microsoft.UI.Xaml.Navigation; using Files.Uwp.UserControls.Menus; using static Files.Uwp.Helpers.PathNormalization; @@ -97,7 +97,7 @@ public bool IsMiddleClickToScrollEnabled } } - protected AddressToolbar NavToolbar => (Window.Current.Content as Frame).FindDescendant(); + protected AddressToolbar NavToolbar => (App.Window.Content as Frame).FindDescendant(); private CollectionViewSource collectionViewSource = new CollectionViewSource() { @@ -232,7 +232,7 @@ internal set // check if the preview pane is open before updating the model if (PaneViewModel.IsPreviewSelected) { - bool isPaneEnabled = ((Window.Current.Content as Frame)?.Content as MainPage)?.IsPaneEnabled ?? false; + bool isPaneEnabled = ((App.Window.Content as Frame)?.Content as MainPage)?.IsPaneEnabled ?? false; if (isPaneEnabled) { App.PreviewPaneViewModel.UpdateSelectedItemPreview(); @@ -413,7 +413,7 @@ protected override async void OnNavigatedTo(NavigationEventArgs eventArgs) { base.OnNavigatedTo(eventArgs); // Add item jumping handler - Window.Current.CoreWindow.CharacterReceived += Page_CharacterReceived; + App.Window.CoreWindow.CharacterReceived += Page_CharacterReceived; navigationArguments = (NavigationArguments)eventArgs.Parameter; ParentShellPageInstance = navigationArguments.AssociatedTabInstance; InitializeCommandsViewModel(); @@ -543,7 +543,7 @@ protected override void OnNavigatingFrom(NavigatingCancelEventArgs e) { base.OnNavigatingFrom(e); // Remove item jumping handler - Window.Current.CoreWindow.CharacterReceived -= Page_CharacterReceived; + App.Window.CoreWindow.CharacterReceived -= Page_CharacterReceived; FolderSettings.LayoutModeChangeRequested -= BaseFolderSettings_LayoutModeChangeRequested; FolderSettings.GroupOptionPreferenceUpdated -= FolderSettings_GroupOptionPreferenceUpdated; ItemContextMenuFlyout.Opening -= ItemContextFlyout_Opening; @@ -590,7 +590,7 @@ public async void BaseContextFlyout_Opening(object sender, object e) } shellContextMenuItemCancellationToken?.Cancel(); shellContextMenuItemCancellationToken = new CancellationTokenSource(); - var shiftPressed = Window.Current.CoreWindow.GetKeyState(VirtualKey.Shift).HasFlag(CoreVirtualKeyStates.Down); + var shiftPressed = App.Window.CoreWindow.GetKeyState(VirtualKey.Shift).HasFlag(CoreVirtualKeyStates.Down); var items = ContextFlyoutItemHelper.GetBaseContextCommandsWithoutShellItems(connection: await Connection, currentInstanceViewModel: InstanceViewModel, itemViewModel: ParentShellPageInstance.FilesystemViewModel, commandsViewModel: CommandsViewModel, shiftPressed: shiftPressed, false); BaseContextMenuFlyout.PrimaryCommands.Clear(); BaseContextMenuFlyout.SecondaryCommands.Clear(); @@ -649,7 +649,7 @@ private async Task LoadMenuItemsAsync() shellContextMenuItemCancellationToken?.Cancel(); shellContextMenuItemCancellationToken = new CancellationTokenSource(); SelectedItemsPropertiesViewModel.CheckFileExtension(SelectedItem?.FileExtension); - var shiftPressed = Window.Current.CoreWindow.GetKeyState(VirtualKey.Shift).HasFlag(CoreVirtualKeyStates.Down); + var shiftPressed = App.Window.CoreWindow.GetKeyState(VirtualKey.Shift).HasFlag(CoreVirtualKeyStates.Down); var items = ContextFlyoutItemHelper.GetItemContextCommandsWithoutShellItems(currentInstanceViewModel: InstanceViewModel, workingDir: ParentShellPageInstance.FilesystemViewModel.WorkingDirectory, selectedItems: SelectedItems, selectedItemsPropertiesViewModel: SelectedItemsPropertiesViewModel, commandsViewModel: CommandsViewModel, shiftPressed: shiftPressed, showOpenMenu: false); ItemContextMenuFlyout.PrimaryCommands.Clear(); ItemContextMenuFlyout.SecondaryCommands.Clear(); @@ -703,17 +703,17 @@ private void AddShellItemsToMenu(List shellMenuI var overflowItems = ItemModelListToContextFlyoutHelper.GetMenuFlyoutItemsFromModel(overflowShellMenuItems); var mainItems = ItemModelListToContextFlyoutHelper.GetAppBarButtonsFromModelIgnorePrimary(mainShellMenuItems); - var openedPopups = Windows.UI.Xaml.Media.VisualTreeHelper.GetOpenPopups(Window.Current); + var openedPopups = Microsoft.UI.Xaml.Media.VisualTreeHelper.GetOpenPopups(App.Window); var secondaryMenu = openedPopups.FirstOrDefault(popup => popup.Name == "OverflowPopup"); var itemsControl = secondaryMenu?.Child.FindDescendant(); if (itemsControl is not null) { contextMenuFlyout.SetValue(ContextMenuExtensions.ItemsControlProperty, itemsControl); - var ttv = secondaryMenu.TransformToVisual(Window.Current.Content); + var ttv = secondaryMenu.TransformToVisual(App.Window.Content); var cMenuPos = ttv.TransformPoint(new Point(0, 0)); var requiredHeight = contextMenuFlyout.SecondaryCommands.Concat(mainItems).Where(x => x is not AppBarSeparator).Count() * Constants.UI.ContextMenuSecondaryItemsHeight; - var availableHeight = Window.Current.Bounds.Height - cMenuPos.Y - Constants.UI.ContextMenuPrimaryItemsHeight; + var availableHeight = App.Window.Bounds.Height - cMenuPos.Y - Constants.UI.ContextMenuPrimaryItemsHeight; if (requiredHeight > availableHeight) { itemsControl.MaxHeight = Math.Min(Constants.UI.ContextMenuMaxHeight, Math.Max(itemsControl.ActualHeight, Math.Min(availableHeight, requiredHeight))); // Set menu max height to current height (avoids menu repositioning) @@ -1184,7 +1184,9 @@ protected async void ValidateItemNameInputText(TextBox textBox, TextBoxBeforeTex if (FilesystemHelpers.ContainsRestrictedCharacters(args.NewText)) { args.Cancel = true; - await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => + await /* + TODO UA306_A2: UWP CoreDispatcher : Windows.UI.Core.CoreDispatcher is no longer supported. Use DispatcherQueue instead. Read: https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/guides/threading + */Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { var oldSelection = textBox.SelectionStart + textBox.SelectionLength; var oldText = textBox.Text; diff --git a/src/Files.Uwp/Behaviors/StickyHeaderBehavior.cs b/src/Files.Uwp/Behaviors/StickyHeaderBehavior.cs index 04bfa2c16f5b..342e564875eb 100644 --- a/src/Files.Uwp/Behaviors/StickyHeaderBehavior.cs +++ b/src/Files.Uwp/Behaviors/StickyHeaderBehavior.cs @@ -1,19 +1,19 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using Microsoft.Toolkit.Uwp.UI; -using Microsoft.Toolkit.Uwp.UI.Animations.Expressions; +using CommunityToolkit.WinUI.UI.Animations.Expressions; using Microsoft.Toolkit.Uwp.UI.Behaviors; using System.Linq; using Windows.Foundation; using Windows.Foundation.Metadata; -using Windows.UI.Composition; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Hosting; -using Windows.UI.Xaml.Input; -using Windows.UI.Xaml.Media; +using Microsoft.UI.Composition; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Hosting; +using Microsoft.UI.Xaml.Input; +using Microsoft.UI.Xaml.Media; namespace Files.Uwp.Behaviors { @@ -21,11 +21,11 @@ namespace Files.Uwp.Behaviors /// Performs an animation on a ListView or GridView Header to make it sticky using composition. /// /// - /// Microsoft.Xaml.Interactivity.Behavior{Windows.UI.Xaml.UIElement} + /// Microsoft.Xaml.Interactivity.Behavior{Microsoft.UI.Xaml.UIElement} /// public class StickyHeaderBehavior : BehaviorBase { - public static bool IsXamlRootAvailable { get; } = ApiInformation.IsPropertyPresent("Windows.UI.Xaml.UIElement", "XamlRoot"); + public static bool IsXamlRootAvailable { get; } = ApiInformation.IsPropertyPresent("Microsoft.UI.Xaml.UIElement", "XamlRoot"); /// /// Attaches the behavior to the associated object. diff --git a/src/Files.Uwp/CommandLine/CommandLineParser.cs b/src/Files.Uwp/CommandLine/CommandLineParser.cs index b4d8c2a3c81c..8db67877086c 100644 --- a/src/Files.Uwp/CommandLine/CommandLineParser.cs +++ b/src/Files.Uwp/CommandLine/CommandLineParser.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; diff --git a/src/Files.Uwp/CommandLine/ParsedCommand.cs b/src/Files.Uwp/CommandLine/ParsedCommand.cs index 775004866052..f1de0871dbaa 100644 --- a/src/Files.Uwp/CommandLine/ParsedCommand.cs +++ b/src/Files.Uwp/CommandLine/ParsedCommand.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; namespace Files.Uwp.CommandLine diff --git a/src/Files.Uwp/CommandLine/ParsedCommandType.cs b/src/Files.Uwp/CommandLine/ParsedCommandType.cs index 0146b3883cbb..1e5f5e761e8b 100644 --- a/src/Files.Uwp/CommandLine/ParsedCommandType.cs +++ b/src/Files.Uwp/CommandLine/ParsedCommandType.cs @@ -1,4 +1,4 @@ -namespace Files.Uwp.CommandLine +namespace Files.Uwp.CommandLine { internal enum ParsedCommandType { diff --git a/src/Files.Uwp/CommandLine/ParsedCommands.cs b/src/Files.Uwp/CommandLine/ParsedCommands.cs index c6082569db46..9a6b0495a4b3 100644 --- a/src/Files.Uwp/CommandLine/ParsedCommands.cs +++ b/src/Files.Uwp/CommandLine/ParsedCommands.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; namespace Files.Uwp.CommandLine { diff --git a/src/Files.Uwp/Constants.cs b/src/Files.Uwp/Constants.cs index 06daf6d1f1a2..29cca982541a 100644 --- a/src/Files.Uwp/Constants.cs +++ b/src/Files.Uwp/Constants.cs @@ -1,4 +1,4 @@ -namespace Files.Uwp +namespace Files.Uwp { public static class Constants { diff --git a/src/Files.Uwp/Controllers/IJson.cs b/src/Files.Uwp/Controllers/IJson.cs index e3fc89f3873a..c21dea6e6fb8 100644 --- a/src/Files.Uwp/Controllers/IJson.cs +++ b/src/Files.Uwp/Controllers/IJson.cs @@ -1,4 +1,4 @@ -namespace Files.Uwp.Controllers +namespace Files.Uwp.Controllers { internal interface IJson { diff --git a/src/Files.Uwp/Controllers/SidebarPinnedController.cs b/src/Files.Uwp/Controllers/SidebarPinnedController.cs index 17c0a0ece4a4..07c1e84d2f88 100644 --- a/src/Files.Uwp/Controllers/SidebarPinnedController.cs +++ b/src/Files.Uwp/Controllers/SidebarPinnedController.cs @@ -1,4 +1,4 @@ -using Files.Uwp.DataModels; +using Files.Uwp.DataModels; using Files.Shared.Enums; using Files.Uwp.Filesystem; using Newtonsoft.Json; diff --git a/src/Files.Uwp/Controllers/TerminalController.cs b/src/Files.Uwp/Controllers/TerminalController.cs index 6f50817e222d..4c0f46e0aea9 100644 --- a/src/Files.Uwp/Controllers/TerminalController.cs +++ b/src/Files.Uwp/Controllers/TerminalController.cs @@ -1,4 +1,4 @@ -using Files.Uwp.DataModels; +using Files.Uwp.DataModels; using Files.Uwp.Filesystem; using Files.Uwp.Helpers; using Files.Shared.Enums; diff --git a/src/Files.Uwp/Converters/BoolToSelectionMode.cs b/src/Files.Uwp/Converters/BoolToSelectionMode.cs index 99cb743f329c..092d88e79b6b 100644 --- a/src/Files.Uwp/Converters/BoolToSelectionMode.cs +++ b/src/Files.Uwp/Converters/BoolToSelectionMode.cs @@ -1,6 +1,6 @@ -using System; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Data; +using System; +using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Data; namespace Files.Uwp.Converters { diff --git a/src/Files.Uwp/Converters/Converters.cs b/src/Files.Uwp/Converters/Converters.cs index 463bed7e1447..e3a52cb9050b 100644 --- a/src/Files.Uwp/Converters/Converters.cs +++ b/src/Files.Uwp/Converters/Converters.cs @@ -1,6 +1,6 @@ -using System; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Data; +using System; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Data; #nullable enable diff --git a/src/Files.Uwp/Converters/DateTimeOffsetToString.cs b/src/Files.Uwp/Converters/DateTimeOffsetToString.cs index 8a26450b46fe..fb920d600ebf 100644 --- a/src/Files.Uwp/Converters/DateTimeOffsetToString.cs +++ b/src/Files.Uwp/Converters/DateTimeOffsetToString.cs @@ -1,7 +1,7 @@ -using CommunityToolkit.Mvvm.DependencyInjection; +using CommunityToolkit.Mvvm.DependencyInjection; using Files.Shared.Services.DateTimeFormatter; using System; -using Windows.UI.Xaml.Data; +using Microsoft.UI.Xaml.Data; namespace Files.Uwp.Converters { diff --git a/src/Files.Uwp/Converters/DoubleArrayToString.cs b/src/Files.Uwp/Converters/DoubleArrayToString.cs index 3d61ac9e887d..a4082df60613 100644 --- a/src/Files.Uwp/Converters/DoubleArrayToString.cs +++ b/src/Files.Uwp/Converters/DoubleArrayToString.cs @@ -1,5 +1,5 @@ -using System; -using Windows.UI.Xaml.Data; +using System; +using Microsoft.UI.Xaml.Data; namespace Files.Uwp.Converters { diff --git a/src/Files.Uwp/Converters/DoubleToString.cs b/src/Files.Uwp/Converters/DoubleToString.cs index 166445cce677..0aca8f38acf2 100644 --- a/src/Files.Uwp/Converters/DoubleToString.cs +++ b/src/Files.Uwp/Converters/DoubleToString.cs @@ -1,5 +1,5 @@ -using System; -using Windows.UI.Xaml.Data; +using System; +using Microsoft.UI.Xaml.Data; namespace Files.Uwp.Converters { diff --git a/src/Files.Uwp/Converters/IntToGroupOption.cs b/src/Files.Uwp/Converters/IntToGroupOption.cs index 88d3da790756..784c057c5901 100644 --- a/src/Files.Uwp/Converters/IntToGroupOption.cs +++ b/src/Files.Uwp/Converters/IntToGroupOption.cs @@ -1,6 +1,6 @@ -using Files.Shared.Enums; +using Files.Shared.Enums; using System; -using Windows.UI.Xaml.Data; +using Microsoft.UI.Xaml.Data; namespace Files.Uwp.Converters { diff --git a/src/Files.Uwp/Converters/IntToSortDirection.cs b/src/Files.Uwp/Converters/IntToSortDirection.cs index 6b1923341781..ed36829fc3db 100644 --- a/src/Files.Uwp/Converters/IntToSortDirection.cs +++ b/src/Files.Uwp/Converters/IntToSortDirection.cs @@ -1,6 +1,6 @@ -using Microsoft.Toolkit.Uwp.UI; +using Microsoft.Toolkit.Uwp.UI; using System; -using Windows.UI.Xaml.Data; +using Microsoft.UI.Xaml.Data; namespace Files.Uwp.Converters { diff --git a/src/Files.Uwp/Converters/IntToSortOption.cs b/src/Files.Uwp/Converters/IntToSortOption.cs index 3aa9d21b8088..bcdaa153f61b 100644 --- a/src/Files.Uwp/Converters/IntToSortOption.cs +++ b/src/Files.Uwp/Converters/IntToSortOption.cs @@ -1,6 +1,6 @@ -using Files.Shared.Enums; +using Files.Shared.Enums; using System; -using Windows.UI.Xaml.Data; +using Microsoft.UI.Xaml.Data; namespace Files.Uwp.Converters { diff --git a/src/Files.Uwp/Converters/MiddleTextEllipsisConverter.cs b/src/Files.Uwp/Converters/MiddleTextEllipsisConverter.cs index 7c5d303ac629..e50ca54f5f75 100644 --- a/src/Files.Uwp/Converters/MiddleTextEllipsisConverter.cs +++ b/src/Files.Uwp/Converters/MiddleTextEllipsisConverter.cs @@ -1,5 +1,5 @@ -using System; -using Windows.UI.Xaml.Data; +using System; +using Microsoft.UI.Xaml.Data; namespace Files.Uwp.Converters { diff --git a/src/Files.Uwp/Converters/MultiBooleanConverter.cs b/src/Files.Uwp/Converters/MultiBooleanConverter.cs index 0b996cd8a390..429854c40f1c 100644 --- a/src/Files.Uwp/Converters/MultiBooleanConverter.cs +++ b/src/Files.Uwp/Converters/MultiBooleanConverter.cs @@ -1,5 +1,5 @@ -using System; -using Windows.UI.Xaml; +using System; +using Microsoft.UI.Xaml; namespace Files.Uwp.Converters { diff --git a/src/Files.Uwp/Converters/StorageDeleteOptionToBooleanConverter.cs b/src/Files.Uwp/Converters/StorageDeleteOptionToBooleanConverter.cs index f84fce9f8683..a54226f4427d 100644 --- a/src/Files.Uwp/Converters/StorageDeleteOptionToBooleanConverter.cs +++ b/src/Files.Uwp/Converters/StorageDeleteOptionToBooleanConverter.cs @@ -1,6 +1,6 @@ -using System; +using System; using Windows.Storage; -using Windows.UI.Xaml.Data; +using Microsoft.UI.Xaml.Data; namespace Files.Uwp.Converters { diff --git a/src/Files.Uwp/Converters/StringArrayToString.cs b/src/Files.Uwp/Converters/StringArrayToString.cs index 9e6537c0eb50..cdc3167bb9a1 100644 --- a/src/Files.Uwp/Converters/StringArrayToString.cs +++ b/src/Files.Uwp/Converters/StringArrayToString.cs @@ -1,5 +1,5 @@ -using System; -using Windows.UI.Xaml.Data; +using System; +using Microsoft.UI.Xaml.Data; namespace Files.Uwp.Converters { diff --git a/src/Files.Uwp/Converters/UInt32ToString.cs b/src/Files.Uwp/Converters/UInt32ToString.cs index dd8ec66e240d..ac296bfa650d 100644 --- a/src/Files.Uwp/Converters/UInt32ToString.cs +++ b/src/Files.Uwp/Converters/UInt32ToString.cs @@ -1,5 +1,5 @@ -using System; -using Windows.UI.Xaml.Data; +using System; +using Microsoft.UI.Xaml.Data; namespace Files.Uwp.Converters { diff --git a/src/Files.Uwp/Converters/VisibilityInvertConverter.cs b/src/Files.Uwp/Converters/VisibilityInvertConverter.cs index 96baabf30916..5fc1f36a6bdf 100644 --- a/src/Files.Uwp/Converters/VisibilityInvertConverter.cs +++ b/src/Files.Uwp/Converters/VisibilityInvertConverter.cs @@ -1,6 +1,6 @@ -using System; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Data; +using System; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Data; namespace Files.Uwp.Converters { diff --git a/src/Files.Uwp/Converters/WidthToRightMargin.cs b/src/Files.Uwp/Converters/WidthToRightMargin.cs index 40c3a8ceb686..c0fed1bf1b74 100644 --- a/src/Files.Uwp/Converters/WidthToRightMargin.cs +++ b/src/Files.Uwp/Converters/WidthToRightMargin.cs @@ -1,6 +1,6 @@ -using System; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Data; +using System; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Data; namespace Files.Uwp.Converters { diff --git a/src/Files.Uwp/DataModels/DefaultLanguageModel.cs b/src/Files.Uwp/DataModels/DefaultLanguageModel.cs index 7a06f44b01a9..18ae3a908d86 100644 --- a/src/Files.Uwp/DataModels/DefaultLanguageModel.cs +++ b/src/Files.Uwp/DataModels/DefaultLanguageModel.cs @@ -1,4 +1,4 @@ -using Microsoft.Toolkit.Uwp; +using Microsoft.Toolkit.Uwp; using System.Globalization; namespace Files.Uwp.DataModels diff --git a/src/Files.Uwp/DataModels/NavigationControlItems/DriveItem.cs b/src/Files.Uwp/DataModels/NavigationControlItems/DriveItem.cs index 31bb128ddd42..8732425ddbb4 100644 --- a/src/Files.Uwp/DataModels/NavigationControlItems/DriveItem.cs +++ b/src/Files.Uwp/DataModels/NavigationControlItems/DriveItem.cs @@ -1,4 +1,4 @@ -using ByteSizeLib; +using ByteSizeLib; using Files.Uwp.Extensions; using Files.Uwp.Filesystem; using Files.Uwp.Helpers; @@ -9,8 +9,8 @@ using Windows.ApplicationModel.Core; using Windows.Storage; using Windows.Storage.Streams; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Media.Imaging; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Media.Imaging; using Files.Shared.Extensions; namespace Files.Uwp.DataModels.NavigationControlItems diff --git a/src/Files.Uwp/DataModels/NavigationControlItems/FileTagItem.cs b/src/Files.Uwp/DataModels/NavigationControlItems/FileTagItem.cs index 46f277564865..f59f8ffc1ebe 100644 --- a/src/Files.Uwp/DataModels/NavigationControlItems/FileTagItem.cs +++ b/src/Files.Uwp/DataModels/NavigationControlItems/FileTagItem.cs @@ -1,4 +1,4 @@ -using Files.Backend.ViewModels.FileTags; +using Files.Backend.ViewModels.FileTags; using Files.Uwp.Filesystem; namespace Files.Uwp.DataModels.NavigationControlItems diff --git a/src/Files.Uwp/DataModels/NavigationControlItems/INavigationControlItem.cs b/src/Files.Uwp/DataModels/NavigationControlItems/INavigationControlItem.cs index 07c58c22f2ff..f68eeba916ce 100644 --- a/src/Files.Uwp/DataModels/NavigationControlItems/INavigationControlItem.cs +++ b/src/Files.Uwp/DataModels/NavigationControlItems/INavigationControlItem.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace Files.Uwp.Filesystem { diff --git a/src/Files.Uwp/DataModels/NavigationControlItems/LocationItem.cs b/src/Files.Uwp/DataModels/NavigationControlItems/LocationItem.cs index 7d165caab9db..0715f3446a0f 100644 --- a/src/Files.Uwp/DataModels/NavigationControlItems/LocationItem.cs +++ b/src/Files.Uwp/DataModels/NavigationControlItems/LocationItem.cs @@ -1,10 +1,10 @@ -using Files.Shared; +using Files.Shared; using Files.Uwp.Filesystem; using CommunityToolkit.Mvvm.ComponentModel; using Microsoft.Toolkit.Uwp; using System; -using Windows.UI.Xaml.Media; -using Windows.UI.Xaml.Media.Imaging; +using Microsoft.UI.Xaml.Media; +using Microsoft.UI.Xaml.Media.Imaging; using Files.Uwp.Helpers; namespace Files.Uwp.DataModels.NavigationControlItems diff --git a/src/Files.Uwp/DataModels/NavigationControlItems/WslDistroItem.cs b/src/Files.Uwp/DataModels/NavigationControlItems/WslDistroItem.cs index 592e066c0c4c..d0c89aec10be 100644 --- a/src/Files.Uwp/DataModels/NavigationControlItems/WslDistroItem.cs +++ b/src/Files.Uwp/DataModels/NavigationControlItems/WslDistroItem.cs @@ -1,4 +1,4 @@ -using Files.Uwp.Filesystem; +using Files.Uwp.Filesystem; using System; namespace Files.Uwp.DataModels.NavigationControlItems diff --git a/src/Files.Uwp/DataModels/SidebarPinnedModel.cs b/src/Files.Uwp/DataModels/SidebarPinnedModel.cs index 3b13f6ba1bc9..3e4187df26ad 100644 --- a/src/Files.Uwp/DataModels/SidebarPinnedModel.cs +++ b/src/Files.Uwp/DataModels/SidebarPinnedModel.cs @@ -1,4 +1,4 @@ -using CommunityToolkit.Mvvm.DependencyInjection; +using CommunityToolkit.Mvvm.DependencyInjection; using Files.Backend.Services.Settings; using Files.Uwp.Controllers; using Files.Uwp.DataModels.NavigationControlItems; diff --git a/src/Files.Uwp/DataModels/Terminal.cs b/src/Files.Uwp/DataModels/Terminal.cs index e90d5267256e..3db01e0a0f6f 100644 --- a/src/Files.Uwp/DataModels/Terminal.cs +++ b/src/Files.Uwp/DataModels/Terminal.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using Newtonsoft.Json; namespace Files.Uwp.DataModels { diff --git a/src/Files.Uwp/DataModels/TerminalFileModel.cs b/src/Files.Uwp/DataModels/TerminalFileModel.cs index 186cea5e6c90..19280f8e4759 100644 --- a/src/Files.Uwp/DataModels/TerminalFileModel.cs +++ b/src/Files.Uwp/DataModels/TerminalFileModel.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; diff --git a/src/Files.Uwp/Dialogs/AddItemDialog.xaml.cs b/src/Files.Uwp/Dialogs/AddItemDialog.xaml.cs index 91819f51fcba..8c0c1861dd09 100644 --- a/src/Files.Uwp/Dialogs/AddItemDialog.xaml.cs +++ b/src/Files.Uwp/Dialogs/AddItemDialog.xaml.cs @@ -3,10 +3,10 @@ using Files.Shared; using Files.Uwp.Extensions; using System; -using Windows.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Controls; using System.Threading.Tasks; using Files.Shared.Enums; -using Windows.UI.Xaml; +using Microsoft.UI.Xaml; // The Content Dialog item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238 @@ -25,7 +25,15 @@ public AddItemDialog() InitializeComponent(); } - public new async Task ShowAsync() => (DialogResult)await base.ShowAsync(); + public new async Task ShowAsync() => (DialogResult)await this.SetContentDialogRoot(base).ShowAsync(); + private ContentDialog SetContentDialogRoot(ContentDialog contentDialog) + { + if (Windows.Foundation.Metadata.ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 8)) + { + contentDialog.XamlRoot = this.Content.XamlRoot; + } + return contentDialog; + } private void ListView_ItemClick(object sender, ItemClickEventArgs e) { diff --git a/src/Files.Uwp/Dialogs/CredentialDialog.xaml.cs b/src/Files.Uwp/Dialogs/CredentialDialog.xaml.cs index 60e469317c4e..ac703146b125 100644 --- a/src/Files.Uwp/Dialogs/CredentialDialog.xaml.cs +++ b/src/Files.Uwp/Dialogs/CredentialDialog.xaml.cs @@ -1,10 +1,10 @@ -using Files.Backend.ViewModels.Dialogs; +using Files.Backend.ViewModels.Dialogs; using Files.Backend.SecureStore; using Files.Shared.Enums; using System; using System.Text; using System.Threading.Tasks; -using Windows.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Controls; // The Content Dialog item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238 @@ -23,7 +23,15 @@ public CredentialDialog() this.InitializeComponent(); } - public new async Task ShowAsync() => (DialogResult)await base.ShowAsync(); + public new async Task ShowAsync() => (DialogResult)await this.SetContentDialogRoot(base).ShowAsync(); + private ContentDialog SetContentDialogRoot(ContentDialog contentDialog) + { + if (Windows.Foundation.Metadata.ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 8)) + { + contentDialog.XamlRoot = this.Content.XamlRoot; + } + return contentDialog; + } private void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args) { diff --git a/src/Files.Uwp/Dialogs/DecompressArchiveDialog.xaml.cs b/src/Files.Uwp/Dialogs/DecompressArchiveDialog.xaml.cs index a8fbff3d4533..be748dd8c17a 100644 --- a/src/Files.Uwp/Dialogs/DecompressArchiveDialog.xaml.cs +++ b/src/Files.Uwp/Dialogs/DecompressArchiveDialog.xaml.cs @@ -1,5 +1,5 @@ -using Files.Uwp.ViewModels.Dialogs; -using Windows.UI.Xaml.Controls; +using Files.Uwp.ViewModels.Dialogs; +using Microsoft.UI.Xaml.Controls; // The Content Dialog item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238 diff --git a/src/Files.Uwp/Dialogs/DynamicDialog.xaml.cs b/src/Files.Uwp/Dialogs/DynamicDialog.xaml.cs index c72c1a796bb5..78b900cf8db3 100644 --- a/src/Files.Uwp/Dialogs/DynamicDialog.xaml.cs +++ b/src/Files.Uwp/Dialogs/DynamicDialog.xaml.cs @@ -1,7 +1,7 @@ -using Files.Shared.Enums; +using Files.Shared.Enums; using Files.Uwp.ViewModels.Dialogs; using System; -using Windows.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Controls; // The Content Dialog item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238 @@ -53,7 +53,7 @@ private void ContentDialog_CloseButtonClick(ContentDialog sender, ContentDialogB ViewModel.CloseButtonCommand.Execute(args); } - private void ContentDialog_KeyDown(object sender, Windows.UI.Xaml.Input.KeyRoutedEventArgs e) + private void ContentDialog_KeyDown(object sender, Microsoft.UI.Xaml.Input.KeyRoutedEventArgs e) { ViewModel.KeyDownCommand.Execute(e); } diff --git a/src/Files.Uwp/Dialogs/ElevateConfirmDialog.xaml.cs b/src/Files.Uwp/Dialogs/ElevateConfirmDialog.xaml.cs index c5b81fa3b008..50934322d9d1 100644 --- a/src/Files.Uwp/Dialogs/ElevateConfirmDialog.xaml.cs +++ b/src/Files.Uwp/Dialogs/ElevateConfirmDialog.xaml.cs @@ -1,8 +1,8 @@ -using Files.Backend.ViewModels.Dialogs; +using Files.Backend.ViewModels.Dialogs; using Files.Shared.Enums; using System; using System.Threading.Tasks; -using Windows.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Controls; // The Content Dialog item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238 @@ -21,6 +21,14 @@ public ElevateConfirmDialog() this.InitializeComponent(); } - public new async Task ShowAsync() => (DialogResult)await base.ShowAsync(); + public new async Task ShowAsync() => (DialogResult)await this.SetContentDialogRoot(base).ShowAsync(); + private ContentDialog SetContentDialogRoot(ContentDialog contentDialog) + { + if (Windows.Foundation.Metadata.ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 8)) + { + contentDialog.XamlRoot = this.Content.XamlRoot; + } + return contentDialog; + } } } \ No newline at end of file diff --git a/src/Files.Uwp/Dialogs/FilesystemOperationDialog.xaml.cs b/src/Files.Uwp/Dialogs/FilesystemOperationDialog.xaml.cs index 070347cd3c7f..da8d7a75d1a2 100644 --- a/src/Files.Uwp/Dialogs/FilesystemOperationDialog.xaml.cs +++ b/src/Files.Uwp/Dialogs/FilesystemOperationDialog.xaml.cs @@ -1,4 +1,4 @@ -using Files.Backend.ViewModels.Dialogs; +using Files.Backend.ViewModels.Dialogs; using Files.Backend.ViewModels.Dialogs.FileSystemDialog; using Files.Shared.Enums; using Microsoft.Toolkit.Uwp.UI; @@ -6,9 +6,9 @@ using System.Linq; using System.Threading.Tasks; using Windows.UI; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Media; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Media; using Files.Uwp.Helpers.XamlHelpers; using Windows.UI.Core; using Files.Uwp.Filesystem; @@ -37,10 +37,18 @@ public FilesystemOperationDialog() { this.InitializeComponent(); - Window.Current.SizeChanged += Current_SizeChanged; + App.Window.SizeChanged += Current_SizeChanged; } - public new async Task ShowAsync() => (DialogResult)await base.ShowAsync(); + public new async Task ShowAsync() => (DialogResult)await this.SetContentDialogRoot(base).ShowAsync(); + private ContentDialog SetContentDialogRoot(ContentDialog contentDialog) + { + if (Windows.Foundation.Metadata.ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 8)) + { + contentDialog.XamlRoot = this.Content.XamlRoot; + } + return contentDialog; + } private void Current_SizeChanged(object sender, WindowSizeChangedEventArgs e) { @@ -51,9 +59,9 @@ private void UpdateDialogLayout() { if (ViewModel.FileSystemDialogMode.ConflictsExist) { - if (Window.Current.Bounds.Width <= 700) + if (App.Window.Bounds.Width <= 700) { - ContainerGrid.Width = Window.Current.Bounds.Width - 50; + ContainerGrid.Width = App.Window.Bounds.Width - 50; } else { @@ -134,11 +142,11 @@ private void MenuFlyout_Opening(object sender, object e) private void RootDialog_Closing(ContentDialog sender, ContentDialogClosingEventArgs args) { - Window.Current.SizeChanged -= Current_SizeChanged; + App.Window.SizeChanged -= Current_SizeChanged; ViewModel.CancelCts(); } - private void NameStackPanel_Tapped(object sender, Windows.UI.Xaml.Input.TappedRoutedEventArgs e) + private void NameStackPanel_Tapped(object sender, Microsoft.UI.Xaml.Input.TappedRoutedEventArgs e) { if (sender is FrameworkElement element && element.DataContext is FileSystemDialogConflictItemViewModel conflictItem diff --git a/src/Files.Uwp/Dialogs/PropertiesDialog.xaml.cs b/src/Files.Uwp/Dialogs/PropertiesDialog.xaml.cs index fee0cbb776e9..9cde1bb05381 100644 --- a/src/Files.Uwp/Dialogs/PropertiesDialog.xaml.cs +++ b/src/Files.Uwp/Dialogs/PropertiesDialog.xaml.cs @@ -1,5 +1,5 @@ -using Files.Uwp.ViewModels; -using Windows.UI.Xaml.Controls; +using Files.Uwp.ViewModels; +using Microsoft.UI.Xaml.Controls; // The Content Dialog item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238 diff --git a/src/Files.Uwp/Dialogs/SettingsDialog.xaml.cs b/src/Files.Uwp/Dialogs/SettingsDialog.xaml.cs index 3d4c802ce3bf..9c20c5a47c86 100644 --- a/src/Files.Uwp/Dialogs/SettingsDialog.xaml.cs +++ b/src/Files.Uwp/Dialogs/SettingsDialog.xaml.cs @@ -1,12 +1,12 @@ -using Files.Backend.ViewModels.Dialogs; +using Files.Backend.ViewModels.Dialogs; using Files.Uwp.SettingsPages; using Files.Shared.Enums; using Files.Uwp.ViewModels; using System; using System.Threading.Tasks; using Windows.UI.Core; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; namespace Files.Uwp.Dialogs { @@ -19,18 +19,26 @@ public SettingsDialogViewModel ViewModel } // for some reason the requested theme wasn't being set on the content dialog, so this is used to manually bind to the requested app theme - private FrameworkElement RootAppElement => Window.Current.Content as FrameworkElement; + private FrameworkElement RootAppElement => App.Window.Content as FrameworkElement; public SettingsDialog() { this.InitializeComponent(); SettingsPane.SelectedItem = SettingsPane.MenuItems[0]; - Window.Current.SizeChanged += Current_SizeChanged; + App.Window.SizeChanged += Current_SizeChanged; UpdateDialogLayout(); } - public new async Task ShowAsync() => (DialogResult)await base.ShowAsync(); + public new async Task ShowAsync() => (DialogResult)await this.SetContentDialogRoot(base).ShowAsync(); + private ContentDialog SetContentDialogRoot(ContentDialog contentDialog) + { + if (Windows.Foundation.Metadata.ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 8)) + { + contentDialog.XamlRoot = this.Content.XamlRoot; + } + return contentDialog; + } private void Current_SizeChanged(object sender, WindowSizeChangedEventArgs e) { @@ -39,18 +47,18 @@ private void Current_SizeChanged(object sender, WindowSizeChangedEventArgs e) private void UpdateDialogLayout() { - if (Window.Current.Bounds.Height <= 710) + if (App.Window.Bounds.Height <= 710) { - ContainerGrid.Height = Window.Current.Bounds.Height - 70; + ContainerGrid.Height = App.Window.Bounds.Height - 70; } else { ContainerGrid.Height = 640; } - if (Window.Current.Bounds.Width <= 800) + if (App.Window.Bounds.Width <= 800) { - ContainerGrid.Width = Window.Current.Bounds.Width; + ContainerGrid.Width = App.Window.Bounds.Width; } else { @@ -76,7 +84,7 @@ private void SettingsPane_SelectionChanged(Microsoft.UI.Xaml.Controls.Navigation private void ContentDialog_Closing(ContentDialog sender, ContentDialogClosingEventArgs args) { - Window.Current.SizeChanged -= Current_SizeChanged; + App.Window.SizeChanged -= Current_SizeChanged; } private void ButtonClose_Click(object sender, RoutedEventArgs e) diff --git a/src/Files.Uwp/EventArguments/Bundles/BundlesOpenPathEventArgs.cs b/src/Files.Uwp/EventArguments/Bundles/BundlesOpenPathEventArgs.cs index 007cf2fef9f2..d9d44be3388f 100644 --- a/src/Files.Uwp/EventArguments/Bundles/BundlesOpenPathEventArgs.cs +++ b/src/Files.Uwp/EventArguments/Bundles/BundlesOpenPathEventArgs.cs @@ -1,4 +1,4 @@ -using Files.Uwp.Filesystem; +using Files.Uwp.Filesystem; using System.Collections.Generic; namespace Files.Uwp.EventArguments.Bundles diff --git a/src/Files.Uwp/EventArguments/LayoutModeEventArgs.cs b/src/Files.Uwp/EventArguments/LayoutModeEventArgs.cs index ca81ec4865ce..b7833eaf39f9 100644 --- a/src/Files.Uwp/EventArguments/LayoutModeEventArgs.cs +++ b/src/Files.Uwp/EventArguments/LayoutModeEventArgs.cs @@ -1,4 +1,4 @@ -using Files.Shared.Enums; +using Files.Shared.Enums; namespace Files.Uwp.EventArguments { diff --git a/src/Files.Uwp/EventArguments/LayoutPreferenceEventArgs.cs b/src/Files.Uwp/EventArguments/LayoutPreferenceEventArgs.cs index 61406b4fde27..7f3225f19f10 100644 --- a/src/Files.Uwp/EventArguments/LayoutPreferenceEventArgs.cs +++ b/src/Files.Uwp/EventArguments/LayoutPreferenceEventArgs.cs @@ -1,4 +1,4 @@ -using Files.Uwp.Helpers.LayoutPreferences; +using Files.Uwp.Helpers.LayoutPreferences; namespace Files.Uwp.EventArguments { diff --git a/src/Files.Uwp/Extensions/EnumExtensions.cs b/src/Files.Uwp/Extensions/EnumExtensions.cs index ff179715bf11..66a8fcff9e7e 100644 --- a/src/Files.Uwp/Extensions/EnumExtensions.cs +++ b/src/Files.Uwp/Extensions/EnumExtensions.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Reflection; namespace Files.Uwp.Extensions diff --git a/src/Files.Uwp/Extensions/ImageSourceExtensions.cs b/src/Files.Uwp/Extensions/ImageSourceExtensions.cs index 33abb9b4b386..3612772c74e8 100644 --- a/src/Files.Uwp/Extensions/ImageSourceExtensions.cs +++ b/src/Files.Uwp/Extensions/ImageSourceExtensions.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; using System.Runtime.InteropServices.WindowsRuntime; using System.Threading; diff --git a/src/Files.Uwp/Extensions/KeyboardAcceleratorExtensions.cs b/src/Files.Uwp/Extensions/KeyboardAcceleratorExtensions.cs index 66e02b4ce599..ee3274ec6c4e 100644 --- a/src/Files.Uwp/Extensions/KeyboardAcceleratorExtensions.cs +++ b/src/Files.Uwp/Extensions/KeyboardAcceleratorExtensions.cs @@ -1,7 +1,7 @@ -using Windows.System; +using Windows.System; using Windows.UI.Core; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Input; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Input; namespace Files.Uwp.Extensions { @@ -9,10 +9,10 @@ public static class KeyboardAcceleratorExtensions { public static bool CheckIsPressed(this KeyboardAccelerator keyboardAccelerator) { - return Window.Current.CoreWindow.GetKeyState(keyboardAccelerator.Key).HasFlag(CoreVirtualKeyStates.Down) && // check if the main key is pressed - (!keyboardAccelerator.Modifiers.HasFlag(VirtualKeyModifiers.Menu) || Window.Current.CoreWindow.GetKeyState(VirtualKey.Menu).HasFlag(CoreVirtualKeyStates.Down)) && // check if menu (alt) key is a modifier, and if so check if it's pressed - (!keyboardAccelerator.Modifiers.HasFlag(VirtualKeyModifiers.Shift) || Window.Current.CoreWindow.GetKeyState(VirtualKey.Shift).HasFlag(CoreVirtualKeyStates.Down)) && // check if shift key is a modifier, and if so check if it's pressed - (!keyboardAccelerator.Modifiers.HasFlag(VirtualKeyModifiers.Control) || Window.Current.CoreWindow.GetKeyState(VirtualKey.Control).HasFlag(CoreVirtualKeyStates.Down)); // check if ctrl key is a modifier, and if so check if it's pressed + return App.Window.CoreWindow.GetKeyState(keyboardAccelerator.Key).HasFlag(CoreVirtualKeyStates.Down) && // check if the main key is pressed + (!keyboardAccelerator.Modifiers.HasFlag(VirtualKeyModifiers.Menu) || App.Window.CoreWindow.GetKeyState(VirtualKey.Menu).HasFlag(CoreVirtualKeyStates.Down)) && // check if menu (alt) key is a modifier, and if so check if it's pressed + (!keyboardAccelerator.Modifiers.HasFlag(VirtualKeyModifiers.Shift) || App.Window.CoreWindow.GetKeyState(VirtualKey.Shift).HasFlag(CoreVirtualKeyStates.Down)) && // check if shift key is a modifier, and if so check if it's pressed + (!keyboardAccelerator.Modifiers.HasFlag(VirtualKeyModifiers.Control) || App.Window.CoreWindow.GetKeyState(VirtualKey.Control).HasFlag(CoreVirtualKeyStates.Down)); // check if ctrl key is a modifier, and if so check if it's pressed } } } \ No newline at end of file diff --git a/src/Files.Uwp/Extensions/ShellNewEntryExtensions.cs b/src/Files.Uwp/Extensions/ShellNewEntryExtensions.cs index 67607029a35e..2625946c237e 100644 --- a/src/Files.Uwp/Extensions/ShellNewEntryExtensions.cs +++ b/src/Files.Uwp/Extensions/ShellNewEntryExtensions.cs @@ -1,4 +1,4 @@ -using Files.Shared; +using Files.Shared; using Files.Uwp.Filesystem; using Files.Uwp.Filesystem.StorageItems; using Files.Uwp.Helpers; diff --git a/src/Files.Uwp/Extensions/StringExtensions.cs b/src/Files.Uwp/Extensions/StringExtensions.cs index 4077e78c56fd..bc6cc9261adb 100644 --- a/src/Files.Uwp/Extensions/StringExtensions.cs +++ b/src/Files.Uwp/Extensions/StringExtensions.cs @@ -1,4 +1,4 @@ -using ByteSizeLib; +using ByteSizeLib; using Files.Shared.Extensions; using Microsoft.Toolkit.Uwp; using System; diff --git a/src/Files.Uwp/Files.Uwp.csproj b/src/Files.Uwp/Files.Uwp.csproj index bb101b021b7a..152eac95d7c3 100644 --- a/src/Files.Uwp/Files.Uwp.csproj +++ b/src/Files.Uwp/Files.Uwp.csproj @@ -1,25 +1,13 @@ - - - + - Debug + net6.0-windows10.0.19041.0 x86 - {64C30C4E-A69A-411C-9F78-776E7AAD583C} - AppContainerExe - Properties - Files.Uwp + WinExe Files en-US Scale|DXFeatureLevel Language=en-US;af;ar;bg;ca;cs-CZ;da;da-DK;de-DE;el;en-GB;es-ES;es-419;fil-PH;fr-FR;he-IL;hi-IN;hu-HU;id-ID;it-IT;ja-JP;ka;ko-KR;lv-LV;nb-NO;nl-NL;or-IN;pl-PL;pt-BR;pt-PT;ru-RU;sk-SK;sv-SE;ta;th-TH;tr-TR;uk-UA;vi;zh-Hans;zh-Hant - UAP - 10.0.22000.0 10.0.17763.0 - 17 - 512 - {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - true - false False SHA256 False @@ -31,30 +19,25 @@ Resources\MiddleClickScrolling-CursorType.res 9.0 Enable - PackageReference + true + app.manifest + true + x86;x64;arm64 + win10-$(Platform).pubxml + win10-x86;win10-x64;win10-arm64 - true TRACE;DEBUG;NETFX_CORE;WINDOWS_UWP;DISABLE_XAML_GENERATED_MAIN ;2008 - full - x86 false - prompt - true true false true TRACE;NETFX_CORE;WINDOWS_UWP;DISABLE_XAML_GENERATED_MAIN - true ;2008 - pdbonly - x86 false - prompt - true true true @@ -62,36 +45,24 @@ TRACE;NETFX_CORE;WINDOWS_UWP;DISABLE_XAML_GENERATED_MAIN;SIDELOAD true ;2008 - pdbonly - x86 false - prompt - true true true - true TRACE;DEBUG;NETFX_CORE;WINDOWS_UWP;DISABLE_XAML_GENERATED_MAIN ;2008 - full arm64 false - prompt - false false true true TRACE;NETFX_CORE;WINDOWS_UWP;DISABLE_XAML_GENERATED_MAIN - true ;2008 - pdbonly arm64 false - prompt - false true true @@ -99,36 +70,23 @@ TRACE;NETFX_CORE;WINDOWS_UWP;DISABLE_XAML_GENERATED_MAIN;SIDELOAD true ;2008 - pdbonly arm64 false - prompt - false true true - true TRACE;DEBUG;NETFX_CORE;WINDOWS_UWP;DISABLE_XAML_GENERATED_MAIN ;2008 - full - x64 false - prompt - false false true true TRACE;NETFX_CORE;WINDOWS_UWP;DISABLE_XAML_GENERATED_MAIN - true ;2008 - pdbonly - x64 false - prompt - false true true @@ -136,960 +94,18 @@ TRACE;NETFX_CORE;WINDOWS_UWP;DISABLE_XAML_GENERATED_MAIN;SIDELOAD true ;2008 - pdbonly - x64 false - prompt - false true true - - App.xaml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - DecompressArchiveDialog.xaml - - - DynamicDialog.xaml - - - ElevateConfirmDialog.xaml - - - FilesystemOperationDialog.xaml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ColoredIcon.xaml - - - DataGridHeader.xaml - - - CodePreview.xaml - - - FolderEmptyIndicator.xaml - - - - InnerNavigationToolbar.xaml - - - FileTagsContextMenu.xaml - - - - PaneControl.xaml - - - PathBreadcrumb.xaml - - - RestartControl.xaml - - - - - - - - - - - - - - - - - - - - - - - - - - BasicPreview.xaml - - - FolderPreview.xaml - - - HtmlPreview.xaml - - - MarkdownPreview.xaml - - - MediaPreview.xaml - - - PDFPreview.xaml - - - RichTextPreview.xaml - - - TextPreview.xaml - - - TabItemControl.xaml - - - SearchBox.xaml - - - - - - - SettingsBlockControl.xaml - - - SettingsDisplayControl.xaml - - - ThemeSampleDisplayControl.xaml - - - StringEncodedImage.xaml - - - BundlesWidget.xaml - - - - WidgetsListControl.xaml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - PreviewPane.xaml - - - ImagePreview.xaml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - FileIcon.xaml - - - MenuFlyoutItemWithImage.xaml - - - AddressToolbar.xaml - - - - HorizontalMultitaskingControl.xaml - - - - - - AddItemDialog.xaml - - - PropertiesDialog.xaml - - - - - - - - - SidebarControl.xaml - - - StatusBarControl.xaml - - - OngoingTasksFlyout.xaml - - - - VerticalTabViewControl.xaml - - - DrivesWidget.xaml - - - FolderWidget.xaml - - - RecentFilesWidget.xaml - - - - - - - - - - - - - - - - - - - - - - - - - - ColumnShellPage.xaml - - - CustomFolderIcons.xaml - - - ColumnViewBase.xaml - - - ColumnViewBrowser.xaml - - - PropertiesCompatibility.xaml - - - PropertiesCustomization.xaml - - - DetailsLayoutBrowser.xaml - - - PropertiesLibrary.xaml - - - PropertiesSecurity.xaml - - - PropertiesSecurityAdvanced.xaml - - - PaneHolderPage.xaml - - - - - - - GridViewBrowser.xaml - - - PropertiesDetails.xaml - - - MainPage.xaml - - - ModernShellPage.xaml - - - Properties.xaml - - - - PropertiesGeneral.xaml - - - PropertiesShortcut.xaml - - - SettingsDialog.xaml - - - CredentialDialog.xaml - - - About.xaml - - - Appearance.xaml - - - Experimental.xaml - - - Multitasking.xaml - - - Preferences.xaml - - - - WidgetsPage.xaml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - PreserveNewest - - - PreserveNewest - - - - - PreserveNewest - - + PreserveNewest - - - - - - - - - - - - - - - - - - + PreserveNewest - + PreserveNewest @@ -1135,412 +151,7 @@ Designer - - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - MSBuild:Compile - Designer - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - MSBuild:Compile - Designer - - - Designer - MSBuild:Compile - - - MSBuild:Compile - Designer - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - MSBuild:Compile - Designer - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - MSBuild:Compile - Designer - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - MSBuild:Compile - Designer - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - Designer - MSBuild:Compile - - - MSBuild:Compile - Designer - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - MSBuild:Compile - Designer - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - + @@ -1555,42 +166,12 @@ 2.5.2 - - 4.5.3 - - - 4.5.3 - 6.0.8 6.0.0 - - 6.2.14 - - - 7.1.2 - - - 7.1.2 - - - 7.1.2 - - - 7.1.2 - - - 7.1.2 - - - 7.1.2 - - - 2.8.0 - 2.0.1 @@ -1603,6 +184,14 @@ 2.1.0 + + + + all + + + + @@ -1610,48 +199,25 @@ - - {93b7a21c-a6ca-4a21-a69c-b5bd26bddb79} - Files.Sdk.Storage - - - {dedfb63c-7a8d-4e1f-a143-7b61cac1f2a7} - Files.Uwp.Storage - - - {3d19293f-0e3a-4946-ade3-680a1e9123ec} - BackgroundTasks - - - {0533133f-2559-4b53-a0fd-0970bc0e312e} - Files.Shared - - - {4cfe0bbc-8d07-49a0-8b10-4edd61abcf57} - Files.Backend - + + + + + - + Windows Desktop Extensions for the UWP - - 17.0 - bin\x86\Sideload\ TRACE;NETFX_CORE;WINDOWS_UWP;DISABLE_XAML_GENERATED_MAIN;SIDELOAD;CODE_ANALYSIS true true ;2008 - true - pdbonly - x86 false 9.0 - prompt - true bin\arm64\Sideload\ @@ -1659,12 +225,9 @@ true true ;2008 - true - pdbonly arm64 false 9.0 - prompt bin\x64\Sideload\ @@ -1672,37 +235,22 @@ true true ;2008 - true - pdbonly - x64 false 9.0 - prompt bin\Win32\Sideload\ ;CODE_ANALYSIS - true - AnyCPU false 9.0 - true bin\Sideload\ ;CODE_ANALYSIS - true - AnyCPU false 9.0 - true - - + + + \ No newline at end of file diff --git a/src/Files.Uwp/Filesystem/BaseStorage/BaseBasicProperties.cs b/src/Files.Uwp/Filesystem/BaseStorage/BaseBasicProperties.cs index 04ae291ec2ef..0423919f9db4 100644 --- a/src/Files.Uwp/Filesystem/BaseStorage/BaseBasicProperties.cs +++ b/src/Files.Uwp/Filesystem/BaseStorage/BaseBasicProperties.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace Files.Uwp.Filesystem.StorageItems { diff --git a/src/Files.Uwp/Filesystem/BaseStorage/BaseBasicStorageItemExtraProperties.cs b/src/Files.Uwp/Filesystem/BaseStorage/BaseBasicStorageItemExtraProperties.cs index 9d85ac91a901..65893e598656 100644 --- a/src/Files.Uwp/Filesystem/BaseStorage/BaseBasicStorageItemExtraProperties.cs +++ b/src/Files.Uwp/Filesystem/BaseStorage/BaseBasicStorageItemExtraProperties.cs @@ -1,4 +1,4 @@ -using Files.Shared.Extensions; +using Files.Shared.Extensions; using System; using System.Collections.Generic; using System.Runtime.InteropServices.WindowsRuntime; diff --git a/src/Files.Uwp/Filesystem/BaseStorage/BaseStorageFile.cs b/src/Files.Uwp/Filesystem/BaseStorage/BaseStorageFile.cs index 25d27c732757..226bf997e970 100644 --- a/src/Files.Uwp/Filesystem/BaseStorage/BaseStorageFile.cs +++ b/src/Files.Uwp/Filesystem/BaseStorage/BaseStorageFile.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Runtime.InteropServices.WindowsRuntime; using System.Text; using System.Threading.Tasks; diff --git a/src/Files.Uwp/Filesystem/BaseStorage/BaseStorageFolder.cs b/src/Files.Uwp/Filesystem/BaseStorage/BaseStorageFolder.cs index 9f0f3f02c08f..0bfc48476202 100644 --- a/src/Files.Uwp/Filesystem/BaseStorage/BaseStorageFolder.cs +++ b/src/Files.Uwp/Filesystem/BaseStorage/BaseStorageFolder.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Runtime.InteropServices.WindowsRuntime; diff --git a/src/Files.Uwp/Filesystem/BaseStorage/BaseStorageItemExtraProperties.cs b/src/Files.Uwp/Filesystem/BaseStorage/BaseStorageItemExtraProperties.cs index 9659ca7404f4..47bd0192be7b 100644 --- a/src/Files.Uwp/Filesystem/BaseStorage/BaseStorageItemExtraProperties.cs +++ b/src/Files.Uwp/Filesystem/BaseStorage/BaseStorageItemExtraProperties.cs @@ -1,4 +1,4 @@ -using Files.Shared.Extensions; +using Files.Shared.Extensions; using System; using System.Collections.Generic; using System.Runtime.InteropServices.WindowsRuntime; diff --git a/src/Files.Uwp/Filesystem/BaseStorage/IBaseStorageFile.cs b/src/Files.Uwp/Filesystem/BaseStorage/IBaseStorageFile.cs index 62a4a81f8047..9c6b6daf7c3d 100644 --- a/src/Files.Uwp/Filesystem/BaseStorage/IBaseStorageFile.cs +++ b/src/Files.Uwp/Filesystem/BaseStorage/IBaseStorageFile.cs @@ -1,4 +1,4 @@ -using Windows.Foundation; +using Windows.Foundation; using Windows.Storage; using Windows.Storage.FileProperties; diff --git a/src/Files.Uwp/Filesystem/BaseStorage/IBaseStorageFolder.cs b/src/Files.Uwp/Filesystem/BaseStorage/IBaseStorageFolder.cs index 47a2a3cdfd14..7f3014420b45 100644 --- a/src/Files.Uwp/Filesystem/BaseStorage/IBaseStorageFolder.cs +++ b/src/Files.Uwp/Filesystem/BaseStorage/IBaseStorageFolder.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.IO; using Windows.Foundation; using Windows.Storage; diff --git a/src/Files.Uwp/Filesystem/Cloud/CloudDriveSyncStatusUI.cs b/src/Files.Uwp/Filesystem/Cloud/CloudDriveSyncStatusUI.cs index 417d6519321b..5dc9f2a66bed 100644 --- a/src/Files.Uwp/Filesystem/Cloud/CloudDriveSyncStatusUI.cs +++ b/src/Files.Uwp/Filesystem/Cloud/CloudDriveSyncStatusUI.cs @@ -1,4 +1,4 @@ -using CommunityToolkit.Mvvm.ComponentModel; +using CommunityToolkit.Mvvm.ComponentModel; using Files.Shared.Cloud; using Microsoft.Toolkit.Uwp; diff --git a/src/Files.Uwp/Filesystem/Cloud/Detector/AbstractCloudDetector.cs b/src/Files.Uwp/Filesystem/Cloud/Detector/AbstractCloudDetector.cs index d562f6760802..bf477fefd2ec 100644 --- a/src/Files.Uwp/Filesystem/Cloud/Detector/AbstractCloudDetector.cs +++ b/src/Files.Uwp/Filesystem/Cloud/Detector/AbstractCloudDetector.cs @@ -1,4 +1,4 @@ -using Files.Shared.Cloud; +using Files.Shared.Cloud; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; diff --git a/src/Files.Uwp/Filesystem/Cloud/Detector/AppleCloudDetector.cs b/src/Files.Uwp/Filesystem/Cloud/Detector/AppleCloudDetector.cs index d1a5f9a1b0e0..b1ecd813f2c8 100644 --- a/src/Files.Uwp/Filesystem/Cloud/Detector/AppleCloudDetector.cs +++ b/src/Files.Uwp/Filesystem/Cloud/Detector/AppleCloudDetector.cs @@ -1,4 +1,4 @@ -using Files.Shared.Cloud; +using Files.Shared.Cloud; using System; using System.Collections.Generic; using System.IO; diff --git a/src/Files.Uwp/Filesystem/Cloud/Detector/BoxCloudDetector.cs b/src/Files.Uwp/Filesystem/Cloud/Detector/BoxCloudDetector.cs index 579a2a6a5df7..0a8784d24886 100644 --- a/src/Files.Uwp/Filesystem/Cloud/Detector/BoxCloudDetector.cs +++ b/src/Files.Uwp/Filesystem/Cloud/Detector/BoxCloudDetector.cs @@ -1,4 +1,4 @@ -using Files.Shared.Cloud; +using Files.Shared.Cloud; using System; using System.Collections.Generic; using System.IO; diff --git a/src/Files.Uwp/Filesystem/Cloud/Detector/CloudDetector.cs b/src/Files.Uwp/Filesystem/Cloud/Detector/CloudDetector.cs index 7c3948b62200..730c84444a1e 100644 --- a/src/Files.Uwp/Filesystem/Cloud/Detector/CloudDetector.cs +++ b/src/Files.Uwp/Filesystem/Cloud/Detector/CloudDetector.cs @@ -1,4 +1,4 @@ -using Files.Shared.Cloud; +using Files.Shared.Cloud; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; diff --git a/src/Files.Uwp/Filesystem/Cloud/Detector/DropBoxCloudDetector.cs b/src/Files.Uwp/Filesystem/Cloud/Detector/DropBoxCloudDetector.cs index 02978facd718..e12036923c91 100644 --- a/src/Files.Uwp/Filesystem/Cloud/Detector/DropBoxCloudDetector.cs +++ b/src/Files.Uwp/Filesystem/Cloud/Detector/DropBoxCloudDetector.cs @@ -1,4 +1,4 @@ -using Files.Shared.Cloud; +using Files.Shared.Cloud; using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; diff --git a/src/Files.Uwp/Filesystem/Cloud/Detector/GenericCloudDetector.cs b/src/Files.Uwp/Filesystem/Cloud/Detector/GenericCloudDetector.cs index b04eef17825c..4dcbea9028ed 100644 --- a/src/Files.Uwp/Filesystem/Cloud/Detector/GenericCloudDetector.cs +++ b/src/Files.Uwp/Filesystem/Cloud/Detector/GenericCloudDetector.cs @@ -1,4 +1,4 @@ -using Files.Shared.Cloud; +using Files.Shared.Cloud; using Files.Uwp.Helpers; using Newtonsoft.Json; using System.Collections.Generic; diff --git a/src/Files.Uwp/Filesystem/Cloud/Detector/GoogleDriveCloudDetector.cs b/src/Files.Uwp/Filesystem/Cloud/Detector/GoogleDriveCloudDetector.cs index e5eedeb90261..d778c6ba3f8e 100644 --- a/src/Files.Uwp/Filesystem/Cloud/Detector/GoogleDriveCloudDetector.cs +++ b/src/Files.Uwp/Filesystem/Cloud/Detector/GoogleDriveCloudDetector.cs @@ -1,4 +1,4 @@ -using Files.Shared.Cloud; +using Files.Shared.Cloud; using Files.Shared.Extensions; using Files.Uwp.Extensions; using Microsoft.Data.Sqlite; diff --git a/src/Files.Uwp/Filesystem/Cloud/Detector/SynologyDriveCloudDetector.cs b/src/Files.Uwp/Filesystem/Cloud/Detector/SynologyDriveCloudDetector.cs index 3d003dd11ae1..390fd8f70442 100644 --- a/src/Files.Uwp/Filesystem/Cloud/Detector/SynologyDriveCloudDetector.cs +++ b/src/Files.Uwp/Filesystem/Cloud/Detector/SynologyDriveCloudDetector.cs @@ -1,4 +1,4 @@ -using Files.Shared.Cloud; +using Files.Shared.Cloud; using Microsoft.Data.Sqlite; using System; using System.Collections.Generic; diff --git a/src/Files.Uwp/Filesystem/FileTagsHelper.cs b/src/Files.Uwp/Filesystem/FileTagsHelper.cs index f3b6d7adc6ae..76e06225022f 100644 --- a/src/Files.Uwp/Filesystem/FileTagsHelper.cs +++ b/src/Files.Uwp/Filesystem/FileTagsHelper.cs @@ -1,4 +1,4 @@ -using Common; +using Common; using Files.Uwp.Filesystem.StorageItems; using Files.Uwp.Helpers; using System; diff --git a/src/Files.Uwp/Filesystem/FileTagsManager.cs b/src/Files.Uwp/Filesystem/FileTagsManager.cs index 6b4ecb7668b7..4d23e162fab8 100644 --- a/src/Files.Uwp/Filesystem/FileTagsManager.cs +++ b/src/Files.Uwp/Filesystem/FileTagsManager.cs @@ -1,4 +1,4 @@ -using CommunityToolkit.Mvvm.DependencyInjection; +using CommunityToolkit.Mvvm.DependencyInjection; using Files.Backend.Services.Settings; using Files.Shared; using Files.Uwp.DataModels.NavigationControlItems; diff --git a/src/Files.Uwp/Filesystem/FilesystemOperations/FilesystemItemType.cs b/src/Files.Uwp/Filesystem/FilesystemOperations/FilesystemItemType.cs index 107d4c79c7b2..02ac7fea8343 100644 --- a/src/Files.Uwp/Filesystem/FilesystemOperations/FilesystemItemType.cs +++ b/src/Files.Uwp/Filesystem/FilesystemOperations/FilesystemItemType.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace Files.Uwp.Filesystem { diff --git a/src/Files.Uwp/Filesystem/FilesystemOperations/FilesystemOperations.cs b/src/Files.Uwp/Filesystem/FilesystemOperations/FilesystemOperations.cs index d59b67afd6ab..468f9bf67660 100644 --- a/src/Files.Uwp/Filesystem/FilesystemOperations/FilesystemOperations.cs +++ b/src/Files.Uwp/Filesystem/FilesystemOperations/FilesystemOperations.cs @@ -1,4 +1,4 @@ -using Files.Shared; +using Files.Shared; using Files.Shared.Enums; using Files.Shared.Extensions; using Files.Uwp.Extensions; @@ -14,7 +14,7 @@ using System.Threading; using System.Threading.Tasks; using Windows.Storage; -using Windows.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Controls; using FileAttributes = System.IO.FileAttributes; using CommunityToolkit.Mvvm.DependencyInjection; using Files.Backend.Services; @@ -178,7 +178,7 @@ await DialogDisplayHelper.ShowDialogAsync( CloseButtonText = "Cancel".GetLocalized() }; - ContentDialogResult result = await dialog.ShowAsync(); + ContentDialogResult result = await this.SetContentDialogRoot(dialog).ShowAsync(); if (result == ContentDialogResult.Primary) { @@ -306,6 +306,14 @@ await DialogDisplayHelper.ShowDialogAsync( return new StorageHistory(FileOperationType.Copy, source, pathWithType); } + private ContentDialog SetContentDialogRoot(ContentDialog contentDialog) + { + if (Windows.Foundation.Metadata.ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 8)) + { + contentDialog.XamlRoot = this.Content.XamlRoot; + } + return contentDialog; + } public async Task MoveAsync(IStorageItem source, string destination, @@ -374,7 +382,7 @@ await DialogDisplayHelper.ShowDialogAsync( CloseButtonText = "Cancel".GetLocalized() }; - ContentDialogResult result = await dialog.ShowAsync(); + ContentDialogResult result = await this.SetContentDialogRoot(dialog).ShowAsync(); if (result == ContentDialogResult.Primary) { diff --git a/src/Files.Uwp/Filesystem/FilesystemOperations/Helpers/FilesystemHelpers.cs b/src/Files.Uwp/Filesystem/FilesystemOperations/Helpers/FilesystemHelpers.cs index 4007561ff991..052d9b556c93 100644 --- a/src/Files.Uwp/Filesystem/FilesystemOperations/Helpers/FilesystemHelpers.cs +++ b/src/Files.Uwp/Filesystem/FilesystemOperations/Helpers/FilesystemHelpers.cs @@ -1,4 +1,4 @@ -using CommunityToolkit.Mvvm.DependencyInjection; +using CommunityToolkit.Mvvm.DependencyInjection; using Files.Backend.Services; using Files.Backend.Services.Settings; using Files.Backend.ViewModels.Dialogs.FileSystemDialog; diff --git a/src/Files.Uwp/Filesystem/FilesystemOperations/Helpers/IFilesystemHelpers.cs b/src/Files.Uwp/Filesystem/FilesystemOperations/Helpers/IFilesystemHelpers.cs index ec82ad3fa108..d95b93d58556 100644 --- a/src/Files.Uwp/Filesystem/FilesystemOperations/Helpers/IFilesystemHelpers.cs +++ b/src/Files.Uwp/Filesystem/FilesystemOperations/Helpers/IFilesystemHelpers.cs @@ -1,4 +1,4 @@ -using Files.Shared.Enums; +using Files.Shared.Enums; using Files.Uwp.Filesystem.FilesystemHistory; using System; using System.Collections.Generic; diff --git a/src/Files.Uwp/Filesystem/FilesystemOperations/IFilesystemOperations.cs b/src/Files.Uwp/Filesystem/FilesystemOperations/IFilesystemOperations.cs index a1a0132f0c0e..7a81459324a8 100644 --- a/src/Files.Uwp/Filesystem/FilesystemOperations/IFilesystemOperations.cs +++ b/src/Files.Uwp/Filesystem/FilesystemOperations/IFilesystemOperations.cs @@ -1,4 +1,4 @@ -using Files.Shared.Enums; +using Files.Shared.Enums; using Files.Uwp.Filesystem.FilesystemHistory; using System; using System.Collections.Generic; diff --git a/src/Files.Uwp/Filesystem/FilesystemOperations/ShellFilesystemOperations.cs b/src/Files.Uwp/Filesystem/FilesystemOperations/ShellFilesystemOperations.cs index c4d511bc2e53..dd4ef742cebe 100644 --- a/src/Files.Uwp/Filesystem/FilesystemOperations/ShellFilesystemOperations.cs +++ b/src/Files.Uwp/Filesystem/FilesystemOperations/ShellFilesystemOperations.cs @@ -1,4 +1,4 @@ -using Files.Shared.Extensions; +using Files.Shared.Extensions; using Files.Shared.Enums; using Files.Uwp.Extensions; using Files.Uwp.Filesystem.FilesystemHistory; diff --git a/src/Files.Uwp/Filesystem/FolderHelpers.cs b/src/Files.Uwp/Filesystem/FolderHelpers.cs index 2f1e5e4f03ce..93e0d59cf69c 100644 --- a/src/Files.Uwp/Filesystem/FolderHelpers.cs +++ b/src/Files.Uwp/Filesystem/FolderHelpers.cs @@ -1,4 +1,4 @@ -using Files.Uwp.Filesystem.StorageItems; +using Files.Uwp.Filesystem.StorageItems; using System; using System.Collections.Generic; using System.IO; diff --git a/src/Files.Uwp/Filesystem/FtpManager.cs b/src/Files.Uwp/Filesystem/FtpManager.cs index 1cea89104c41..2f8d5d42927b 100644 --- a/src/Files.Uwp/Filesystem/FtpManager.cs +++ b/src/Files.Uwp/Filesystem/FtpManager.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Net; namespace Files.Uwp.Filesystem diff --git a/src/Files.Uwp/Filesystem/LibraryLocationItem.cs b/src/Files.Uwp/Filesystem/LibraryLocationItem.cs index d55a27f87aa5..3b2942816a0e 100644 --- a/src/Files.Uwp/Filesystem/LibraryLocationItem.cs +++ b/src/Files.Uwp/Filesystem/LibraryLocationItem.cs @@ -1,4 +1,4 @@ -using Files.Shared; +using Files.Shared; using Files.Uwp.DataModels.NavigationControlItems; using Files.Uwp.Helpers; using System.Collections.ObjectModel; diff --git a/src/Files.Uwp/Filesystem/LibraryManager.cs b/src/Files.Uwp/Filesystem/LibraryManager.cs index f6333407d4d2..e9ebd2001676 100644 --- a/src/Files.Uwp/Filesystem/LibraryManager.cs +++ b/src/Files.Uwp/Filesystem/LibraryManager.cs @@ -1,4 +1,4 @@ -using Files.Shared; +using Files.Shared; using Files.Uwp.Helpers; using Microsoft.Toolkit.Uwp; using System; diff --git a/src/Files.Uwp/Filesystem/ListedItem.cs b/src/Files.Uwp/Filesystem/ListedItem.cs index 2462c60a0cc8..08e7eb288a0a 100644 --- a/src/Files.Uwp/Filesystem/ListedItem.cs +++ b/src/Files.Uwp/Filesystem/ListedItem.cs @@ -1,4 +1,4 @@ -using CommunityToolkit.Mvvm.ComponentModel; +using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.DependencyInjection; using Files.Backend.Services.Settings; using Files.Backend.ViewModels.FileTags; @@ -19,7 +19,7 @@ using System.Threading; using System.Threading.Tasks; using Windows.Storage; -using Windows.UI.Xaml.Media.Imaging; +using Microsoft.UI.Xaml.Media.Imaging; #pragma warning disable CS0618 // Type or member is obsolete @@ -203,7 +203,7 @@ public BitmapImage FileImage } } - private void Img_ImageOpened(object sender, Windows.UI.Xaml.RoutedEventArgs e) + private void Img_ImageOpened(object sender, Microsoft.UI.Xaml.RoutedEventArgs e) { if (sender is BitmapImage image) { diff --git a/src/Files.Uwp/Filesystem/NetworkDrivesManager.cs b/src/Files.Uwp/Filesystem/NetworkDrivesManager.cs index 749b84d14412..d2ac5137c5d3 100644 --- a/src/Files.Uwp/Filesystem/NetworkDrivesManager.cs +++ b/src/Files.Uwp/Filesystem/NetworkDrivesManager.cs @@ -1,4 +1,4 @@ -using Files.Shared; +using Files.Shared; using Files.Uwp.DataModels.NavigationControlItems; using Files.Uwp.Helpers; using Microsoft.Toolkit.Uwp; diff --git a/src/Files.Uwp/Filesystem/Permissions/FilePermissionsManager.cs b/src/Files.Uwp/Filesystem/Permissions/FilePermissionsManager.cs index 9e4a128aec8b..2fa337581b22 100644 --- a/src/Files.Uwp/Filesystem/Permissions/FilePermissionsManager.cs +++ b/src/Files.Uwp/Filesystem/Permissions/FilePermissionsManager.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; diff --git a/src/Files.Uwp/Filesystem/Permissions/FileSystemAccessRule.cs b/src/Files.Uwp/Filesystem/Permissions/FileSystemAccessRule.cs index 7e1860d51298..22f0a49a9f7d 100644 --- a/src/Files.Uwp/Filesystem/Permissions/FileSystemAccessRule.cs +++ b/src/Files.Uwp/Filesystem/Permissions/FileSystemAccessRule.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; namespace Files.Uwp.Filesystem.Permissions diff --git a/src/Files.Uwp/Filesystem/Permissions/FileSystemAccessRuleForUI.cs b/src/Files.Uwp/Filesystem/Permissions/FileSystemAccessRuleForUI.cs index 81ac543af641..a151f2a80f50 100644 --- a/src/Files.Uwp/Filesystem/Permissions/FileSystemAccessRuleForUI.cs +++ b/src/Files.Uwp/Filesystem/Permissions/FileSystemAccessRuleForUI.cs @@ -1,4 +1,4 @@ -using CommunityToolkit.Mvvm.ComponentModel; +using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.Input; using Microsoft.Toolkit.Uwp; using System; diff --git a/src/Files.Uwp/Filesystem/Permissions/RulesForUser.cs b/src/Files.Uwp/Filesystem/Permissions/RulesForUser.cs index 110c99640661..c3b16dc9fa2d 100644 --- a/src/Files.Uwp/Filesystem/Permissions/RulesForUser.cs +++ b/src/Files.Uwp/Filesystem/Permissions/RulesForUser.cs @@ -1,4 +1,4 @@ -using CommunityToolkit.Mvvm.ComponentModel; +using CommunityToolkit.Mvvm.ComponentModel; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; diff --git a/src/Files.Uwp/Filesystem/Permissions/UserGroup.cs b/src/Files.Uwp/Filesystem/Permissions/UserGroup.cs index 61320171688b..56fbef9cfff2 100644 --- a/src/Files.Uwp/Filesystem/Permissions/UserGroup.cs +++ b/src/Files.Uwp/Filesystem/Permissions/UserGroup.cs @@ -1,4 +1,4 @@ -using CommunityToolkit.Mvvm.ComponentModel; +using CommunityToolkit.Mvvm.ComponentModel; using Microsoft.Toolkit.Uwp; using System; using System.Collections.Generic; diff --git a/src/Files.Uwp/Filesystem/RecentItem.cs b/src/Files.Uwp/Filesystem/RecentItem.cs index 4e833bf02117..2f7362964ae2 100644 --- a/src/Files.Uwp/Filesystem/RecentItem.cs +++ b/src/Files.Uwp/Filesystem/RecentItem.cs @@ -1,4 +1,4 @@ -using CommunityToolkit.Mvvm.ComponentModel; +using CommunityToolkit.Mvvm.ComponentModel; using Files.Shared; using Files.Uwp.Helpers; using System; @@ -6,7 +6,7 @@ using System.Threading.Tasks; using Windows.Storage; using Windows.Storage.FileProperties; -using Windows.UI.Xaml.Media.Imaging; +using Microsoft.UI.Xaml.Media.Imaging; namespace Files.Uwp.Filesystem { diff --git a/src/Files.Uwp/Filesystem/RecentItemsManager.cs b/src/Files.Uwp/Filesystem/RecentItemsManager.cs index c7b9debce045..dba09b0483a3 100644 --- a/src/Files.Uwp/Filesystem/RecentItemsManager.cs +++ b/src/Files.Uwp/Filesystem/RecentItemsManager.cs @@ -1,4 +1,4 @@ -using CommunityToolkit.Mvvm.DependencyInjection; +using CommunityToolkit.Mvvm.DependencyInjection; using Files.Shared; using Files.Shared.Enums; using Files.Uwp.Helpers; @@ -12,7 +12,7 @@ using System.Threading.Tasks; using Windows.ApplicationModel.AppService; using Windows.Foundation.Collections; -using Windows.UI.Xaml.Media.Imaging; +using Microsoft.UI.Xaml.Media.Imaging; namespace Files.Uwp.Filesystem { diff --git a/src/Files.Uwp/Filesystem/Search/FolderSearch.cs b/src/Files.Uwp/Filesystem/Search/FolderSearch.cs index 72d4d3df50f2..d8fc28c500b4 100644 --- a/src/Files.Uwp/Filesystem/Search/FolderSearch.cs +++ b/src/Files.Uwp/Filesystem/Search/FolderSearch.cs @@ -1,4 +1,4 @@ -using CommunityToolkit.Mvvm.DependencyInjection; +using CommunityToolkit.Mvvm.DependencyInjection; using Files.Backend.Services.Settings; using Files.Shared.Extensions; using Files.Uwp.Extensions; diff --git a/src/Files.Uwp/Filesystem/StorageEnumerators/UniversalStorageEnumerator.cs b/src/Files.Uwp/Filesystem/StorageEnumerators/UniversalStorageEnumerator.cs index e9ab9a65ca94..d9c14fb82ad1 100644 --- a/src/Files.Uwp/Filesystem/StorageEnumerators/UniversalStorageEnumerator.cs +++ b/src/Files.Uwp/Filesystem/StorageEnumerators/UniversalStorageEnumerator.cs @@ -1,4 +1,4 @@ -using CommunityToolkit.Mvvm.DependencyInjection; +using CommunityToolkit.Mvvm.DependencyInjection; using Files.Backend.Services.Settings; using Files.Uwp.Extensions; using Files.Uwp.Filesystem.StorageItems; @@ -11,7 +11,7 @@ using System.Threading; using System.Threading.Tasks; using Windows.Storage; -using Windows.UI.Xaml.Media.Imaging; +using Microsoft.UI.Xaml.Media.Imaging; namespace Files.Uwp.Filesystem.StorageEnumerators { diff --git a/src/Files.Uwp/Filesystem/StorageEnumerators/Win32StorageEnumerator.cs b/src/Files.Uwp/Filesystem/StorageEnumerators/Win32StorageEnumerator.cs index 530413e59e5d..0904e9c8ce85 100644 --- a/src/Files.Uwp/Filesystem/StorageEnumerators/Win32StorageEnumerator.cs +++ b/src/Files.Uwp/Filesystem/StorageEnumerators/Win32StorageEnumerator.cs @@ -1,4 +1,4 @@ -using CommunityToolkit.Mvvm.DependencyInjection; +using CommunityToolkit.Mvvm.DependencyInjection; using Files.Backend.Extensions; using Files.Backend.Services.Settings; using Files.Backend.Services.SizeProvider; @@ -18,7 +18,7 @@ using Windows.ApplicationModel.AppService; using Windows.Foundation.Collections; using Windows.Storage; -using Windows.UI.Xaml.Media.Imaging; +using Microsoft.UI.Xaml.Media.Imaging; using static Files.Backend.Helpers.NativeFindStorageItemHelper; using FileAttributes = System.IO.FileAttributes; diff --git a/src/Files.Uwp/Filesystem/StorageFileHelpers/FilesystemResult.cs b/src/Files.Uwp/Filesystem/StorageFileHelpers/FilesystemResult.cs index d7b9aff2699b..2abe99529f6e 100644 --- a/src/Files.Uwp/Filesystem/StorageFileHelpers/FilesystemResult.cs +++ b/src/Files.Uwp/Filesystem/StorageFileHelpers/FilesystemResult.cs @@ -1,4 +1,4 @@ -using Files.Shared.Enums; +using Files.Shared.Enums; namespace Files.Uwp.Filesystem { diff --git a/src/Files.Uwp/Filesystem/StorageFileHelpers/FilesystemTasks.cs b/src/Files.Uwp/Filesystem/StorageFileHelpers/FilesystemTasks.cs index dc316dfc2c57..0116295566e8 100644 --- a/src/Files.Uwp/Filesystem/StorageFileHelpers/FilesystemTasks.cs +++ b/src/Files.Uwp/Filesystem/StorageFileHelpers/FilesystemTasks.cs @@ -1,4 +1,4 @@ -using Files.Shared.Enums; +using Files.Shared.Enums; using System; using System.IO; using System.Runtime.InteropServices; diff --git a/src/Files.Uwp/Filesystem/StorageFileHelpers/IStorageItemWithPath.cs b/src/Files.Uwp/Filesystem/StorageFileHelpers/IStorageItemWithPath.cs index a0e4fcc9b487..084921c20393 100644 --- a/src/Files.Uwp/Filesystem/StorageFileHelpers/IStorageItemWithPath.cs +++ b/src/Files.Uwp/Filesystem/StorageFileHelpers/IStorageItemWithPath.cs @@ -1,4 +1,4 @@ -using Windows.Storage; +using Windows.Storage; namespace Files.Uwp.Filesystem { diff --git a/src/Files.Uwp/Filesystem/StorageFileHelpers/StorageFileExtensions.cs b/src/Files.Uwp/Filesystem/StorageFileHelpers/StorageFileExtensions.cs index aa26cbadf548..16823c326eb6 100644 --- a/src/Files.Uwp/Filesystem/StorageFileHelpers/StorageFileExtensions.cs +++ b/src/Files.Uwp/Filesystem/StorageFileHelpers/StorageFileExtensions.cs @@ -1,4 +1,4 @@ -using Files.Shared.Extensions; +using Files.Shared.Extensions; using Files.Uwp.DataModels.NavigationControlItems; using Files.Uwp.Extensions; using Files.Uwp.Filesystem.StorageItems; diff --git a/src/Files.Uwp/Filesystem/StorageFileHelpers/StorageFileWithPath.cs b/src/Files.Uwp/Filesystem/StorageFileHelpers/StorageFileWithPath.cs index 59eed14f608a..d94ab20c8b88 100644 --- a/src/Files.Uwp/Filesystem/StorageFileHelpers/StorageFileWithPath.cs +++ b/src/Files.Uwp/Filesystem/StorageFileHelpers/StorageFileWithPath.cs @@ -1,4 +1,4 @@ -using Files.Uwp.Filesystem.StorageItems; +using Files.Uwp.Filesystem.StorageItems; using Windows.Storage; using IO = System.IO; diff --git a/src/Files.Uwp/Filesystem/StorageFileHelpers/StorageFolderWithPath.cs b/src/Files.Uwp/Filesystem/StorageFileHelpers/StorageFolderWithPath.cs index e6250b642982..57e6ca7a2c50 100644 --- a/src/Files.Uwp/Filesystem/StorageFileHelpers/StorageFolderWithPath.cs +++ b/src/Files.Uwp/Filesystem/StorageFileHelpers/StorageFolderWithPath.cs @@ -1,4 +1,4 @@ -using Files.Uwp.Filesystem.StorageItems; +using Files.Uwp.Filesystem.StorageItems; using Windows.Storage; using IO = System.IO; diff --git a/src/Files.Uwp/Filesystem/StorageHistory/Helpers/StorageHistoryHelpers.cs b/src/Files.Uwp/Filesystem/StorageHistory/Helpers/StorageHistoryHelpers.cs index d0d88acca2a1..d7dc6f781434 100644 --- a/src/Files.Uwp/Filesystem/StorageHistory/Helpers/StorageHistoryHelpers.cs +++ b/src/Files.Uwp/Filesystem/StorageHistory/Helpers/StorageHistoryHelpers.cs @@ -1,4 +1,4 @@ -using Files.Shared.Enums; +using Files.Shared.Enums; using System; using System.Threading; using System.Threading.Tasks; diff --git a/src/Files.Uwp/Filesystem/StorageHistory/IStorageHistory.cs b/src/Files.Uwp/Filesystem/StorageHistory/IStorageHistory.cs index f8d8ac7f008d..a133eb80a78d 100644 --- a/src/Files.Uwp/Filesystem/StorageHistory/IStorageHistory.cs +++ b/src/Files.Uwp/Filesystem/StorageHistory/IStorageHistory.cs @@ -1,4 +1,4 @@ -using Files.Shared.Enums; +using Files.Shared.Enums; using System.Collections.Generic; namespace Files.Uwp.Filesystem.FilesystemHistory diff --git a/src/Files.Uwp/Filesystem/StorageHistory/IStorageHistoryOperations.cs b/src/Files.Uwp/Filesystem/StorageHistory/IStorageHistoryOperations.cs index ddfb1bd595e6..7888a2137e05 100644 --- a/src/Files.Uwp/Filesystem/StorageHistory/IStorageHistoryOperations.cs +++ b/src/Files.Uwp/Filesystem/StorageHistory/IStorageHistoryOperations.cs @@ -1,4 +1,4 @@ -using Files.Shared.Enums; +using Files.Shared.Enums; using System; using System.Threading.Tasks; diff --git a/src/Files.Uwp/Filesystem/StorageHistory/StorageHistory.cs b/src/Files.Uwp/Filesystem/StorageHistory/StorageHistory.cs index b044fab2e3df..1dae0d823f3f 100644 --- a/src/Files.Uwp/Filesystem/StorageHistory/StorageHistory.cs +++ b/src/Files.Uwp/Filesystem/StorageHistory/StorageHistory.cs @@ -1,4 +1,4 @@ -using Files.Shared.Enums; +using Files.Shared.Enums; using Files.Shared.Extensions; using System.Collections.Generic; diff --git a/src/Files.Uwp/Filesystem/StorageHistory/StorageHistoryOperations.cs b/src/Files.Uwp/Filesystem/StorageHistory/StorageHistoryOperations.cs index 8604c15634e7..070ff3b91758 100644 --- a/src/Files.Uwp/Filesystem/StorageHistory/StorageHistoryOperations.cs +++ b/src/Files.Uwp/Filesystem/StorageHistory/StorageHistoryOperations.cs @@ -1,4 +1,4 @@ -using Files.Shared.Enums; +using Files.Shared.Enums; using Files.Uwp.Helpers; using Files.Shared.Extensions; using System; diff --git a/src/Files.Uwp/Filesystem/StorageHistory/StorageHistoryWrapper.cs b/src/Files.Uwp/Filesystem/StorageHistory/StorageHistoryWrapper.cs index 63494cd6e9e0..7f369b55ac21 100644 --- a/src/Files.Uwp/Filesystem/StorageHistory/StorageHistoryWrapper.cs +++ b/src/Files.Uwp/Filesystem/StorageHistory/StorageHistoryWrapper.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; namespace Files.Uwp.Filesystem.FilesystemHistory diff --git a/src/Files.Uwp/Filesystem/StorageItems/BaseQueryResults.cs b/src/Files.Uwp/Filesystem/StorageItems/BaseQueryResults.cs index 5f636eb920a8..24c285b7f035 100644 --- a/src/Files.Uwp/Filesystem/StorageItems/BaseQueryResults.cs +++ b/src/Files.Uwp/Filesystem/StorageItems/BaseQueryResults.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Runtime.InteropServices.WindowsRuntime; diff --git a/src/Files.Uwp/Filesystem/StorageItems/FtpStorageFile.cs b/src/Files.Uwp/Filesystem/StorageItems/FtpStorageFile.cs index 9c05cf8403c7..3f39714ce624 100644 --- a/src/Files.Uwp/Filesystem/StorageItems/FtpStorageFile.cs +++ b/src/Files.Uwp/Filesystem/StorageItems/FtpStorageFile.cs @@ -1,4 +1,4 @@ -using Files.Shared.Extensions; +using Files.Shared.Extensions; using Files.Uwp.Helpers; using FluentFTP; using Microsoft.Toolkit.Uwp; diff --git a/src/Files.Uwp/Filesystem/StorageItems/FtpStorageFolder.cs b/src/Files.Uwp/Filesystem/StorageItems/FtpStorageFolder.cs index 46a7dd5877ab..659e64f5f7a8 100644 --- a/src/Files.Uwp/Filesystem/StorageItems/FtpStorageFolder.cs +++ b/src/Files.Uwp/Filesystem/StorageItems/FtpStorageFolder.cs @@ -1,4 +1,4 @@ -using Files.Shared.Extensions; +using Files.Shared.Extensions; using Files.Uwp.Helpers; using FluentFTP; using Microsoft.Toolkit.Uwp; diff --git a/src/Files.Uwp/Filesystem/StorageItems/NativeStorageFile.cs b/src/Files.Uwp/Filesystem/StorageItems/NativeStorageFile.cs index 1ef551643d12..876733850cc8 100644 --- a/src/Files.Uwp/Filesystem/StorageItems/NativeStorageFile.cs +++ b/src/Files.Uwp/Filesystem/StorageItems/NativeStorageFile.cs @@ -1,4 +1,4 @@ -using Files.Uwp.Helpers; +using Files.Uwp.Helpers; using Microsoft.Toolkit.Uwp; using System; using System.ComponentModel; diff --git a/src/Files.Uwp/Filesystem/StorageItems/ShellStorageFile.cs b/src/Files.Uwp/Filesystem/StorageItems/ShellStorageFile.cs index 251f97908dcd..f7403eb44466 100644 --- a/src/Files.Uwp/Filesystem/StorageItems/ShellStorageFile.cs +++ b/src/Files.Uwp/Filesystem/StorageItems/ShellStorageFile.cs @@ -1,4 +1,4 @@ -using Files.Shared; +using Files.Shared; using Files.Shared.Extensions; using Files.Uwp.Helpers; using Newtonsoft.Json; diff --git a/src/Files.Uwp/Filesystem/StorageItems/ShellStorageFolder.cs b/src/Files.Uwp/Filesystem/StorageItems/ShellStorageFolder.cs index c4d1561872dc..bddf952fdd2f 100644 --- a/src/Files.Uwp/Filesystem/StorageItems/ShellStorageFolder.cs +++ b/src/Files.Uwp/Filesystem/StorageItems/ShellStorageFolder.cs @@ -1,4 +1,4 @@ -using Files.Shared; +using Files.Shared; using Files.Shared.Extensions; using Files.Uwp.Helpers; using Newtonsoft.Json; diff --git a/src/Files.Uwp/Filesystem/StorageItems/StreamWithContentType.cs b/src/Files.Uwp/Filesystem/StorageItems/StreamWithContentType.cs index 5c3a39cc637c..010db9a64036 100644 --- a/src/Files.Uwp/Filesystem/StorageItems/StreamWithContentType.cs +++ b/src/Files.Uwp/Filesystem/StorageItems/StreamWithContentType.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; using System.Runtime.InteropServices.WindowsRuntime; using System.Threading; diff --git a/src/Files.Uwp/Filesystem/StorageItems/SystemStorageFile.cs b/src/Files.Uwp/Filesystem/StorageItems/SystemStorageFile.cs index d5031df92e47..c299aa16fa08 100644 --- a/src/Files.Uwp/Filesystem/StorageItems/SystemStorageFile.cs +++ b/src/Files.Uwp/Filesystem/StorageItems/SystemStorageFile.cs @@ -1,4 +1,4 @@ -using Files.Uwp.Helpers; +using Files.Uwp.Helpers; using System; using System.Collections.Generic; using System.IO; diff --git a/src/Files.Uwp/Filesystem/StorageItems/SystemStorageFolder.cs b/src/Files.Uwp/Filesystem/StorageItems/SystemStorageFolder.cs index 9e79efedec43..1d5845d8a444 100644 --- a/src/Files.Uwp/Filesystem/StorageItems/SystemStorageFolder.cs +++ b/src/Files.Uwp/Filesystem/StorageItems/SystemStorageFolder.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Runtime.InteropServices.WindowsRuntime; diff --git a/src/Files.Uwp/Filesystem/StorageItems/VirtualStorageItem.cs b/src/Files.Uwp/Filesystem/StorageItems/VirtualStorageItem.cs index 0a6a2b9c2d5f..c1ed6f8ed574 100644 --- a/src/Files.Uwp/Filesystem/StorageItems/VirtualStorageItem.cs +++ b/src/Files.Uwp/Filesystem/StorageItems/VirtualStorageItem.cs @@ -1,4 +1,4 @@ -using Files.Uwp.Helpers; +using Files.Uwp.Helpers; using System; using System.IO; using System.Runtime.InteropServices.WindowsRuntime; diff --git a/src/Files.Uwp/Filesystem/StorageItems/ZipStorageFile.cs b/src/Files.Uwp/Filesystem/StorageItems/ZipStorageFile.cs index e995c61d084c..375d3150d9a8 100644 --- a/src/Files.Uwp/Filesystem/StorageItems/ZipStorageFile.cs +++ b/src/Files.Uwp/Filesystem/StorageItems/ZipStorageFile.cs @@ -1,4 +1,4 @@ -using Files.Uwp.Helpers; +using Files.Uwp.Helpers; using Microsoft.Toolkit.Uwp; using SevenZip; using System; diff --git a/src/Files.Uwp/Filesystem/StorageItems/ZipStorageFolder.cs b/src/Files.Uwp/Filesystem/StorageItems/ZipStorageFolder.cs index 0daa3b7d4317..2003f064b85a 100644 --- a/src/Files.Uwp/Filesystem/StorageItems/ZipStorageFolder.cs +++ b/src/Files.Uwp/Filesystem/StorageItems/ZipStorageFolder.cs @@ -1,4 +1,4 @@ -using Files.Uwp.Extensions; +using Files.Uwp.Extensions; using Files.Uwp.Helpers; using Files.Shared.Extensions; using Microsoft.Toolkit.Uwp; diff --git a/src/Files.Uwp/Filesystem/WSLDistroManager.cs b/src/Files.Uwp/Filesystem/WSLDistroManager.cs index 8a82ecb8307e..20f80b59b79f 100644 --- a/src/Files.Uwp/Filesystem/WSLDistroManager.cs +++ b/src/Files.Uwp/Filesystem/WSLDistroManager.cs @@ -1,4 +1,4 @@ -using Files.Uwp.DataModels.NavigationControlItems; +using Files.Uwp.DataModels.NavigationControlItems; using System; using System.Collections.Generic; using System.Collections.Specialized; diff --git a/src/Files.Uwp/Helpers/AdaptiveLayoutHelpers.cs b/src/Files.Uwp/Helpers/AdaptiveLayoutHelpers.cs index 7f8cdf36ee92..d933344e76a1 100644 --- a/src/Files.Uwp/Helpers/AdaptiveLayoutHelpers.cs +++ b/src/Files.Uwp/Helpers/AdaptiveLayoutHelpers.cs @@ -1,4 +1,4 @@ -using CommunityToolkit.Mvvm.DependencyInjection; +using CommunityToolkit.Mvvm.DependencyInjection; using Files.Backend.Services.Settings; using Files.Uwp.ViewModels; using Files.Uwp.ViewModels.Previews; diff --git a/src/Files.Uwp/Helpers/AppServiceConnectionHelper.cs b/src/Files.Uwp/Helpers/AppServiceConnectionHelper.cs index c248d5b1eb38..175bad9141dc 100644 --- a/src/Files.Uwp/Helpers/AppServiceConnectionHelper.cs +++ b/src/Files.Uwp/Helpers/AppServiceConnectionHelper.cs @@ -1,4 +1,4 @@ -using Files.Shared; +using Files.Shared; using Files.Shared.Extensions; using Newtonsoft.Json; using System; @@ -103,7 +103,9 @@ private static async Task BuildConnection(bool { // Launch fulltrust process ApplicationData.Current.LocalSettings.Values["PackageSid"] = - WebAuthenticationBroker.GetCurrentApplicationCallbackUri().Host.ToUpperInvariant(); +/* + TODO UA306_G: UWP WebAuthenticationBroker : Windows.Security.Authentication.Web.WebAuthenticationBroker is not yet supported in WindowsAppSDK. Read: https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/what-is-supported + */WebAuthenticationBroker.GetCurrentApplicationCallbackUri().Host.ToUpperInvariant(); await FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync(); } diff --git a/src/Files.Uwp/Helpers/AppUpdater.cs b/src/Files.Uwp/Helpers/AppUpdater.cs index 54f06ab2c0f8..007661aa5d18 100644 --- a/src/Files.Uwp/Helpers/AppUpdater.cs +++ b/src/Files.Uwp/Helpers/AppUpdater.cs @@ -1,10 +1,10 @@ -using Microsoft.Toolkit.Uwp; +using Microsoft.Toolkit.Uwp; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Windows.Services.Store; -using Windows.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Controls; namespace Files.Uwp.Helpers { @@ -62,7 +62,7 @@ private async Task DownloadUpdatesConsent() CloseButtonText = "Close".GetLocalized(), PrimaryButtonText = "ConsentDialogPrimaryButtonText".GetLocalized() }; - ContentDialogResult result = await dialog.ShowAsync(); + ContentDialogResult result = await this.SetContentDialogRoot(dialog).ShowAsync(); if (result == ContentDialogResult.Primary) { @@ -70,6 +70,14 @@ private async Task DownloadUpdatesConsent() } return false; } + private ContentDialog SetContentDialogRoot(ContentDialog contentDialog) + { + if (Windows.Foundation.Metadata.ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 8)) + { + contentDialog.XamlRoot = this.Content.XamlRoot; + } + return contentDialog; + } private async Task DownloadUpdates(IReadOnlyList updateList) { diff --git a/src/Files.Uwp/Helpers/AsyncManualResetEvent.cs b/src/Files.Uwp/Helpers/AsyncManualResetEvent.cs index 36a195284168..b224f7d5341f 100644 --- a/src/Files.Uwp/Helpers/AsyncManualResetEvent.cs +++ b/src/Files.Uwp/Helpers/AsyncManualResetEvent.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Threading; using System.Threading.Tasks; diff --git a/src/Files.Uwp/Helpers/BitmapHelper.cs b/src/Files.Uwp/Helpers/BitmapHelper.cs index af8cdbe1191a..bdb3254027d7 100644 --- a/src/Files.Uwp/Helpers/BitmapHelper.cs +++ b/src/Files.Uwp/Helpers/BitmapHelper.cs @@ -1,4 +1,4 @@ -using Files.Uwp.Filesystem; +using Files.Uwp.Filesystem; using Files.Uwp.Filesystem.StorageItems; using System; using System.IO; @@ -6,7 +6,7 @@ using Windows.Graphics.Imaging; using Windows.Storage; using Windows.Storage.Streams; -using Windows.UI.Xaml.Media.Imaging; +using Microsoft.UI.Xaml.Media.Imaging; namespace Files.Uwp.Helpers { diff --git a/src/Files.Uwp/Helpers/CollectionDebugView.cs b/src/Files.Uwp/Helpers/CollectionDebugView.cs index 78eb1afbe950..df22b39e23b0 100644 --- a/src/Files.Uwp/Helpers/CollectionDebugView.cs +++ b/src/Files.Uwp/Helpers/CollectionDebugView.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/src/Files.Uwp/Helpers/ColorHelpers.cs b/src/Files.Uwp/Helpers/ColorHelpers.cs index 280f75173658..a20fea49576e 100644 --- a/src/Files.Uwp/Helpers/ColorHelpers.cs +++ b/src/Files.Uwp/Helpers/ColorHelpers.cs @@ -1,4 +1,4 @@ -using System; +using System; using Windows.UI; namespace Files.Uwp.Helpers diff --git a/src/Files.Uwp/Helpers/CommonPaths.cs b/src/Files.Uwp/Helpers/CommonPaths.cs index 27d0154cfa79..7ce70ed075d7 100644 --- a/src/Files.Uwp/Helpers/CommonPaths.cs +++ b/src/Files.Uwp/Helpers/CommonPaths.cs @@ -1,4 +1,4 @@ -using Files.Shared; +using Files.Shared; using Files.Shared.Extensions; using Microsoft.Toolkit.Uwp; using System; diff --git a/src/Files.Uwp/Helpers/ContextFlyoutItemHelper.cs b/src/Files.Uwp/Helpers/ContextFlyoutItemHelper.cs index 4290f1075f97..9abd9b071c09 100644 --- a/src/Files.Uwp/Helpers/ContextFlyoutItemHelper.cs +++ b/src/Files.Uwp/Helpers/ContextFlyoutItemHelper.cs @@ -1,4 +1,4 @@ -using CommunityToolkit.Mvvm.DependencyInjection; +using CommunityToolkit.Mvvm.DependencyInjection; using CommunityToolkit.Mvvm.Input; using Files.Backend.Services.Settings; using Files.Shared; @@ -16,8 +16,8 @@ using Windows.ApplicationModel.DataTransfer; using Windows.Storage; using Windows.System; -using Windows.UI.Xaml.Input; -using Windows.UI.Xaml.Media.Imaging; +using Microsoft.UI.Xaml.Input; +using Microsoft.UI.Xaml.Media.Imaging; namespace Files.Uwp.Helpers { diff --git a/src/Files.Uwp/Helpers/Convert/ErrorCodeConverter.cs b/src/Files.Uwp/Helpers/Convert/ErrorCodeConverter.cs index 57f9f13c5bd5..86103088e0cc 100644 --- a/src/Files.Uwp/Helpers/Convert/ErrorCodeConverter.cs +++ b/src/Files.Uwp/Helpers/Convert/ErrorCodeConverter.cs @@ -1,4 +1,4 @@ -using Files.Shared.Enums; +using Files.Shared.Enums; namespace Files.Uwp.Helpers { diff --git a/src/Files.Uwp/Helpers/DialogDisplayHelper.cs b/src/Files.Uwp/Helpers/DialogDisplayHelper.cs index 1d52de59fc8b..219990341807 100644 --- a/src/Files.Uwp/Helpers/DialogDisplayHelper.cs +++ b/src/Files.Uwp/Helpers/DialogDisplayHelper.cs @@ -1,10 +1,10 @@ -using Files.Uwp.Dialogs; +using Files.Uwp.Dialogs; using Files.Shared.Enums; using Files.Uwp.ViewModels.Dialogs; using System; using System.Threading.Tasks; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; namespace Files.Uwp.Helpers { @@ -47,7 +47,7 @@ public static async Task ShowDialogAsync(DynamicDialog dial { try { - if (Window.Current.Content is Frame rootFrame) + if (App.Window.Content is Frame rootFrame) { await dialog.ShowAsync(); return dialog.DynamicResult; diff --git a/src/Files.Uwp/Helpers/DispatcherHelper.cs b/src/Files.Uwp/Helpers/DispatcherHelper.cs index f0f57f7a994c..cae3cbc92548 100644 --- a/src/Files.Uwp/Helpers/DispatcherHelper.cs +++ b/src/Files.Uwp/Helpers/DispatcherHelper.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Runtime.CompilerServices; using Windows.UI.Core; @@ -13,7 +13,9 @@ internal static class DispatcherHelper /// public struct DispatcherPriorityAwaitable { - private readonly CoreDispatcher dispatcher; + private readonly /* + TODO UA306_A1: UWP CoreDispatcher : Windows.UI.Core.CoreDispatcher is no longer supported. Use DispatcherQueue instead. Read: https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/guides/threading + */CoreDispatcher dispatcher; private readonly CoreDispatcherPriority priority; internal DispatcherPriorityAwaitable(CoreDispatcher dispatcher, CoreDispatcherPriority priority) diff --git a/src/Files.Uwp/Helpers/DriveHelpers.cs b/src/Files.Uwp/Helpers/DriveHelpers.cs index f3857dd8c31d..442a766b057d 100644 --- a/src/Files.Uwp/Helpers/DriveHelpers.cs +++ b/src/Files.Uwp/Helpers/DriveHelpers.cs @@ -1,4 +1,4 @@ -using Files.Uwp.Interacts; +using Files.Uwp.Interacts; using Microsoft.Toolkit.Uwp; using Microsoft.Toolkit.Uwp.Notifications; using System.Diagnostics; diff --git a/src/Files.Uwp/Helpers/DynamicDialogFactory.cs b/src/Files.Uwp/Helpers/DynamicDialogFactory.cs index 09f5a8df4396..8d69a6d0aeb4 100644 --- a/src/Files.Uwp/Helpers/DynamicDialogFactory.cs +++ b/src/Files.Uwp/Helpers/DynamicDialogFactory.cs @@ -1,4 +1,4 @@ -using Files.Uwp.Dialogs; +using Files.Uwp.Dialogs; using Files.Shared.Enums; using Files.Shared.Extensions; using Files.Uwp.Filesystem; @@ -6,7 +6,7 @@ using Microsoft.Toolkit.Uwp; using System; using Windows.System; -using Windows.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Controls; using System.Collections.Generic; using System.Linq; @@ -53,8 +53,8 @@ public static DynamicDialog GetFor_RenameDialog() TextBlock tipText = new TextBlock() { Text = "RenameDialogSymbolsTip/Text".GetLocalized(), - Margin = new Windows.UI.Xaml.Thickness(0, 0, 4, 0), - TextWrapping = Windows.UI.Xaml.TextWrapping.Wrap, + Margin = new Microsoft.UI.Xaml.Thickness(0, 0, 4, 0), + TextWrapping = Microsoft.UI.Xaml.TextWrapping.Wrap, Opacity = 0.0d }; @@ -63,7 +63,9 @@ public static DynamicDialog GetFor_RenameDialog() if (FilesystemHelpers.ContainsRestrictedCharacters(args.NewText)) { args.Cancel = true; - await inputText.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => + await /* + TODO UA306_A2: UWP CoreDispatcher : Windows.UI.Core.CoreDispatcher is no longer supported. Use DispatcherQueue instead. Read: https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/guides/threading + */inputText.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { var oldSelection = textBox.SelectionStart + textBox.SelectionLength; var oldText = textBox.Text; @@ -93,7 +95,7 @@ await inputText.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Norma { // dispatching to the ui thread fixes an issue where the primary dialog button would steal focus _ = inputText.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, - () => inputText.Focus(Windows.UI.Xaml.FocusState.Programmatic)); + () => inputText.Focus(Microsoft.UI.Xaml.FocusState.Programmatic)); }; dialog = new DynamicDialog(new DynamicDialogViewModel() diff --git a/src/Files.Uwp/Helpers/EnumConversionHelpers.cs b/src/Files.Uwp/Helpers/EnumConversionHelpers.cs index 1ee02c7c73d2..d30ce0941859 100644 --- a/src/Files.Uwp/Helpers/EnumConversionHelpers.cs +++ b/src/Files.Uwp/Helpers/EnumConversionHelpers.cs @@ -1,4 +1,4 @@ -using Files.Shared.Enums; +using Files.Shared.Enums; using Windows.Storage; namespace Files.Uwp.Helpers diff --git a/src/Files.Uwp/Helpers/ExternalResourcesHelper.cs b/src/Files.Uwp/Helpers/ExternalResourcesHelper.cs index 80074560fd23..c5fa8fc08e8c 100644 --- a/src/Files.Uwp/Helpers/ExternalResourcesHelper.cs +++ b/src/Files.Uwp/Helpers/ExternalResourcesHelper.cs @@ -1,12 +1,12 @@ -using Microsoft.Toolkit.Uwp; +using Microsoft.Toolkit.Uwp; using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Threading.Tasks; using Windows.Storage; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Markup; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Markup; namespace Files.Uwp.Helpers { diff --git a/src/Files.Uwp/Helpers/FileExtensionHelpers.cs b/src/Files.Uwp/Helpers/FileExtensionHelpers.cs index a70b1bee0a54..6c5cb34d43c4 100644 --- a/src/Files.Uwp/Helpers/FileExtensionHelpers.cs +++ b/src/Files.Uwp/Helpers/FileExtensionHelpers.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Linq; namespace Files.Uwp.Helpers diff --git a/src/Files.Uwp/Helpers/FileListCache/FileListCacheController.cs b/src/Files.Uwp/Helpers/FileListCache/FileListCacheController.cs index 0cada5d6a345..ed8abfbac30e 100644 --- a/src/Files.Uwp/Helpers/FileListCache/FileListCacheController.cs +++ b/src/Files.Uwp/Helpers/FileListCache/FileListCacheController.cs @@ -1,4 +1,4 @@ -using System.Collections.Concurrent; +using System.Collections.Concurrent; using System.Threading; using System.Threading.Tasks; diff --git a/src/Files.Uwp/Helpers/FileListCache/IFileListCache.cs b/src/Files.Uwp/Helpers/FileListCache/IFileListCache.cs index a130a7eaa548..0ec93c0602e7 100644 --- a/src/Files.Uwp/Helpers/FileListCache/IFileListCache.cs +++ b/src/Files.Uwp/Helpers/FileListCache/IFileListCache.cs @@ -1,4 +1,4 @@ -using System.Threading; +using System.Threading; using System.Threading.Tasks; namespace Files.Uwp.Helpers.FileListCache diff --git a/src/Files.Uwp/Helpers/FilePropertiesHelpers.cs b/src/Files.Uwp/Helpers/FilePropertiesHelpers.cs index d4ac8d547faa..2cd07ca99006 100644 --- a/src/Files.Uwp/Helpers/FilePropertiesHelpers.cs +++ b/src/Files.Uwp/Helpers/FilePropertiesHelpers.cs @@ -1,4 +1,4 @@ -using Files.Uwp.Dialogs; +using Files.Uwp.Dialogs; using Files.Uwp.Views; using Microsoft.Toolkit.Uwp; using System; @@ -11,10 +11,10 @@ using Windows.UI.ViewManagement; using Windows.UI.WindowManagement; using Windows.UI.WindowManagement.Preview; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Hosting; -using Windows.UI.Xaml.Media.Animation; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Hosting; +using Microsoft.UI.Xaml.Media.Animation; using static Files.Uwp.Views.Properties; namespace Files.Uwp.Helpers @@ -60,7 +60,16 @@ public static async Task OpenPropertiesWindowAsync(object item, IShellPage assoc { if (WindowDecorationsHelper.IsWindowDecorationsAllowed) { - AppWindow appWindow = await AppWindow.TryCreateAsync(); + + /* + TODO UA315_A Use Microsoft.UI.Windowing.AppWindow for window Management instead of ApplicationView/CoreWindow or Microsoft.UI.Windowing.AppWindow APIs + Read: https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/guides/windowing + */ + Microsoft.UI.Windowing.AppWindow appWindow = /* + TODO UA315_A Use Microsoft.UI.Windowing.AppWindow for window Management instead of ApplicationView/CoreWindow or Microsoft.UI.Windowing.AppWindow APIs + Read: https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/guides/windowing + */ + Microsoft.UI.Windowing.AppWindow.Create(); Frame frame = new Frame(); frame.RequestedTheme = ThemeHelper.RootTheme; @@ -83,8 +92,19 @@ public static async Task OpenPropertiesWindowAsync(object item, IShellPage assoc // Set window size again here as sometimes it's not resized in the page Loaded event appWindow.RequestSize(new Size(460, 550)); - DisplayRegion displayRegion = ApplicationView.GetForCurrentView().GetDisplayRegions()[0]; - Point pointerPosition = CoreWindow.GetForCurrentThread().PointerPosition; + DisplayRegion displayRegion = + /* + TODO UA315_A Use Microsoft.UI.Windowing.AppWindow for window Management instead of ApplicationView/CoreWindow or Microsoft.UI.Windowing.AppWindow APIs + Read: https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/guides/windowing + */ + ApplicationView.GetForCurrentView().GetDisplayRegions()[0]; + Point pointerPosition = + /* + TODO UA315_B + Use Microsoft.UI.Windowing.AppWindow.Create instead of GetForCurrentThread. + Read: https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/guides/windowing + */ + CoreWindow.GetForCurrentThread().PointerPosition; appWindow.RequestMoveRelativeToDisplayRegion(displayRegion, new Point(pointerPosition.X - displayRegion.WorkAreaOffset.X, pointerPosition.Y - displayRegion.WorkAreaOffset.Y)); } @@ -92,9 +112,16 @@ public static async Task OpenPropertiesWindowAsync(object item, IShellPage assoc else { CoreApplicationView newWindow = CoreApplication.CreateNewView(); - ApplicationView newView = null; - await newWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async () => + /* + TODO UA315_A Use Microsoft.UI.Windowing.AppWindow for window Management instead of ApplicationView/CoreWindow or Microsoft.UI.Windowing.AppWindow APIs + Read: https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/guides/windowing + */ + ApplicationView newView = null; + + await /* + TODO UA306_A2: UWP CoreDispatcher : Windows.UI.Core.CoreDispatcher is no longer supported. Use DispatcherQueue instead. Read: https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/guides/threading + */newWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async () => { Frame frame = new Frame(); frame.RequestedTheme = ThemeHelper.RootTheme; @@ -103,10 +130,15 @@ await newWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async () => Item = item, AppInstanceArgument = associatedInstance }, new SuppressNavigationTransitionInfo()); - Window.Current.Content = frame; - Window.Current.Activate(); + App.Window.Content = frame; + App.Window.Activate(); - newView = ApplicationView.GetForCurrentView(); + newView = + /* + TODO UA315_A Use Microsoft.UI.Windowing.AppWindow for window Management instead of ApplicationView/CoreWindow or Microsoft.UI.Windowing.AppWindow APIs + Read: https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/guides/windowing + */ + ApplicationView.GetForCurrentView(); newWindow.TitleBar.ExtendViewIntoTitleBar = true; newView.Title = "PropertiesTitle".GetLocalized(); newView.PersistedStateId = "Properties"; diff --git a/src/Files.Uwp/Helpers/FileThumbnailHelper.cs b/src/Files.Uwp/Helpers/FileThumbnailHelper.cs index 4314ab342e9d..76bfd22f2b5c 100644 --- a/src/Files.Uwp/Helpers/FileThumbnailHelper.cs +++ b/src/Files.Uwp/Helpers/FileThumbnailHelper.cs @@ -1,4 +1,4 @@ -using Files.Shared; +using Files.Shared; using Files.Uwp.Extensions; using Files.Uwp.Filesystem; using Files.Shared.Extensions; diff --git a/src/Files.Uwp/Helpers/Fractions.cs b/src/Files.Uwp/Helpers/Fractions.cs index 1516b631b670..fdace7fcceba 100644 --- a/src/Files.Uwp/Helpers/Fractions.cs +++ b/src/Files.Uwp/Helpers/Fractions.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Linq; namespace Files.Uwp.Helpers diff --git a/src/Files.Uwp/Helpers/FtpHelpers.cs b/src/Files.Uwp/Helpers/FtpHelpers.cs index 494ae5bee264..92aa335ff252 100644 --- a/src/Files.Uwp/Helpers/FtpHelpers.cs +++ b/src/Files.Uwp/Helpers/FtpHelpers.cs @@ -1,4 +1,4 @@ -using FluentFTP; +using FluentFTP; using System; using System.Threading.Tasks; using Files.Shared.Extensions; diff --git a/src/Files.Uwp/Helpers/IntervalSampler.cs b/src/Files.Uwp/Helpers/IntervalSampler.cs index 629f44bddd1d..fc9973c7bd8d 100644 --- a/src/Files.Uwp/Helpers/IntervalSampler.cs +++ b/src/Files.Uwp/Helpers/IntervalSampler.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace Files.Uwp.Helpers { diff --git a/src/Files.Uwp/Helpers/ItemListDisplayHelpers/BlockingListEnumerator.cs b/src/Files.Uwp/Helpers/ItemListDisplayHelpers/BlockingListEnumerator.cs index da463227770f..7993f04bf48f 100644 --- a/src/Files.Uwp/Helpers/ItemListDisplayHelpers/BlockingListEnumerator.cs +++ b/src/Files.Uwp/Helpers/ItemListDisplayHelpers/BlockingListEnumerator.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections; using System.Collections.Generic; diff --git a/src/Files.Uwp/Helpers/ItemListDisplayHelpers/GroupedCollection.cs b/src/Files.Uwp/Helpers/ItemListDisplayHelpers/GroupedCollection.cs index 532ac017b143..d24eaaadccf6 100644 --- a/src/Files.Uwp/Helpers/ItemListDisplayHelpers/GroupedCollection.cs +++ b/src/Files.Uwp/Helpers/ItemListDisplayHelpers/GroupedCollection.cs @@ -1,10 +1,10 @@ -using CommunityToolkit.Mvvm.ComponentModel; +using CommunityToolkit.Mvvm.ComponentModel; using Microsoft.Toolkit.Uwp; using System; using System.Collections.Generic; using System.ComponentModel; using System.Runtime.CompilerServices; -using Windows.UI.Xaml.Media; +using Microsoft.UI.Xaml.Media; namespace Files.Uwp.Helpers { diff --git a/src/Files.Uwp/Helpers/ItemListDisplayHelpers/GroupingHelper.cs b/src/Files.Uwp/Helpers/ItemListDisplayHelpers/GroupingHelper.cs index 85f395aabe69..265db7fa4f40 100644 --- a/src/Files.Uwp/Helpers/ItemListDisplayHelpers/GroupingHelper.cs +++ b/src/Files.Uwp/Helpers/ItemListDisplayHelpers/GroupingHelper.cs @@ -1,4 +1,4 @@ -using CommunityToolkit.Mvvm.DependencyInjection; +using CommunityToolkit.Mvvm.DependencyInjection; using Files.Shared.Enums; using Files.Shared.Services.DateTimeFormatter; using Files.Uwp.Extensions; diff --git a/src/Files.Uwp/Helpers/ItemListDisplayHelpers/SortingHelper.cs b/src/Files.Uwp/Helpers/ItemListDisplayHelpers/SortingHelper.cs index 23b9c59caac7..77b30ddacaea 100644 --- a/src/Files.Uwp/Helpers/ItemListDisplayHelpers/SortingHelper.cs +++ b/src/Files.Uwp/Helpers/ItemListDisplayHelpers/SortingHelper.cs @@ -1,4 +1,4 @@ -using Files.Shared.Enums; +using Files.Shared.Enums; using Files.Uwp.Filesystem; using CommunityToolkit.Mvvm.DependencyInjection; using System; diff --git a/src/Files.Uwp/Helpers/ItemModelListToContextFlyoutHelper.cs b/src/Files.Uwp/Helpers/ItemModelListToContextFlyoutHelper.cs index 13e0ba88be85..be912d27d98f 100644 --- a/src/Files.Uwp/Helpers/ItemModelListToContextFlyoutHelper.cs +++ b/src/Files.Uwp/Helpers/ItemModelListToContextFlyoutHelper.cs @@ -1,12 +1,12 @@ -using Files.Uwp.UserControls; +using Files.Uwp.UserControls; using Files.Uwp.ViewModels; using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Media; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Media; namespace Files.Uwp.Helpers.ContextFlyouts { diff --git a/src/Files.Uwp/Helpers/ItemsDataTemplateSelector.cs b/src/Files.Uwp/Helpers/ItemsDataTemplateSelector.cs index 6024627eb0b1..9a986434ecc0 100644 --- a/src/Files.Uwp/Helpers/ItemsDataTemplateSelector.cs +++ b/src/Files.Uwp/Helpers/ItemsDataTemplateSelector.cs @@ -1,7 +1,7 @@ -using Files.Uwp.Views; +using Files.Uwp.Views; using System.Collections.ObjectModel; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; namespace Files.Uwp.Helpers { diff --git a/src/Files.Uwp/Helpers/KnownTypesBinder.cs b/src/Files.Uwp/Helpers/KnownTypesBinder.cs index 6a596e02b860..c634fd32f87d 100644 --- a/src/Files.Uwp/Helpers/KnownTypesBinder.cs +++ b/src/Files.Uwp/Helpers/KnownTypesBinder.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json.Serialization; +using Newtonsoft.Json.Serialization; using System; using System.Collections.Generic; using System.Linq; diff --git a/src/Files.Uwp/Helpers/LayoutPreferences/LayoutPreferences.cs b/src/Files.Uwp/Helpers/LayoutPreferences/LayoutPreferences.cs index 3b6f0d641d5c..9b5e35f7442b 100644 --- a/src/Files.Uwp/Helpers/LayoutPreferences/LayoutPreferences.cs +++ b/src/Files.Uwp/Helpers/LayoutPreferences/LayoutPreferences.cs @@ -1,4 +1,4 @@ -using CommunityToolkit.Mvvm.DependencyInjection; +using CommunityToolkit.Mvvm.DependencyInjection; using Files.Backend.Services.Settings; using Files.Shared.Enums; using Files.Uwp.ViewModels; diff --git a/src/Files.Uwp/Helpers/LayoutPreferences/LayoutPrefsDb.cs b/src/Files.Uwp/Helpers/LayoutPreferences/LayoutPrefsDb.cs index c9b74583e212..2779e21d6310 100644 --- a/src/Files.Uwp/Helpers/LayoutPreferences/LayoutPrefsDb.cs +++ b/src/Files.Uwp/Helpers/LayoutPreferences/LayoutPrefsDb.cs @@ -1,4 +1,4 @@ -using LiteDB; +using LiteDB; using System; using System.Linq; using Files.Shared.Extensions; diff --git a/src/Files.Uwp/Helpers/LibraryHelper.cs b/src/Files.Uwp/Helpers/LibraryHelper.cs index 6eb1535a9813..71d74c7f30c2 100644 --- a/src/Files.Uwp/Helpers/LibraryHelper.cs +++ b/src/Files.Uwp/Helpers/LibraryHelper.cs @@ -1,4 +1,4 @@ -using Files.Shared; +using Files.Shared; using Files.Shared.Enums; using Files.Uwp.Dialogs; using Files.Uwp.Filesystem; @@ -13,8 +13,8 @@ using Windows.ApplicationModel.AppService; using Windows.Foundation.Collections; using Windows.System; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; namespace Files.Uwp.Helpers { diff --git a/src/Files.Uwp/Helpers/LocalizedEnumHelper.cs b/src/Files.Uwp/Helpers/LocalizedEnumHelper.cs index 0e6cd4dc01a9..65885ea04bb3 100644 --- a/src/Files.Uwp/Helpers/LocalizedEnumHelper.cs +++ b/src/Files.Uwp/Helpers/LocalizedEnumHelper.cs @@ -1,4 +1,4 @@ -using Microsoft.Toolkit.Uwp; +using Microsoft.Toolkit.Uwp; using System; namespace Files.Uwp.Helpers diff --git a/src/Files.Uwp/Helpers/MenuFlyoutHelper.cs b/src/Files.Uwp/Helpers/MenuFlyoutHelper.cs index dfbc713f311b..4e27f2bb0981 100644 --- a/src/Files.Uwp/Helpers/MenuFlyoutHelper.cs +++ b/src/Files.Uwp/Helpers/MenuFlyoutHelper.cs @@ -1,8 +1,8 @@ -using CommunityToolkit.Mvvm.Input; +using CommunityToolkit.Mvvm.Input; using System; using System.Collections.Generic; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; namespace Files.Uwp.Helpers { @@ -95,7 +95,9 @@ private static async void SetupItems(MenuFlyout menu) return; } - await menu.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => + await /* + TODO UA306_A2: UWP CoreDispatcher : Windows.UI.Core.CoreDispatcher is no longer supported. Use DispatcherQueue instead. Read: https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/guides/threading + */menu.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { menu.Items.Clear(); AddItems(menu.Items, itemSource); diff --git a/src/Files.Uwp/Helpers/MultitaskingTabsHelpers.cs b/src/Files.Uwp/Helpers/MultitaskingTabsHelpers.cs index bf42ef065773..16e14306be87 100644 --- a/src/Files.Uwp/Helpers/MultitaskingTabsHelpers.cs +++ b/src/Files.Uwp/Helpers/MultitaskingTabsHelpers.cs @@ -1,4 +1,4 @@ -using Files.Uwp.UserControls.MultitaskingControl; +using Files.Uwp.UserControls.MultitaskingControl; using Files.Uwp.ViewModels; using Microsoft.Toolkit.Uwp; using Microsoft.UI.Xaml.Controls; diff --git a/src/Files.Uwp/Helpers/NativeDirectoryChangesHelper.cs b/src/Files.Uwp/Helpers/NativeDirectoryChangesHelper.cs index bd66d0776e81..b3c5dd247ece 100644 --- a/src/Files.Uwp/Helpers/NativeDirectoryChangesHelper.cs +++ b/src/Files.Uwp/Helpers/NativeDirectoryChangesHelper.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Runtime.InteropServices; namespace Files.Uwp.Helpers diff --git a/src/Files.Uwp/Helpers/NativeFileOperationsHelper.cs b/src/Files.Uwp/Helpers/NativeFileOperationsHelper.cs index 06dcacf2bc34..84fa6b47fd8f 100644 --- a/src/Files.Uwp/Helpers/NativeFileOperationsHelper.cs +++ b/src/Files.Uwp/Helpers/NativeFileOperationsHelper.cs @@ -1,4 +1,4 @@ -using Files.Shared.Extensions; +using Files.Shared.Extensions; using Microsoft.Win32.SafeHandles; using System; using System.Collections.Generic; diff --git a/src/Files.Uwp/Helpers/NativeIoDeviceControlHelper.cs b/src/Files.Uwp/Helpers/NativeIoDeviceControlHelper.cs index 5d27f74c7c1b..7aac417a96a2 100644 --- a/src/Files.Uwp/Helpers/NativeIoDeviceControlHelper.cs +++ b/src/Files.Uwp/Helpers/NativeIoDeviceControlHelper.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Runtime.InteropServices; namespace Files.Uwp.Helpers diff --git a/src/Files.Uwp/Helpers/NativeWinApiHelper.cs b/src/Files.Uwp/Helpers/NativeWinApiHelper.cs index 96ed8a44f128..7580906b1664 100644 --- a/src/Files.Uwp/Helpers/NativeWinApiHelper.cs +++ b/src/Files.Uwp/Helpers/NativeWinApiHelper.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Runtime.InteropServices; using System.Text; using System.Threading.Tasks; @@ -259,7 +259,13 @@ internal interface ICoreWindowInterop bool MessageHandled { get; } } - public static IntPtr CoreWindowHandle => ((ICoreWindowInterop)(object)Windows.UI.Core.CoreWindow.GetForCurrentThread()).WindowHandle; + public static IntPtr CoreWindowHandle => ((ICoreWindowInterop)(object) + /* + TODO UA315_B + Use Microsoft.UI.Windowing.AppWindow.Create instead of GetForCurrentThread. + Read: https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/guides/windowing + */ + Windows.UI.Core.CoreWindow.GetForCurrentThread()).WindowHandle; public static async Task GetFileAssociationAsync(string filePath) { diff --git a/src/Files.Uwp/Helpers/NaturalStringComparer.cs b/src/Files.Uwp/Helpers/NaturalStringComparer.cs index bd0b0cfc7b0e..2202990e01a3 100644 --- a/src/Files.Uwp/Helpers/NaturalStringComparer.cs +++ b/src/Files.Uwp/Helpers/NaturalStringComparer.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Runtime.InteropServices; diff --git a/src/Files.Uwp/Helpers/NavigationHelpers.cs b/src/Files.Uwp/Helpers/NavigationHelpers.cs index 9438078f4bf2..2d947a68a286 100644 --- a/src/Files.Uwp/Helpers/NavigationHelpers.cs +++ b/src/Files.Uwp/Helpers/NavigationHelpers.cs @@ -1,4 +1,4 @@ -using CommunityToolkit.Mvvm.DependencyInjection; +using CommunityToolkit.Mvvm.DependencyInjection; using Files.Backend.Helpers; using Files.Backend.Services.Settings; using Files.Shared; @@ -417,10 +417,10 @@ private static async Task OpenFile(string path, IShellPage ass if (openViaApplicationPicker) { - LauncherOptions options = new LauncherOptions + LauncherOptions options = this.InitializeWithWindow(new LauncherOptions { DisplayApplicationPicker = true - }; + }); if (!await Launcher.LaunchFileAsync(childFile.Item, options)) { var connection = await AppServiceConnectionHelper.Instance; @@ -500,7 +500,7 @@ await connection.SendMessageAsync(new ValueSet() break; } - var options = new LauncherOptions(); + var options = this.InitializeWithWindow(new LauncherOptions()); if (currentFolder.AreQueryOptionsSupported(queryOptions)) { fileQueryResult = currentFolder.CreateFileQueryWithOptions(queryOptions); @@ -524,5 +524,10 @@ await connection.SendMessageAsync(new ValueSet() } return opened; } + private LauncherOptions InitializeWithWindow(LauncherOptions obj) + { + WinRT.Interop.InitializeWithWindow.Initialize(obj, App.WindowHandle); + return obj; + } } } \ No newline at end of file diff --git a/src/Files.Uwp/Helpers/PackageHelper.cs b/src/Files.Uwp/Helpers/PackageHelper.cs index 5197f2571887..bd386c656a5c 100644 --- a/src/Files.Uwp/Helpers/PackageHelper.cs +++ b/src/Files.Uwp/Helpers/PackageHelper.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Diagnostics; using System.Threading.Tasks; using Windows.System; diff --git a/src/Files.Uwp/Helpers/PathNormalization.cs b/src/Files.Uwp/Helpers/PathNormalization.cs index 98891716b1f9..5527cf0e2c41 100644 --- a/src/Files.Uwp/Helpers/PathNormalization.cs +++ b/src/Files.Uwp/Helpers/PathNormalization.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; namespace Files.Uwp.Helpers diff --git a/src/Files.Uwp/Helpers/PostBannerHelpers.cs b/src/Files.Uwp/Helpers/PostBannerHelpers.cs index 50aba06b9e54..57702a5102b5 100644 --- a/src/Files.Uwp/Helpers/PostBannerHelpers.cs +++ b/src/Files.Uwp/Helpers/PostBannerHelpers.cs @@ -1,4 +1,4 @@ -using Files.Shared.Enums; +using Files.Shared.Enums; using Files.Uwp.Filesystem; using Files.Uwp.ViewModels; using Microsoft.Toolkit.Uwp; diff --git a/src/Files.Uwp/Helpers/QuickLookHelpers.cs b/src/Files.Uwp/Helpers/QuickLookHelpers.cs index 36cba859453e..0449875d4089 100644 --- a/src/Files.Uwp/Helpers/QuickLookHelpers.cs +++ b/src/Files.Uwp/Helpers/QuickLookHelpers.cs @@ -1,4 +1,4 @@ -using Files.Shared.Extensions; +using Files.Shared.Extensions; using System.Diagnostics; using System.Threading.Tasks; using Windows.Foundation.Collections; diff --git a/src/Files.Uwp/Helpers/RecycleBinHelpers.cs b/src/Files.Uwp/Helpers/RecycleBinHelpers.cs index b8f01eed75f8..d08487fe6bf6 100644 --- a/src/Files.Uwp/Helpers/RecycleBinHelpers.cs +++ b/src/Files.Uwp/Helpers/RecycleBinHelpers.cs @@ -1,4 +1,4 @@ -using Files.Shared; +using Files.Shared; using Files.Shared.Extensions; using Microsoft.Toolkit.Uwp; using Newtonsoft.Json; @@ -10,7 +10,7 @@ using Windows.ApplicationModel.AppService; using Windows.Foundation.Collections; using Windows.Storage; -using Windows.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Controls; namespace Files.Uwp.Helpers { @@ -85,7 +85,7 @@ public async Task EmptyRecycleBin() DefaultButton = ContentDialogButton.Primary }; - ContentDialogResult result = await ConfirmEmptyBinDialog.ShowAsync(); + ContentDialogResult result = await this.SetContentDialogRoot(ConfirmEmptyBinDialog).ShowAsync(); if (result == ContentDialogResult.Primary) { @@ -103,6 +103,14 @@ public async Task EmptyRecycleBin() } } } + private ContentDialog SetContentDialogRoot(ContentDialog contentDialog) + { + if (Windows.Foundation.Metadata.ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 8)) + { + contentDialog.XamlRoot = this.Content.XamlRoot; + } + return contentDialog; + } public async Task HasRecycleBin(string path) { diff --git a/src/Files.Uwp/Helpers/ResourceHelpers.cs b/src/Files.Uwp/Helpers/ResourceHelpers.cs index 702b12f91df5..4ffac06bd2e8 100644 --- a/src/Files.Uwp/Helpers/ResourceHelpers.cs +++ b/src/Files.Uwp/Helpers/ResourceHelpers.cs @@ -1,5 +1,5 @@ -using Windows.ApplicationModel.Resources; -using Windows.UI.Xaml.Markup; +using Windows.ApplicationModel.Resources; +using Microsoft.UI.Xaml.Markup; namespace Files.Uwp.Helpers { diff --git a/src/Files.Uwp/Helpers/SecondaryTileHelper.cs b/src/Files.Uwp/Helpers/SecondaryTileHelper.cs index 1b88d72689cd..c3a057139f27 100644 --- a/src/Files.Uwp/Helpers/SecondaryTileHelper.cs +++ b/src/Files.Uwp/Helpers/SecondaryTileHelper.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Diagnostics; using System.Linq; using System.Threading.Tasks; @@ -39,12 +39,12 @@ public async Task TryPinFolderAsync(string path, string name) Uri Path150x150 = new Uri("ms-appx:///Assets/tile-0-300x300.png"); Uri Path71x71 = new Uri("ms-appx:///Assets/tile-0-250x250.png"); - SecondaryTile tile = new SecondaryTile( + SecondaryTile tile = this.InitializeWithWindow(new SecondaryTile( GetTileID(path), name, path, Path150x150, - TileSize.Square150x150); + TileSize.Square150x150)); tile.VisualElements.Square71x71Logo = Path71x71; tile.VisualElements.ShowNameOnSquare150x150Logo = true; @@ -58,6 +58,11 @@ public async Task TryPinFolderAsync(string path, string name) return result; } + private SecondaryTile InitializeWithWindow(SecondaryTile obj) + { + WinRT.Interop.InitializeWithWindow.Initialize(obj, App.WindowHandle); + return obj; + } public async Task UnpinFromStartAsync(string path) { diff --git a/src/Files.Uwp/Helpers/ShellContextMenuHelper.cs b/src/Files.Uwp/Helpers/ShellContextMenuHelper.cs index 4bf4454d532c..d17e3e9d185b 100644 --- a/src/Files.Uwp/Helpers/ShellContextMenuHelper.cs +++ b/src/Files.Uwp/Helpers/ShellContextMenuHelper.cs @@ -11,7 +11,7 @@ using System.Threading.Tasks; using Windows.ApplicationModel.AppService; using Windows.Foundation.Collections; -using Windows.UI.Xaml.Media.Imaging; +using Microsoft.UI.Xaml.Media.Imaging; namespace Files.Uwp.Helpers { diff --git a/src/Files.Uwp/Helpers/SidebarHelpers.cs b/src/Files.Uwp/Helpers/SidebarHelpers.cs index 081817c1984c..1ef46f390647 100644 --- a/src/Files.Uwp/Helpers/SidebarHelpers.cs +++ b/src/Files.Uwp/Helpers/SidebarHelpers.cs @@ -1,4 +1,4 @@ -using Files.Uwp.Filesystem; +using Files.Uwp.Filesystem; using System.Collections.Generic; namespace Files.Uwp.Helpers diff --git a/src/Files.Uwp/Helpers/StorageItemIconHelpers.cs b/src/Files.Uwp/Helpers/StorageItemIconHelpers.cs index 2dc5d6ffca4d..a117b7f2a1ca 100644 --- a/src/Files.Uwp/Helpers/StorageItemIconHelpers.cs +++ b/src/Files.Uwp/Helpers/StorageItemIconHelpers.cs @@ -1,4 +1,4 @@ -using Files.Shared.Enums; +using Files.Shared.Enums; using System; using System.Threading.Tasks; using Windows.Storage; diff --git a/src/Files.Uwp/Helpers/StorageSenseHelper.cs b/src/Files.Uwp/Helpers/StorageSenseHelper.cs index bcb46ccc941c..62cc7ada3b30 100644 --- a/src/Files.Uwp/Helpers/StorageSenseHelper.cs +++ b/src/Files.Uwp/Helpers/StorageSenseHelper.cs @@ -1,4 +1,4 @@ -using System; +using System; using Windows.Foundation.Collections; using Windows.Foundation.Metadata; using Windows.System; diff --git a/src/Files.Uwp/Helpers/ThemeHelper.cs b/src/Files.Uwp/Helpers/ThemeHelper.cs index 38e6155340cc..f24feddbed2c 100644 --- a/src/Files.Uwp/Helpers/ThemeHelper.cs +++ b/src/Files.Uwp/Helpers/ThemeHelper.cs @@ -1,9 +1,9 @@ -using Files.Uwp.Extensions; +using Files.Uwp.Extensions; using System; using Windows.Storage; using Windows.UI; using Windows.UI.ViewManagement; -using Windows.UI.Xaml; +using Microsoft.UI.Xaml; namespace Files.Uwp.Helpers { @@ -47,10 +47,15 @@ public static ElementTheme RootTheme public static void Initialize() { // Save reference as this might be null when the user is in another app - currentApplicationWindow = Window.Current; + currentApplicationWindow = App.Window; // Set TitleBar background color - titleBar = ApplicationView.GetForCurrentView().TitleBar; + titleBar = + /* + TODO UA315_A Use Microsoft.UI.Windowing.AppWindow for window Management instead of ApplicationView/CoreWindow or Microsoft.UI.Windowing.AppWindow APIs + Read: https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/guides/windowing + */ + ApplicationView.GetForCurrentView().TitleBar; // Apply the desired theme based on what is set in the application settings ApplyTheme(); @@ -66,7 +71,9 @@ private static async void UiSettings_ColorValuesChanged(UISettings sender, objec if (currentApplicationWindow != null) { // Dispatch on UI thread so that we have a current appbar to access and change - await currentApplicationWindow.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.High, () => + await /* + TODO UA306_A2: UWP CoreDispatcher : Windows.UI.Core.CoreDispatcher is no longer supported. Use DispatcherQueue instead. Read: https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/guides/threading + */currentApplicationWindow.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.High, () => { ApplyTheme(); }); @@ -77,7 +84,7 @@ private static void ApplyTheme() { var rootTheme = RootTheme; - if (Window.Current.Content is FrameworkElement rootElement) + if (App.Window.Content is FrameworkElement rootElement) { rootElement.RequestedTheme = rootTheme; } diff --git a/src/Files.Uwp/Helpers/UIFilesystemHelpers.cs b/src/Files.Uwp/Helpers/UIFilesystemHelpers.cs index 345dd1fe38f8..c9a958b297ba 100644 --- a/src/Files.Uwp/Helpers/UIFilesystemHelpers.cs +++ b/src/Files.Uwp/Helpers/UIFilesystemHelpers.cs @@ -1,4 +1,4 @@ -using Files.Shared; +using Files.Shared; using Files.Uwp.Dialogs; using Files.Shared.Enums; using Files.Shared.Extensions; diff --git a/src/Files.Uwp/Helpers/UIHelpers.cs b/src/Files.Uwp/Helpers/UIHelpers.cs index 48cd7231b31b..ad4fef325557 100644 --- a/src/Files.Uwp/Helpers/UIHelpers.cs +++ b/src/Files.Uwp/Helpers/UIHelpers.cs @@ -1,4 +1,4 @@ -using Files.Shared; +using Files.Shared; using Newtonsoft.Json; using System; using System.Collections.Generic; @@ -6,10 +6,10 @@ using System.Threading.Tasks; using Windows.ApplicationModel.AppService; using Windows.Foundation.Collections; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Media; -using Windows.UI.Xaml.Media.Imaging; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Media; +using Microsoft.UI.Xaml.Media.Imaging; namespace Files.Uwp.Helpers { @@ -19,17 +19,25 @@ public static async Task TryShowAsync(this ContentDialog di { try { - return await dialog.ShowAsync(); + return await this.SetContentDialogRoot(dialog).ShowAsync(); } catch // A content dialog is already open { return ContentDialogResult.None; } } + private ContentDialog SetContentDialogRoot(ContentDialog contentDialog) + { + if (Windows.Foundation.Metadata.ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 8)) + { + contentDialog.XamlRoot = this.Content.XamlRoot; + } + return contentDialog; + } public static void CloseAllDialogs() { - var openedDialogs = VisualTreeHelper.GetOpenPopups(Window.Current); + var openedDialogs = VisualTreeHelper.GetOpenPopups(App.Window); foreach (var item in openedDialogs) { diff --git a/src/Files.Uwp/Helpers/UniversalLogWriter.cs b/src/Files.Uwp/Helpers/UniversalLogWriter.cs index a05afe5c67e6..7cea230ad10d 100644 --- a/src/Files.Uwp/Helpers/UniversalLogWriter.cs +++ b/src/Files.Uwp/Helpers/UniversalLogWriter.cs @@ -1,4 +1,4 @@ -using Files.Shared; +using Files.Shared; using System; using System.Diagnostics; using System.Text; diff --git a/src/Files.Uwp/Helpers/WallpaperHelpers.cs b/src/Files.Uwp/Helpers/WallpaperHelpers.cs index 58ad0f3b6a76..456e6af7c681 100644 --- a/src/Files.Uwp/Helpers/WallpaperHelpers.cs +++ b/src/Files.Uwp/Helpers/WallpaperHelpers.cs @@ -1,4 +1,4 @@ -using Files.Shared.Enums; +using Files.Shared.Enums; using Files.Uwp.Filesystem; using Files.Uwp.Filesystem.StorageItems; using System; diff --git a/src/Files.Uwp/Helpers/WidgetsHelpers.cs b/src/Files.Uwp/Helpers/WidgetsHelpers.cs index c4e38cc20ad5..4c1d4a2717cb 100644 --- a/src/Files.Uwp/Helpers/WidgetsHelpers.cs +++ b/src/Files.Uwp/Helpers/WidgetsHelpers.cs @@ -1,4 +1,4 @@ -using Files.Backend.Services.Settings; +using Files.Backend.Services.Settings; using Files.Uwp.UserControls.Widgets; using Files.Uwp.ViewModels.Widgets; using System.Collections.Generic; diff --git a/src/Files.Uwp/Helpers/Win32Helpers.cs b/src/Files.Uwp/Helpers/Win32Helpers.cs index a9c44ab117b1..da10ed0b2f12 100644 --- a/src/Files.Uwp/Helpers/Win32Helpers.cs +++ b/src/Files.Uwp/Helpers/Win32Helpers.cs @@ -1,4 +1,4 @@ -using Files.Shared.Extensions; +using Files.Shared.Extensions; using System.Collections.Generic; using System.Diagnostics; using System.Linq; diff --git a/src/Files.Uwp/Helpers/WindowDecorationsHelper.cs b/src/Files.Uwp/Helpers/WindowDecorationsHelper.cs index 29693d9244b6..bcedd50ef072 100644 --- a/src/Files.Uwp/Helpers/WindowDecorationsHelper.cs +++ b/src/Files.Uwp/Helpers/WindowDecorationsHelper.cs @@ -1,4 +1,4 @@ -using System; +using System; using Windows.ApplicationModel; using Windows.Foundation.Metadata; diff --git a/src/Files.Uwp/Helpers/XamlHelpers/DependencyObjectHelpers.cs b/src/Files.Uwp/Helpers/XamlHelpers/DependencyObjectHelpers.cs index 4707c6ea7fcb..3f69f01cbea0 100644 --- a/src/Files.Uwp/Helpers/XamlHelpers/DependencyObjectHelpers.cs +++ b/src/Files.Uwp/Helpers/XamlHelpers/DependencyObjectHelpers.cs @@ -1,8 +1,8 @@ -using System; +using System; using System.Collections.Generic; using System.Reflection; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Media; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Media; namespace Files.Uwp.Helpers.XamlHelpers { diff --git a/src/Files.Uwp/Helpers/XamlHelpers/SystemTypeToXaml.cs b/src/Files.Uwp/Helpers/XamlHelpers/SystemTypeToXaml.cs index 1fc667aaaaae..263b504e651d 100644 --- a/src/Files.Uwp/Helpers/XamlHelpers/SystemTypeToXaml.cs +++ b/src/Files.Uwp/Helpers/XamlHelpers/SystemTypeToXaml.cs @@ -1,4 +1,4 @@ -using Windows.UI.Xaml.Markup; +using Microsoft.UI.Xaml.Markup; namespace Files.Uwp.Helpers.XamlHelpers { diff --git a/src/Files.Uwp/Helpers/ZipHelpers.cs b/src/Files.Uwp/Helpers/ZipHelpers.cs index 97966861b1ea..1be9398b707d 100644 --- a/src/Files.Uwp/Helpers/ZipHelpers.cs +++ b/src/Files.Uwp/Helpers/ZipHelpers.cs @@ -1,4 +1,4 @@ -using Files.Uwp.Filesystem.StorageItems; +using Files.Uwp.Filesystem.StorageItems; using SevenZip; using System; using System.Collections.Generic; diff --git a/src/Files.Uwp/IAddressToolbar.cs b/src/Files.Uwp/IAddressToolbar.cs index 5e12902c4253..fbf247ccac94 100644 --- a/src/Files.Uwp/IAddressToolbar.cs +++ b/src/Files.Uwp/IAddressToolbar.cs @@ -1,9 +1,9 @@ -using Files.Uwp.Helpers; +using Files.Uwp.Helpers; using Files.Uwp.Views; using System; using System.Collections.ObjectModel; using Windows.ApplicationModel.DataTransfer; -using Windows.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Controls; namespace Files.Uwp.UserControls { diff --git a/src/Files.Uwp/IBaseLayout.cs b/src/Files.Uwp/IBaseLayout.cs index 93745592b9d7..c8d8b12f20f3 100644 --- a/src/Files.Uwp/IBaseLayout.cs +++ b/src/Files.Uwp/IBaseLayout.cs @@ -1,4 +1,4 @@ -using Files.Uwp.Filesystem; +using Files.Uwp.Filesystem; using Files.Uwp.Interacts; using Files.Uwp.ViewModels; using System; diff --git a/src/Files.Uwp/ISearchBox.cs b/src/Files.Uwp/ISearchBox.cs index 059af7cc62dc..1f25ce1c7076 100644 --- a/src/Files.Uwp/ISearchBox.cs +++ b/src/Files.Uwp/ISearchBox.cs @@ -1,8 +1,8 @@ -using Files.Uwp.Filesystem; +using Files.Uwp.Filesystem; using System; using System.Collections.Generic; using Windows.Foundation; -using Windows.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Controls; namespace Files.Uwp { diff --git a/src/Files.Uwp/IShellPage.cs b/src/Files.Uwp/IShellPage.cs index 2e160e4f1b0d..cdf07769fe6b 100644 --- a/src/Files.Uwp/IShellPage.cs +++ b/src/Files.Uwp/IShellPage.cs @@ -1,4 +1,4 @@ -using Files.Uwp.Filesystem; +using Files.Uwp.Filesystem; using Files.Uwp.UserControls.MultitaskingControl; using Files.Uwp.ViewModels; using Files.Uwp.Views; diff --git a/src/Files.Uwp/Imaging/BitmapImageModel.cs b/src/Files.Uwp/Imaging/BitmapImageModel.cs index fe65d886e432..1eb4d7a8bfaf 100644 --- a/src/Files.Uwp/Imaging/BitmapImageModel.cs +++ b/src/Files.Uwp/Imaging/BitmapImageModel.cs @@ -1,6 +1,6 @@ -using Files.Backend.Models.Imaging; +using Files.Backend.Models.Imaging; using System.Collections.Generic; -using Windows.UI.Xaml.Media.Imaging; +using Microsoft.UI.Xaml.Media.Imaging; namespace Files.Uwp.Imaging { diff --git a/src/Files.Uwp/Interacts/BaseLayoutCommandImplementationModel.cs b/src/Files.Uwp/Interacts/BaseLayoutCommandImplementationModel.cs index 7581da506c2c..ad92f81c50e5 100644 --- a/src/Files.Uwp/Interacts/BaseLayoutCommandImplementationModel.cs +++ b/src/Files.Uwp/Interacts/BaseLayoutCommandImplementationModel.cs @@ -1,4 +1,4 @@ -using Files.Shared; +using Files.Shared; using Files.Uwp.Dialogs; using Files.Shared.Enums; using Files.Uwp.Extensions; @@ -24,9 +24,9 @@ using Windows.Storage; using Windows.System; using Windows.UI.Core; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Input; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Input; using Files.Backend.Enums; namespace Files.Uwp.Interacts @@ -286,7 +286,15 @@ public virtual async void OpenDirectoryInNewTab(RoutedEventArgs e) { foreach (ListedItem listedItem in SlimContentPage.SelectedItems) { - await CoreWindow.GetForCurrentThread().Dispatcher.RunAsync(CoreDispatcherPriority.Low, async () => + await /* + TODO UA306_A2: UWP CoreDispatcher : Windows.UI.Core.CoreDispatcher is no longer supported. Use DispatcherQueue instead. Read: https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/guides/threading + */ + /* + TODO UA315_B + Use Microsoft.UI.Windowing.AppWindow.Create instead of GetForCurrentThread. + Read: https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/guides/windowing + */ + CoreWindow.GetForCurrentThread().Dispatcher.RunAsync(CoreDispatcherPriority.Low, async () => { await MainPageViewModel.AddNewTabByPathAsync(typeof(PaneHolderPage), (listedItem as ShortcutItem)?.TargetPath ?? listedItem.ItemPath); }); @@ -367,10 +375,9 @@ public virtual void ShareItem(RoutedEventArgs e) { DataTransferManager manager = DataTransferManager.GetForCurrentView(); manager.DataRequested += new TypedEventHandler(Manager_DataRequested); - DataTransferManager.ShowShareUI(new ShareUIOptions - { - Theme = Enum.IsDefined(typeof(ShareUITheme), ThemeHelper.RootTheme.ToString()) ? (ShareUITheme)ThemeHelper.RootTheme : ShareUITheme.Default - }); + + Windows.ApplicationModel.DataTransfer.DataTransferManager.As().ShowShareUIForWindow(App.WindowHandle) +; async void Manager_DataRequested(DataTransferManager sender, DataRequestedEventArgs args) { diff --git a/src/Files.Uwp/Interacts/BaseLayoutCommandsViewModel.cs b/src/Files.Uwp/Interacts/BaseLayoutCommandsViewModel.cs index e7f7ed1f99f6..c35717a5d3c1 100644 --- a/src/Files.Uwp/Interacts/BaseLayoutCommandsViewModel.cs +++ b/src/Files.Uwp/Interacts/BaseLayoutCommandsViewModel.cs @@ -1,9 +1,9 @@ -using Files.Shared; +using Files.Shared; using CommunityToolkit.Mvvm.Input; using System; using System.Windows.Input; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Input; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Input; namespace Files.Uwp.Interacts { diff --git a/src/Files.Uwp/Interacts/IBaseLayoutCommandImplementationModel.cs b/src/Files.Uwp/Interacts/IBaseLayoutCommandImplementationModel.cs index 245e4ca18ebe..d30ec3fc18f7 100644 --- a/src/Files.Uwp/Interacts/IBaseLayoutCommandImplementationModel.cs +++ b/src/Files.Uwp/Interacts/IBaseLayoutCommandImplementationModel.cs @@ -1,8 +1,8 @@ -using Files.Shared; +using Files.Shared; using System; using System.Threading.Tasks; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Input; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Input; namespace Files.Uwp.Interacts { diff --git a/src/Files.Uwp/Interacts/IStatusCenterActions.cs b/src/Files.Uwp/Interacts/IStatusCenterActions.cs index ded683473678..7031ad49fca4 100644 --- a/src/Files.Uwp/Interacts/IStatusCenterActions.cs +++ b/src/Files.Uwp/Interacts/IStatusCenterActions.cs @@ -1,4 +1,4 @@ -using Files.Shared.Enums; +using Files.Shared.Enums; using Files.Uwp.ViewModels; using System; using System.Threading; diff --git a/src/Files.Uwp/Interacts/ItemManipulationModel.cs b/src/Files.Uwp/Interacts/ItemManipulationModel.cs index ce003f9315dd..78d42d81a231 100644 --- a/src/Files.Uwp/Interacts/ItemManipulationModel.cs +++ b/src/Files.Uwp/Interacts/ItemManipulationModel.cs @@ -1,4 +1,4 @@ -using Files.Uwp.Filesystem; +using Files.Uwp.Filesystem; using System; using System.Collections.Generic; diff --git a/src/Files.Uwp/Interacts/RemovableDevice.cs b/src/Files.Uwp/Interacts/RemovableDevice.cs index 8a41689a6796..72dc24d4359d 100644 --- a/src/Files.Uwp/Interacts/RemovableDevice.cs +++ b/src/Files.Uwp/Interacts/RemovableDevice.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Diagnostics; using System.Threading.Tasks; using static Files.Uwp.Helpers.NativeIoDeviceControlHelper; diff --git a/src/Files.Uwp/IsExternalInit.cs b/src/Files.Uwp/IsExternalInit.cs index a9397250b877..f2bd3c295454 100644 --- a/src/Files.Uwp/IsExternalInit.cs +++ b/src/Files.Uwp/IsExternalInit.cs @@ -1,4 +1,4 @@ -using System.ComponentModel; +using System.ComponentModel; namespace System.Runtime.CompilerServices { diff --git a/src/Files.Uwp/MainWindow.xaml b/src/Files.Uwp/MainWindow.xaml new file mode 100644 index 000000000000..161c5537d7a9 --- /dev/null +++ b/src/Files.Uwp/MainWindow.xaml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Files.Uwp/MainWindow.xaml.cs b/src/Files.Uwp/MainWindow.xaml.cs new file mode 100644 index 000000000000..5aafd8242eb2 --- /dev/null +++ b/src/Files.Uwp/MainWindow.xaml.cs @@ -0,0 +1,153 @@ +using Microsoft.UI; +using Microsoft.UI.Windowing; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Controls.Primitives; +using Microsoft.UI.Xaml.Data; +using Microsoft.UI.Xaml.Input; +using Microsoft.UI.Xaml.Media; +using Microsoft.UI.Xaml.Navigation; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Runtime.InteropServices; +using System.Runtime.InteropServices.WindowsRuntime; +using Windows.Foundation; +using Windows.Foundation.Collections; +using WinRT.Interop; + +// To learn more about WinUI, the WinUI project structure, +// and more about our project templates, see: http://aka.ms/winui-project-info. + +namespace Files.Uwp +{ + /// + /// An empty window that can be used on its own or navigated to within a Frame. + /// + public sealed partial class MainWindow : Window + { + AppWindow m_AppWindow; + + public MainWindow() + { + this.InitializeComponent(); + + m_AppWindow = GetAppWindowForCurrentWindow(); + + // Check to see if customization is supported. + // Currently only supported on Windows 11. + if (AppWindowTitleBar.IsCustomizationSupported()) + { + var titleBar = m_AppWindow.TitleBar; + titleBar.ExtendsContentIntoTitleBar = true; + AppTitleBar.Loaded += AppTitleBar_Loaded; + AppTitleBar.SizeChanged += AppTitleBar_SizeChanged; + + BackButton.Click += OnBackClicked; + BackButton.Visibility = Visibility.Collapsed; + } + else + { + // Title bar customization using these APIs is currently + // supported only on Windows 11. In other cases, hide + // the custom title bar element. + // AppTitleBar.Visibility = Visibility.Collapsed; + // TODO Show alternative UI for any functionality in + // the title bar, such as the back button, if used + } + } + + public Button BackButton => AppTitleBarBackButton; + + private void AppTitleBar_Loaded(object sender, RoutedEventArgs e) + { + SetTitleBar(AppTitleBar); + // TODO Raname MainPage in case your app Main Page has a different name + PageFrame.Navigate(typeof(MainPage)); + if (AppWindowTitleBar.IsCustomizationSupported()) + { + SetDragRegionForCustomTitleBar(m_AppWindow); + } + } + + private void OnBackClicked(object sender, RoutedEventArgs e) + { + if (PageFrame.CanGoBack) + { + PageFrame.GoBack(); + } + } + + private void AppTitleBar_SizeChanged(object sender, SizeChangedEventArgs e) + { + if (AppWindowTitleBar.IsCustomizationSupported() + && m_AppWindow.TitleBar.ExtendsContentIntoTitleBar) + { + // Update drag region if the size of the title bar changes. + SetDragRegionForCustomTitleBar(m_AppWindow); + } + } + + private AppWindow GetAppWindowForCurrentWindow() + { + IntPtr hWnd = WindowNative.GetWindowHandle(this); + WindowId wndId = Microsoft.UI.Win32Interop.GetWindowIdFromWindow(hWnd); + return AppWindow.GetFromWindowId(wndId); + } + + private void SetDragRegionForCustomTitleBar(AppWindow appWindow) + { + if (AppWindowTitleBar.IsCustomizationSupported() + && appWindow.TitleBar.ExtendsContentIntoTitleBar) + { + double scaleAdjustment = GetScaleAdjustment(); + + RightPaddingColumn.Width = new GridLength(appWindow.TitleBar.RightInset / scaleAdjustment); + LeftPaddingColumn.Width = new GridLength(appWindow.TitleBar.LeftInset / scaleAdjustment); + + List dragRectsList = new(); + + Windows.Graphics.RectInt32 dragRectL; + dragRectL.X = (int)((LeftPaddingColumn.ActualWidth + IconColumn.ActualWidth) * scaleAdjustment); + dragRectL.Y = 0; + dragRectL.Height = (int)((AppTitleBar.ActualHeight) * scaleAdjustment); + dragRectL.Width = (int)((TitleColumn.ActualWidth + + DragColumn.ActualWidth) * scaleAdjustment); + dragRectsList.Add(dragRectL); + + Windows.Graphics.RectInt32[] dragRects = dragRectsList.ToArray(); + appWindow.TitleBar.SetDragRectangles(dragRects); + } + } + + [DllImport("Shcore.dll", SetLastError = true)] + internal static extern int GetDpiForMonitor(IntPtr hmonitor, Monitor_DPI_Type dpiType, out uint dpiX, out uint dpiY); + + internal enum Monitor_DPI_Type : int + { + MDT_Effective_DPI = 0, + MDT_Angular_DPI = 1, + MDT_Raw_DPI = 2, + MDT_Default = MDT_Effective_DPI + } + + private double GetScaleAdjustment() + { + IntPtr hWnd = WindowNative.GetWindowHandle(this); + WindowId wndId = Win32Interop.GetWindowIdFromWindow(hWnd); + DisplayArea displayArea = DisplayArea.GetFromWindowId(wndId, DisplayAreaFallback.Primary); + IntPtr hMonitor = Win32Interop.GetMonitorFromDisplayId(displayArea.DisplayId); + + // Get DPI. + int result = GetDpiForMonitor(hMonitor, Monitor_DPI_Type.MDT_Default, out uint dpiX, out uint _); + if (result != 0) + { + throw new Exception("Could not get DPI for monitor."); + } + + uint scaleFactorPercent = (uint)(((long)dpiX * 100 + (96 >> 1)) / 96); + return scaleFactorPercent / 100.0; + } + } +} diff --git a/src/Files.Uwp/Package.appxmanifest b/src/Files.Uwp/Package.appxmanifest index e3e7e422d682..37aec4c5dd59 100644 --- a/src/Files.Uwp/Package.appxmanifest +++ b/src/Files.Uwp/Package.appxmanifest @@ -1,27 +1,21 @@  - Files UWP Luke Blevins Assets\StoreLogo.png - + - - - + + + diff --git a/src/Files.Uwp/Program.cs b/src/Files.Uwp/Program.cs index 17b4d6338f95..5251d05e0f89 100644 --- a/src/Files.Uwp/Program.cs +++ b/src/Files.Uwp/Program.cs @@ -1,4 +1,4 @@ -using Files.Uwp.CommandLine; +using Files.Uwp.CommandLine; using Files.Shared; using Files.Uwp.Helpers; using Files.Shared.Extensions; @@ -8,7 +8,7 @@ using Windows.ApplicationModel; using Windows.ApplicationModel.Activation; using Windows.Storage; -using Windows.UI.Xaml; +using Microsoft.UI.Xaml; namespace Files.Uwp { diff --git a/src/Files.Uwp/Properties/AssemblyInfo.cs b/src/Files.Uwp/Properties/AssemblyInfo.cs deleted file mode 100644 index b40e9b6de955..000000000000 --- a/src/Files.Uwp/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System.Reflection; -using System.Resources; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Files")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Files")] -[assembly: AssemblyCopyright("Copyright © 2019")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] -[assembly: ComVisible(false)] -[assembly: NeutralResourcesLanguage("en-US")] \ No newline at end of file diff --git a/src/Files.Uwp/Serialization/BaseJsonSettings.cs b/src/Files.Uwp/Serialization/BaseJsonSettings.cs index 70aed3881384..c26ee23bfba9 100644 --- a/src/Files.Uwp/Serialization/BaseJsonSettings.cs +++ b/src/Files.Uwp/Serialization/BaseJsonSettings.cs @@ -1,4 +1,4 @@ -using Files.Shared.EventArguments; +using Files.Shared.EventArguments; using System; using System.Runtime.CompilerServices; diff --git a/src/Files.Uwp/Serialization/BaseObservableJsonSettings.cs b/src/Files.Uwp/Serialization/BaseObservableJsonSettings.cs index cbd2f2c085ff..60f8a92b5232 100644 --- a/src/Files.Uwp/Serialization/BaseObservableJsonSettings.cs +++ b/src/Files.Uwp/Serialization/BaseObservableJsonSettings.cs @@ -1,4 +1,4 @@ -using System.ComponentModel; +using System.ComponentModel; using System.Runtime.CompilerServices; #nullable enable diff --git a/src/Files.Uwp/Serialization/IJsonSettingsDatabase.cs b/src/Files.Uwp/Serialization/IJsonSettingsDatabase.cs index 57082e0e1e9a..1adfcec10647 100644 --- a/src/Files.Uwp/Serialization/IJsonSettingsDatabase.cs +++ b/src/Files.Uwp/Serialization/IJsonSettingsDatabase.cs @@ -1,4 +1,4 @@ -#nullable enable +#nullable enable namespace Files.Uwp.Serialization { diff --git a/src/Files.Uwp/Serialization/IJsonSettingsSerializer.cs b/src/Files.Uwp/Serialization/IJsonSettingsSerializer.cs index e85fa1bbb6c0..9aadac612593 100644 --- a/src/Files.Uwp/Serialization/IJsonSettingsSerializer.cs +++ b/src/Files.Uwp/Serialization/IJsonSettingsSerializer.cs @@ -1,4 +1,4 @@ -#nullable enable +#nullable enable namespace Files.Uwp.Serialization { diff --git a/src/Files.Uwp/Serialization/ISettingsSerializer.cs b/src/Files.Uwp/Serialization/ISettingsSerializer.cs index 84f393b02d22..4f178a068a53 100644 --- a/src/Files.Uwp/Serialization/ISettingsSerializer.cs +++ b/src/Files.Uwp/Serialization/ISettingsSerializer.cs @@ -1,4 +1,4 @@ -#nullable enable +#nullable enable namespace Files.Uwp.Serialization { diff --git a/src/Files.Uwp/Serialization/ISettingsSharingContext.cs b/src/Files.Uwp/Serialization/ISettingsSharingContext.cs index 0baba0424b86..d589506bc4f2 100644 --- a/src/Files.Uwp/Serialization/ISettingsSharingContext.cs +++ b/src/Files.Uwp/Serialization/ISettingsSharingContext.cs @@ -1,4 +1,4 @@ -namespace Files.Uwp.Serialization +namespace Files.Uwp.Serialization { public interface ISettingsSharingContext { diff --git a/src/Files.Uwp/Serialization/Implementation/CachingJsonSettingsDatabase.cs b/src/Files.Uwp/Serialization/Implementation/CachingJsonSettingsDatabase.cs index ab209722b107..dcc73c0b75a4 100644 --- a/src/Files.Uwp/Serialization/Implementation/CachingJsonSettingsDatabase.cs +++ b/src/Files.Uwp/Serialization/Implementation/CachingJsonSettingsDatabase.cs @@ -1,4 +1,4 @@ -using System.Collections; +using System.Collections; using System.Collections.Generic; using System.Linq; diff --git a/src/Files.Uwp/Serialization/Implementation/DefaultJsonSettingsDatabase.cs b/src/Files.Uwp/Serialization/Implementation/DefaultJsonSettingsDatabase.cs index f3fc07e471fb..155faf948652 100644 --- a/src/Files.Uwp/Serialization/Implementation/DefaultJsonSettingsDatabase.cs +++ b/src/Files.Uwp/Serialization/Implementation/DefaultJsonSettingsDatabase.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Diagnostics; using Newtonsoft.Json.Linq; diff --git a/src/Files.Uwp/Serialization/Implementation/DefaultJsonSettingsSerializer.cs b/src/Files.Uwp/Serialization/Implementation/DefaultJsonSettingsSerializer.cs index c6f66dabb995..5639b7e7b1b0 100644 --- a/src/Files.Uwp/Serialization/Implementation/DefaultJsonSettingsSerializer.cs +++ b/src/Files.Uwp/Serialization/Implementation/DefaultJsonSettingsSerializer.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using Newtonsoft.Json; #nullable enable diff --git a/src/Files.Uwp/Serialization/Implementation/DefaultSettingsSerializer.cs b/src/Files.Uwp/Serialization/Implementation/DefaultSettingsSerializer.cs index db0148c1683a..dcbe74b9bb0b 100644 --- a/src/Files.Uwp/Serialization/Implementation/DefaultSettingsSerializer.cs +++ b/src/Files.Uwp/Serialization/Implementation/DefaultSettingsSerializer.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; using Files.Shared.Extensions; diff --git a/src/Files.Uwp/ServicesImplementation/DateTimeFormatter/AbstractDateTimeFormatter.cs b/src/Files.Uwp/ServicesImplementation/DateTimeFormatter/AbstractDateTimeFormatter.cs index ce036db3c26f..764e435ce9a3 100644 --- a/src/Files.Uwp/ServicesImplementation/DateTimeFormatter/AbstractDateTimeFormatter.cs +++ b/src/Files.Uwp/ServicesImplementation/DateTimeFormatter/AbstractDateTimeFormatter.cs @@ -1,4 +1,4 @@ -using Files.Shared.Services.DateTimeFormatter; +using Files.Shared.Services.DateTimeFormatter; using Microsoft.Toolkit.Uwp; using System; using System.Globalization; diff --git a/src/Files.Uwp/ServicesImplementation/DateTimeFormatter/ApplicationDateTimeFormatter.cs b/src/Files.Uwp/ServicesImplementation/DateTimeFormatter/ApplicationDateTimeFormatter.cs index cb8eea556aa9..4e6506ebe037 100644 --- a/src/Files.Uwp/ServicesImplementation/DateTimeFormatter/ApplicationDateTimeFormatter.cs +++ b/src/Files.Uwp/ServicesImplementation/DateTimeFormatter/ApplicationDateTimeFormatter.cs @@ -1,4 +1,4 @@ -using Microsoft.Toolkit.Uwp; +using Microsoft.Toolkit.Uwp; using System; namespace Files.Uwp.ServicesImplementation.DateTimeFormatter diff --git a/src/Files.Uwp/ServicesImplementation/DateTimeFormatter/DateTimeFormatterFactory.cs b/src/Files.Uwp/ServicesImplementation/DateTimeFormatter/DateTimeFormatterFactory.cs index b3f407cb19a5..39a8b2d22802 100644 --- a/src/Files.Uwp/ServicesImplementation/DateTimeFormatter/DateTimeFormatterFactory.cs +++ b/src/Files.Uwp/ServicesImplementation/DateTimeFormatter/DateTimeFormatterFactory.cs @@ -1,4 +1,4 @@ -using Files.Shared.Enums; +using Files.Shared.Enums; using Files.Shared.Services.DateTimeFormatter; using System; diff --git a/src/Files.Uwp/ServicesImplementation/DateTimeFormatter/SystemDateTimeFormatter.cs b/src/Files.Uwp/ServicesImplementation/DateTimeFormatter/SystemDateTimeFormatter.cs index a2ec6db03648..8b3378ec23ff 100644 --- a/src/Files.Uwp/ServicesImplementation/DateTimeFormatter/SystemDateTimeFormatter.cs +++ b/src/Files.Uwp/ServicesImplementation/DateTimeFormatter/SystemDateTimeFormatter.cs @@ -1,4 +1,4 @@ -using Microsoft.Toolkit.Uwp; +using Microsoft.Toolkit.Uwp; using System; namespace Files.Uwp.ServicesImplementation.DateTimeFormatter diff --git a/src/Files.Uwp/ServicesImplementation/DateTimeFormatter/UniversalDateTimeFormatter.cs b/src/Files.Uwp/ServicesImplementation/DateTimeFormatter/UniversalDateTimeFormatter.cs index 832e6e99dc0c..802b88b6ca11 100644 --- a/src/Files.Uwp/ServicesImplementation/DateTimeFormatter/UniversalDateTimeFormatter.cs +++ b/src/Files.Uwp/ServicesImplementation/DateTimeFormatter/UniversalDateTimeFormatter.cs @@ -1,4 +1,4 @@ -using Microsoft.Toolkit.Uwp; +using Microsoft.Toolkit.Uwp; using System; namespace Files.Uwp.ServicesImplementation.DateTimeFormatter diff --git a/src/Files.Uwp/ServicesImplementation/DateTimeFormatter/UserDateTimeFormatter.cs b/src/Files.Uwp/ServicesImplementation/DateTimeFormatter/UserDateTimeFormatter.cs index 438c3e9f25f9..f6dd7b29c69c 100644 --- a/src/Files.Uwp/ServicesImplementation/DateTimeFormatter/UserDateTimeFormatter.cs +++ b/src/Files.Uwp/ServicesImplementation/DateTimeFormatter/UserDateTimeFormatter.cs @@ -1,4 +1,4 @@ -using CommunityToolkit.Mvvm.DependencyInjection; +using CommunityToolkit.Mvvm.DependencyInjection; using Files.Shared.Services.DateTimeFormatter; using Files.Uwp.ViewModels; using System; diff --git a/src/Files.Uwp/ServicesImplementation/DialogService.cs b/src/Files.Uwp/ServicesImplementation/DialogService.cs index 5b9cd4ef2918..5090ea42079c 100644 --- a/src/Files.Uwp/ServicesImplementation/DialogService.cs +++ b/src/Files.Uwp/ServicesImplementation/DialogService.cs @@ -1,11 +1,11 @@ -using Files.Backend.ViewModels.Dialogs; +using Files.Backend.ViewModels.Dialogs; using Files.Backend.Services; using Files.Shared.Enums; using System; using System.Collections.Generic; using System.ComponentModel; using System.Threading.Tasks; -using Windows.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Controls; using Files.Uwp.ViewModels.Dialogs; using Files.Uwp.Dialogs; using Files.Backend.ViewModels.Dialogs.AddItemDialog; diff --git a/src/Files.Uwp/ServicesImplementation/FileExplorerService.cs b/src/Files.Uwp/ServicesImplementation/FileExplorerService.cs index 4bafc6af5b59..045933deef9c 100644 --- a/src/Files.Uwp/ServicesImplementation/FileExplorerService.cs +++ b/src/Files.Uwp/ServicesImplementation/FileExplorerService.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; @@ -32,7 +32,7 @@ public async Task OpenInFileExplorerAsync(ILocatableFolder folder, CancellationT /// public async Task PickSingleFileAsync(IEnumerable? filter, CancellationToken cancellationToken = default) { - var filePicker = new FileOpenPicker(); + var filePicker = this.InitializeWithWindow(new FileOpenPicker()); if (filter is not null) { @@ -51,11 +51,16 @@ public async Task OpenInFileExplorerAsync(ILocatableFolder folder, CancellationT return new WindowsStorageFile(file); } + private FileOpenPicker InitializeWithWindow(FileOpenPicker obj) + { + WinRT.Interop.InitializeWithWindow.Initialize(obj, App.WindowHandle); + return obj; + } /// public async Task PickSingleFolderAsync(CancellationToken cancellationToken = default) { - var folderPicker = new FolderPicker(); + var folderPicker = this.InitializeWithWindow(new FolderPicker()); folderPicker.FileTypeFilter.Add("*"); @@ -67,5 +72,10 @@ public async Task OpenInFileExplorerAsync(ILocatableFolder folder, CancellationT return new WindowsStorageFolder(folder); } + private FolderPicker InitializeWithWindow(FolderPicker obj) + { + WinRT.Interop.InitializeWithWindow.Initialize(obj, App.WindowHandle); + return obj; + } } } diff --git a/src/Files.Uwp/ServicesImplementation/ImagingService.cs b/src/Files.Uwp/ServicesImplementation/ImagingService.cs index 8d98aeac4f69..51638cf007f4 100644 --- a/src/Files.Uwp/ServicesImplementation/ImagingService.cs +++ b/src/Files.Uwp/ServicesImplementation/ImagingService.cs @@ -1,4 +1,4 @@ -using Files.Backend.Models.Imaging; +using Files.Backend.Models.Imaging; using Files.Backend.Services; using Files.Uwp.Helpers; using Files.Uwp.Imaging; diff --git a/src/Files.Uwp/ServicesImplementation/LocalizationService.cs b/src/Files.Uwp/ServicesImplementation/LocalizationService.cs index b58fbc34beba..0e6d2db3f385 100644 --- a/src/Files.Uwp/ServicesImplementation/LocalizationService.cs +++ b/src/Files.Uwp/ServicesImplementation/LocalizationService.cs @@ -1,4 +1,4 @@ -using Files.Backend.Services; +using Files.Backend.Services; using Microsoft.Toolkit.Uwp; namespace Files.Uwp.ServicesImplementation diff --git a/src/Files.Uwp/ServicesImplementation/Settings/AppearanceSettingsService.cs b/src/Files.Uwp/ServicesImplementation/Settings/AppearanceSettingsService.cs index 2a7f20d1c888..968c3f02b369 100644 --- a/src/Files.Uwp/ServicesImplementation/Settings/AppearanceSettingsService.cs +++ b/src/Files.Uwp/ServicesImplementation/Settings/AppearanceSettingsService.cs @@ -1,4 +1,4 @@ -using Files.Backend.Services.Settings; +using Files.Backend.Services.Settings; using Files.Shared.EventArguments; using Files.Uwp.Serialization; using Microsoft.AppCenter.Analytics; diff --git a/src/Files.Uwp/ServicesImplementation/Settings/ApplicationSettingsService.cs b/src/Files.Uwp/ServicesImplementation/Settings/ApplicationSettingsService.cs index c31040d6d30e..f40e99b14f0e 100644 --- a/src/Files.Uwp/ServicesImplementation/Settings/ApplicationSettingsService.cs +++ b/src/Files.Uwp/ServicesImplementation/Settings/ApplicationSettingsService.cs @@ -1,4 +1,4 @@ -using Files.Backend.Services.Settings; +using Files.Backend.Services.Settings; using Files.Shared.Enums; using Files.Uwp.Serialization; diff --git a/src/Files.Uwp/ServicesImplementation/Settings/BundlesSettingsService.cs b/src/Files.Uwp/ServicesImplementation/Settings/BundlesSettingsService.cs index c87df53fdf1a..9379acc7d264 100644 --- a/src/Files.Uwp/ServicesImplementation/Settings/BundlesSettingsService.cs +++ b/src/Files.Uwp/ServicesImplementation/Settings/BundlesSettingsService.cs @@ -1,4 +1,4 @@ -using Files.Backend.Services.Settings; +using Files.Backend.Services.Settings; using Files.Uwp.Serialization; using Files.Uwp.Serialization.Implementation; using System; diff --git a/src/Files.Uwp/ServicesImplementation/Settings/FileTagsSettingsService.cs b/src/Files.Uwp/ServicesImplementation/Settings/FileTagsSettingsService.cs index 412dbaa39465..329fcb0c8804 100644 --- a/src/Files.Uwp/ServicesImplementation/Settings/FileTagsSettingsService.cs +++ b/src/Files.Uwp/ServicesImplementation/Settings/FileTagsSettingsService.cs @@ -1,4 +1,4 @@ -using Files.Backend.Services.Settings; +using Files.Backend.Services.Settings; using Files.Backend.ViewModels.FileTags; using Files.Uwp.Serialization; using Files.Uwp.Serialization.Implementation; diff --git a/src/Files.Uwp/ServicesImplementation/Settings/LayoutSettingsService.cs b/src/Files.Uwp/ServicesImplementation/Settings/LayoutSettingsService.cs index 0063fe11c4e3..6ff6eb70a45c 100644 --- a/src/Files.Uwp/ServicesImplementation/Settings/LayoutSettingsService.cs +++ b/src/Files.Uwp/ServicesImplementation/Settings/LayoutSettingsService.cs @@ -1,4 +1,4 @@ -using Files.Backend.Services.Settings; +using Files.Backend.Services.Settings; using Files.Shared.Enums; using Files.Uwp.Serialization; diff --git a/src/Files.Uwp/ServicesImplementation/Settings/MultitaskingSettingsService.cs b/src/Files.Uwp/ServicesImplementation/Settings/MultitaskingSettingsService.cs index 7bd1f752577d..b5b222a489c7 100644 --- a/src/Files.Uwp/ServicesImplementation/Settings/MultitaskingSettingsService.cs +++ b/src/Files.Uwp/ServicesImplementation/Settings/MultitaskingSettingsService.cs @@ -1,4 +1,4 @@ -using Files.Backend.Services.Settings; +using Files.Backend.Services.Settings; using Files.Uwp.Serialization; using Files.Shared.EventArguments; using Microsoft.AppCenter.Analytics; diff --git a/src/Files.Uwp/ServicesImplementation/Settings/PaneSettingsService.cs b/src/Files.Uwp/ServicesImplementation/Settings/PaneSettingsService.cs index c488702ce3cc..e06ab14eb92a 100644 --- a/src/Files.Uwp/ServicesImplementation/Settings/PaneSettingsService.cs +++ b/src/Files.Uwp/ServicesImplementation/Settings/PaneSettingsService.cs @@ -1,4 +1,4 @@ -using Files.Backend.Services.Settings; +using Files.Backend.Services.Settings; using Files.Shared.Enums; using Files.Shared.EventArguments; using Files.Uwp.Serialization; diff --git a/src/Files.Uwp/ServicesImplementation/Settings/PreferencesSettingsService.cs b/src/Files.Uwp/ServicesImplementation/Settings/PreferencesSettingsService.cs index 438df6e9f544..5e0d48a500ba 100644 --- a/src/Files.Uwp/ServicesImplementation/Settings/PreferencesSettingsService.cs +++ b/src/Files.Uwp/ServicesImplementation/Settings/PreferencesSettingsService.cs @@ -1,4 +1,4 @@ -using Files.Backend.Services.Settings; +using Files.Backend.Services.Settings; using Files.Shared.EventArguments; using Files.Uwp.Serialization; using Microsoft.AppCenter.Analytics; diff --git a/src/Files.Uwp/ServicesImplementation/Settings/UserSettingsService.cs b/src/Files.Uwp/ServicesImplementation/Settings/UserSettingsService.cs index 9771488087e5..ae352d68d0c4 100644 --- a/src/Files.Uwp/ServicesImplementation/Settings/UserSettingsService.cs +++ b/src/Files.Uwp/ServicesImplementation/Settings/UserSettingsService.cs @@ -1,4 +1,4 @@ -using CommunityToolkit.Mvvm.DependencyInjection; +using CommunityToolkit.Mvvm.DependencyInjection; using Files.Backend.Services.Settings; using Files.Shared.EventArguments; using Files.Shared.Extensions; diff --git a/src/Files.Uwp/ServicesImplementation/Settings/WidgetsSettingsService.cs b/src/Files.Uwp/ServicesImplementation/Settings/WidgetsSettingsService.cs index cdf364beb555..94cbce396bbf 100644 --- a/src/Files.Uwp/ServicesImplementation/Settings/WidgetsSettingsService.cs +++ b/src/Files.Uwp/ServicesImplementation/Settings/WidgetsSettingsService.cs @@ -1,4 +1,4 @@ -using Files.Backend.Services.Settings; +using Files.Backend.Services.Settings; using Files.Shared.EventArguments; using Files.Uwp.Serialization; using Microsoft.AppCenter.Analytics; diff --git a/src/Files.Uwp/ServicesImplementation/SideloadUpdateService.cs b/src/Files.Uwp/ServicesImplementation/SideloadUpdateService.cs index 6c2298b6a338..d9a747a3fa00 100644 --- a/src/Files.Uwp/ServicesImplementation/SideloadUpdateService.cs +++ b/src/Files.Uwp/ServicesImplementation/SideloadUpdateService.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; diff --git a/src/Files.Uwp/ServicesImplementation/ThreadingService.cs b/src/Files.Uwp/ServicesImplementation/ThreadingService.cs index 140cf7db2fe7..db486715884f 100644 --- a/src/Files.Uwp/ServicesImplementation/ThreadingService.cs +++ b/src/Files.Uwp/ServicesImplementation/ThreadingService.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Threading.Tasks; using Files.Backend.Services; using Microsoft.Toolkit.Uwp; diff --git a/src/Files.Uwp/ServicesImplementation/UpdateService.cs b/src/Files.Uwp/ServicesImplementation/UpdateService.cs index 8bcce1505244..ede6c20d4418 100644 --- a/src/Files.Uwp/ServicesImplementation/UpdateService.cs +++ b/src/Files.Uwp/ServicesImplementation/UpdateService.cs @@ -1,10 +1,10 @@ -using System; +using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Threading.Tasks; using Windows.Services.Store; -using Windows.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Controls; using CommunityToolkit.Mvvm.ComponentModel; using Files.Backend.Services; using Microsoft.Toolkit.Uwp; @@ -139,10 +139,18 @@ private static async Task ShowDialogAsync() CloseButtonText = "Close".GetLocalized(), PrimaryButtonText = "ConsentDialogPrimaryButtonText".GetLocalized() }; - ContentDialogResult result = await dialog.ShowAsync(); + ContentDialogResult result = await this.SetContentDialogRoot(dialog).ShowAsync(); return result == ContentDialogResult.Primary; } + private ContentDialog SetContentDialogRoot(ContentDialog contentDialog) + { + if (Windows.Foundation.Metadata.ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 8)) + { + contentDialog.XamlRoot = this.Content.XamlRoot; + } + return contentDialog; + } private bool HasUpdates() { diff --git a/src/Files.Uwp/ServicesImplementation/UserSizeProvider.cs b/src/Files.Uwp/ServicesImplementation/UserSizeProvider.cs index ec8122aa95db..59b75dcbb76c 100644 --- a/src/Files.Uwp/ServicesImplementation/UserSizeProvider.cs +++ b/src/Files.Uwp/ServicesImplementation/UserSizeProvider.cs @@ -1,4 +1,4 @@ -using CommunityToolkit.Mvvm.DependencyInjection; +using CommunityToolkit.Mvvm.DependencyInjection; using Files.Backend.Services.Settings; using Files.Backend.Services.SizeProvider; using System; diff --git a/src/Files.Uwp/ServicesImplementation/VolumeInfoFactory.cs b/src/Files.Uwp/ServicesImplementation/VolumeInfoFactory.cs index d1c9445cf02a..03cd349a5dba 100644 --- a/src/Files.Uwp/ServicesImplementation/VolumeInfoFactory.cs +++ b/src/Files.Uwp/ServicesImplementation/VolumeInfoFactory.cs @@ -1,4 +1,4 @@ -using Files.Backend.Models; +using Files.Backend.Models; using Files.Backend.Services; using Files.Shared.Extensions; using Files.Uwp.Helpers; diff --git a/src/Files.Uwp/TemplateSelectors/BaseTemplateSelector.cs b/src/Files.Uwp/TemplateSelectors/BaseTemplateSelector.cs index a1e89fe53a8d..dcc0eabfe06c 100644 --- a/src/Files.Uwp/TemplateSelectors/BaseTemplateSelector.cs +++ b/src/Files.Uwp/TemplateSelectors/BaseTemplateSelector.cs @@ -1,5 +1,5 @@ -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; namespace Files.Uwp.TemplateSelectors { diff --git a/src/Files.Uwp/TemplateSelectors/FileSystemDialogItemSelector.cs b/src/Files.Uwp/TemplateSelectors/FileSystemDialogItemSelector.cs index 9885233f4fef..8744ee4558ad 100644 --- a/src/Files.Uwp/TemplateSelectors/FileSystemDialogItemSelector.cs +++ b/src/Files.Uwp/TemplateSelectors/FileSystemDialogItemSelector.cs @@ -1,5 +1,5 @@ -using Files.Backend.ViewModels.Dialogs.FileSystemDialog; -using Windows.UI.Xaml; +using Files.Backend.ViewModels.Dialogs.FileSystemDialog; +using Microsoft.UI.Xaml; namespace Files.Uwp.TemplateSelectors { diff --git a/src/Files.Uwp/UWPToWinAppSDKUpgradeHelpers.cs b/src/Files.Uwp/UWPToWinAppSDKUpgradeHelpers.cs new file mode 100644 index 000000000000..afad8ceb9bb6 --- /dev/null +++ b/src/Files.Uwp/UWPToWinAppSDKUpgradeHelpers.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace UWPToWinAppSDKUpgradeHelpers +{ + [System.Runtime.InteropServices.ComImport] + [System.Runtime.InteropServices.Guid("3A3DCD6C-3EAB-43DC-BCDE-45671CE800C8")] + [System.Runtime.InteropServices.InterfaceType( + System.Runtime.InteropServices.ComInterfaceType.InterfaceIsIUnknown)] + interface IDataTransferManagerInterop + { + IntPtr GetForWindow([System.Runtime.InteropServices.In] IntPtr appWindow, + [System.Runtime.InteropServices.In] ref Guid riid); + void ShowShareUIForWindow(IntPtr appWindow); + } +} diff --git a/src/Files.Uwp/UserControls/AddressToolbar.xaml.cs b/src/Files.Uwp/UserControls/AddressToolbar.xaml.cs index 5968d6de243e..75957796fa7b 100644 --- a/src/Files.Uwp/UserControls/AddressToolbar.xaml.cs +++ b/src/Files.Uwp/UserControls/AddressToolbar.xaml.cs @@ -2,10 +2,10 @@ using Files.Uwp.ViewModels; using System.Windows.Input; using Windows.System; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Controls.Primitives; -using Windows.UI.Xaml.Input; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Controls.Primitives; +using Microsoft.UI.Xaml.Input; namespace Files.Uwp.UserControls { @@ -152,12 +152,12 @@ private void OngoingTasksActions_ProgressBannerPosted(object sender, PostedStatu if (AppSettings.ShowOngoingTasksTeachingTip) { OngoingTasksTeachingTip.IsOpen = true; - OngoingTasksTeachingTip.Visibility = Windows.UI.Xaml.Visibility.Visible; + OngoingTasksTeachingTip.Visibility = Microsoft.UI.Xaml.Visibility.Visible; AppSettings.ShowOngoingTasksTeachingTip = false; } else { - OngoingTasksTeachingTip.Visibility = Windows.UI.Xaml.Visibility.Collapsed; + OngoingTasksTeachingTip.Visibility = Microsoft.UI.Xaml.Visibility.Collapsed; OngoingTasksTeachingTip.IsOpen = false; } } diff --git a/src/Files.Uwp/UserControls/ColoredIcon.xaml.cs b/src/Files.Uwp/UserControls/ColoredIcon.xaml.cs index 68e89ed1f410..81520e3d3e90 100644 --- a/src/Files.Uwp/UserControls/ColoredIcon.xaml.cs +++ b/src/Files.Uwp/UserControls/ColoredIcon.xaml.cs @@ -1,6 +1,6 @@ -using Microsoft.Toolkit.Uwp.UI; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; +using Microsoft.Toolkit.Uwp.UI; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; // The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236 diff --git a/src/Files.Uwp/UserControls/DataGridHeader.xaml.cs b/src/Files.Uwp/UserControls/DataGridHeader.xaml.cs index 609e690a1357..2419eb06d2ee 100644 --- a/src/Files.Uwp/UserControls/DataGridHeader.xaml.cs +++ b/src/Files.Uwp/UserControls/DataGridHeader.xaml.cs @@ -1,9 +1,9 @@ -using Files.Shared.Enums; +using Files.Shared.Enums; using System.ComponentModel; using System.Runtime.CompilerServices; using System.Windows.Input; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; // Il modello di elemento Controllo utente è documentato all'indirizzo https://go.microsoft.com/fwlink/?LinkId=234236 diff --git a/src/Files.Uwp/UserControls/FileIcon.xaml.cs b/src/Files.Uwp/UserControls/FileIcon.xaml.cs index 776d0355a425..c4f788f19138 100644 --- a/src/Files.Uwp/UserControls/FileIcon.xaml.cs +++ b/src/Files.Uwp/UserControls/FileIcon.xaml.cs @@ -1,10 +1,10 @@ -using Files.Uwp.ViewModels; +using Files.Uwp.ViewModels; using System; using System.Runtime.InteropServices.WindowsRuntime; using Windows.Storage.Streams; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Media.Imaging; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Media.Imaging; namespace Files.Uwp.UserControls { diff --git a/src/Files.Uwp/UserControls/FilePreviews/BasicPreview.xaml.cs b/src/Files.Uwp/UserControls/FilePreviews/BasicPreview.xaml.cs index 08c6d5ad8736..e383d1094474 100644 --- a/src/Files.Uwp/UserControls/FilePreviews/BasicPreview.xaml.cs +++ b/src/Files.Uwp/UserControls/FilePreviews/BasicPreview.xaml.cs @@ -1,5 +1,5 @@ -using Files.Uwp.ViewModels.Previews; -using Windows.UI.Xaml.Controls; +using Files.Uwp.ViewModels.Previews; +using Microsoft.UI.Xaml.Controls; // The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236 diff --git a/src/Files.Uwp/UserControls/FilePreviews/CodePreview.xaml.cs b/src/Files.Uwp/UserControls/FilePreviews/CodePreview.xaml.cs index 7abe1a4b2b88..4853e9f3f324 100644 --- a/src/Files.Uwp/UserControls/FilePreviews/CodePreview.xaml.cs +++ b/src/Files.Uwp/UserControls/FilePreviews/CodePreview.xaml.cs @@ -1,7 +1,7 @@ -using ColorCode; +using ColorCode; using Files.Uwp.ViewModels.Previews; using System; -using Windows.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Controls; // The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236 @@ -30,12 +30,12 @@ private void RenderDocument() } } - private void UserControl_Loaded(object sender, Windows.UI.Xaml.RoutedEventArgs e) + private void UserControl_Loaded(object sender, Microsoft.UI.Xaml.RoutedEventArgs e) { RenderDocument(); } - private void UserControl_ActualThemeChanged(Windows.UI.Xaml.FrameworkElement sender, object args) + private void UserControl_ActualThemeChanged(Microsoft.UI.Xaml.FrameworkElement sender, object args) { try { diff --git a/src/Files.Uwp/UserControls/FilePreviews/FolderPreview.xaml.cs b/src/Files.Uwp/UserControls/FilePreviews/FolderPreview.xaml.cs index 02f353fac165..ea0567bf82b7 100644 --- a/src/Files.Uwp/UserControls/FilePreviews/FolderPreview.xaml.cs +++ b/src/Files.Uwp/UserControls/FilePreviews/FolderPreview.xaml.cs @@ -1,5 +1,5 @@ -using Files.Uwp.ViewModels.Previews; -using Windows.UI.Xaml.Controls; +using Files.Uwp.ViewModels.Previews; +using Microsoft.UI.Xaml.Controls; // The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236 diff --git a/src/Files.Uwp/UserControls/FilePreviews/HtmlPreview.xaml.cs b/src/Files.Uwp/UserControls/FilePreviews/HtmlPreview.xaml.cs index a35fab6a9939..a7d7c2832092 100644 --- a/src/Files.Uwp/UserControls/FilePreviews/HtmlPreview.xaml.cs +++ b/src/Files.Uwp/UserControls/FilePreviews/HtmlPreview.xaml.cs @@ -1,5 +1,5 @@ -using Files.Uwp.ViewModels.Previews; -using Windows.UI.Xaml.Controls; +using Files.Uwp.ViewModels.Previews; +using Microsoft.UI.Xaml.Controls; // The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236 @@ -17,7 +17,7 @@ public HtmlPreview(HtmlPreviewViewModel model) public HtmlPreviewViewModel ViewModel { get; set; } - private void WebViewControl_Loaded(object sender, Windows.UI.Xaml.RoutedEventArgs e) + private void WebViewControl_Loaded(object sender, Microsoft.UI.Xaml.RoutedEventArgs e) { WebViewControl.NavigateToString(ViewModel.TextValue); } diff --git a/src/Files.Uwp/UserControls/FilePreviews/ImagePreview.xaml.cs b/src/Files.Uwp/UserControls/FilePreviews/ImagePreview.xaml.cs index a88451a97be1..caaa04b04f47 100644 --- a/src/Files.Uwp/UserControls/FilePreviews/ImagePreview.xaml.cs +++ b/src/Files.Uwp/UserControls/FilePreviews/ImagePreview.xaml.cs @@ -1,5 +1,5 @@ -using Files.Uwp.ViewModels.Previews; -using Windows.UI.Xaml.Controls; +using Files.Uwp.ViewModels.Previews; +using Microsoft.UI.Xaml.Controls; // The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236 diff --git a/src/Files.Uwp/UserControls/FilePreviews/MarkdownPreview.xaml.cs b/src/Files.Uwp/UserControls/FilePreviews/MarkdownPreview.xaml.cs index 27865058799f..4b5f196bf62c 100644 --- a/src/Files.Uwp/UserControls/FilePreviews/MarkdownPreview.xaml.cs +++ b/src/Files.Uwp/UserControls/FilePreviews/MarkdownPreview.xaml.cs @@ -1,5 +1,5 @@ -using Files.Uwp.ViewModels.Previews; -using Windows.UI.Xaml.Controls; +using Files.Uwp.ViewModels.Previews; +using Microsoft.UI.Xaml.Controls; // To learn more about WinUI, the WinUI project structure, // and more about our project templates, see: http://aka.ms/winui-project-info. diff --git a/src/Files.Uwp/UserControls/FilePreviews/MediaPreview.xaml.cs b/src/Files.Uwp/UserControls/FilePreviews/MediaPreview.xaml.cs index 741c3508c047..6be226693d17 100644 --- a/src/Files.Uwp/UserControls/FilePreviews/MediaPreview.xaml.cs +++ b/src/Files.Uwp/UserControls/FilePreviews/MediaPreview.xaml.cs @@ -1,10 +1,10 @@ -using Files.Backend.Services.Settings; +using Files.Backend.Services.Settings; using Files.Uwp.ViewModels.Previews; using CommunityToolkit.Mvvm.DependencyInjection; using Windows.Media.Playback; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Input; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Input; using System; // The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236 diff --git a/src/Files.Uwp/UserControls/FilePreviews/PDFPreview.xaml.cs b/src/Files.Uwp/UserControls/FilePreviews/PDFPreview.xaml.cs index 3251f09e63e0..c4b0fc5ab458 100644 --- a/src/Files.Uwp/UserControls/FilePreviews/PDFPreview.xaml.cs +++ b/src/Files.Uwp/UserControls/FilePreviews/PDFPreview.xaml.cs @@ -1,5 +1,5 @@ -using Files.Uwp.ViewModels.Previews; -using Windows.UI.Xaml.Controls; +using Files.Uwp.ViewModels.Previews; +using Microsoft.UI.Xaml.Controls; // The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236 diff --git a/src/Files.Uwp/UserControls/FilePreviews/RichTextPreview.xaml.cs b/src/Files.Uwp/UserControls/FilePreviews/RichTextPreview.xaml.cs index 952e6ba74706..851c760793bc 100644 --- a/src/Files.Uwp/UserControls/FilePreviews/RichTextPreview.xaml.cs +++ b/src/Files.Uwp/UserControls/FilePreviews/RichTextPreview.xaml.cs @@ -1,5 +1,5 @@ -using Files.Uwp.ViewModels.Previews; -using Windows.UI.Xaml.Controls; +using Files.Uwp.ViewModels.Previews; +using Microsoft.UI.Xaml.Controls; // The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236 @@ -15,7 +15,7 @@ public RichTextPreview(RichTextPreviewViewModel viewModel) public RichTextPreviewViewModel ViewModel { get; set; } - private void TextPreviewControl_Loaded(object sender, Windows.UI.Xaml.RoutedEventArgs e) + private void TextPreviewControl_Loaded(object sender, Microsoft.UI.Xaml.RoutedEventArgs e) { TextPreviewControl.Document.LoadFromStream(Windows.UI.Text.TextSetOptions.FormatRtf, ViewModel.Stream); } diff --git a/src/Files.Uwp/UserControls/FilePreviews/TextPreview.xaml.cs b/src/Files.Uwp/UserControls/FilePreviews/TextPreview.xaml.cs index d23ad070fd2c..8afa44a2efe6 100644 --- a/src/Files.Uwp/UserControls/FilePreviews/TextPreview.xaml.cs +++ b/src/Files.Uwp/UserControls/FilePreviews/TextPreview.xaml.cs @@ -1,5 +1,5 @@ -using Files.Uwp.ViewModels.Previews; -using Windows.UI.Xaml.Controls; +using Files.Uwp.ViewModels.Previews; +using Microsoft.UI.Xaml.Controls; // To learn more about WinUI, the WinUI project structure, // and more about our project templates, see: http://aka.ms/winui-project-info. diff --git a/src/Files.Uwp/UserControls/FolderEmptyIndicator.xaml.cs b/src/Files.Uwp/UserControls/FolderEmptyIndicator.xaml.cs index 404ed5e8d9dc..02611a97c969 100644 --- a/src/Files.Uwp/UserControls/FolderEmptyIndicator.xaml.cs +++ b/src/Files.Uwp/UserControls/FolderEmptyIndicator.xaml.cs @@ -1,6 +1,6 @@ -using Microsoft.Toolkit.Uwp; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; +using Microsoft.Toolkit.Uwp; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; // The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236 diff --git a/src/Files.Uwp/UserControls/ImageFromBytes.cs b/src/Files.Uwp/UserControls/ImageFromBytes.cs index b94c7613f5fd..edddc93a5928 100644 --- a/src/Files.Uwp/UserControls/ImageFromBytes.cs +++ b/src/Files.Uwp/UserControls/ImageFromBytes.cs @@ -1,6 +1,6 @@ -using Files.Uwp.Helpers; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; +using Files.Uwp.Helpers; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; namespace Files.Uwp.UserControls { diff --git a/src/Files.Uwp/UserControls/InnerNavigationToolbar.xaml.cs b/src/Files.Uwp/UserControls/InnerNavigationToolbar.xaml.cs index 29afe7f63a83..35a17339dc54 100644 --- a/src/Files.Uwp/UserControls/InnerNavigationToolbar.xaml.cs +++ b/src/Files.Uwp/UserControls/InnerNavigationToolbar.xaml.cs @@ -1,4 +1,4 @@ -using CommunityToolkit.Mvvm.DependencyInjection; +using CommunityToolkit.Mvvm.DependencyInjection; using Files.Backend.Services.Settings; using Files.Uwp.Helpers; using Files.Uwp.ViewModels; @@ -7,10 +7,10 @@ using System.Linq; using System.Windows.Input; using Windows.UI.ViewManagement; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Input; -using Windows.UI.Xaml.Media.Imaging; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Input; +using Microsoft.UI.Xaml.Media.Imaging; // The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236 @@ -40,7 +40,12 @@ public ToolbarViewModel ViewModel private async void NavToolbarEnterCompactOverlay_Click(object sender, RoutedEventArgs e) { - var view = ApplicationView.GetForCurrentView(); + var view = + /* + TODO UA315_A Use Microsoft.UI.Windowing.AppWindow for window Management instead of ApplicationView/CoreWindow or Microsoft.UI.Windowing.AppWindow APIs + Read: https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/guides/windowing + */ + ApplicationView.GetForCurrentView(); if (view.ViewMode == ApplicationViewMode.CompactOverlay) { await view.TryEnterViewModeAsync(ApplicationViewMode.Default); diff --git a/src/Files.Uwp/UserControls/MenuFlyoutItemWithImage.xaml.cs b/src/Files.Uwp/UserControls/MenuFlyoutItemWithImage.xaml.cs index d3a0e11205a9..ed877e31c7ff 100644 --- a/src/Files.Uwp/UserControls/MenuFlyoutItemWithImage.xaml.cs +++ b/src/Files.Uwp/UserControls/MenuFlyoutItemWithImage.xaml.cs @@ -1,6 +1,6 @@ -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Media.Imaging; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Media.Imaging; // Il modello di elemento Controllo utente è documentato all'indirizzo https://go.microsoft.com/fwlink/?LinkId=234236 diff --git a/src/Files.Uwp/UserControls/Menus/FileTagsContextMenu.xaml.cs b/src/Files.Uwp/UserControls/Menus/FileTagsContextMenu.xaml.cs index 0d6b521dc4de..3f31568c3e39 100644 --- a/src/Files.Uwp/UserControls/Menus/FileTagsContextMenu.xaml.cs +++ b/src/Files.Uwp/UserControls/Menus/FileTagsContextMenu.xaml.cs @@ -1,8 +1,8 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Data; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Data; using CommunityToolkit.Mvvm.DependencyInjection; using Files.Backend.Services.Settings; using Files.Backend.ViewModels.FileTags; diff --git a/src/Files.Uwp/UserControls/MultitaskingControl/BaseMultitaskingControl.cs b/src/Files.Uwp/UserControls/MultitaskingControl/BaseMultitaskingControl.cs index 87a17f27b1fb..9ff23020dbe3 100644 --- a/src/Files.Uwp/UserControls/MultitaskingControl/BaseMultitaskingControl.cs +++ b/src/Files.Uwp/UserControls/MultitaskingControl/BaseMultitaskingControl.cs @@ -1,4 +1,4 @@ -using Files.Uwp.Helpers; +using Files.Uwp.Helpers; using Files.Uwp.ViewModels; using Microsoft.UI.Xaml.Controls; using System; @@ -7,8 +7,8 @@ using System.ComponentModel; using System.Linq; using System.Runtime.CompilerServices; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; namespace Files.Uwp.UserControls.MultitaskingControl { diff --git a/src/Files.Uwp/UserControls/MultitaskingControl/HorizontalMultitaskingControl.xaml.cs b/src/Files.Uwp/UserControls/MultitaskingControl/HorizontalMultitaskingControl.xaml.cs index cc37d955fa74..10370346924f 100644 --- a/src/Files.Uwp/UserControls/MultitaskingControl/HorizontalMultitaskingControl.xaml.cs +++ b/src/Files.Uwp/UserControls/MultitaskingControl/HorizontalMultitaskingControl.xaml.cs @@ -1,4 +1,4 @@ -using Files.Uwp.Helpers; +using Files.Uwp.Helpers; using Files.Uwp.ViewModels; using Microsoft.Toolkit.Uwp; using Microsoft.UI.Xaml.Controls; @@ -6,7 +6,7 @@ using System.Linq; using Windows.ApplicationModel.DataTransfer; using Windows.Storage; -using Windows.UI.Xaml; +using Microsoft.UI.Xaml; // The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236 diff --git a/src/Files.Uwp/UserControls/MultitaskingControl/IMultitaskingControl.cs b/src/Files.Uwp/UserControls/MultitaskingControl/IMultitaskingControl.cs index eb4bd6aaf24c..57d0486adf4d 100644 --- a/src/Files.Uwp/UserControls/MultitaskingControl/IMultitaskingControl.cs +++ b/src/Files.Uwp/UserControls/MultitaskingControl/IMultitaskingControl.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Collections.ObjectModel; diff --git a/src/Files.Uwp/UserControls/MultitaskingControl/TabItem/ITabItem.cs b/src/Files.Uwp/UserControls/MultitaskingControl/TabItem/ITabItem.cs index 1a8e9c49ccda..d5278e18ea14 100644 --- a/src/Files.Uwp/UserControls/MultitaskingControl/TabItem/ITabItem.cs +++ b/src/Files.Uwp/UserControls/MultitaskingControl/TabItem/ITabItem.cs @@ -1,6 +1,6 @@ -using System; +using System; using System.Threading.Tasks; -using Windows.UI.Xaml; +using Microsoft.UI.Xaml; namespace Files.Uwp.UserControls.MultitaskingControl { diff --git a/src/Files.Uwp/UserControls/MultitaskingControl/TabItem/ITabItemControl.cs b/src/Files.Uwp/UserControls/MultitaskingControl/TabItem/ITabItemControl.cs index 46a95e07d415..793c8aab3c83 100644 --- a/src/Files.Uwp/UserControls/MultitaskingControl/TabItem/ITabItemControl.cs +++ b/src/Files.Uwp/UserControls/MultitaskingControl/TabItem/ITabItemControl.cs @@ -1,4 +1,4 @@ -using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Controls; namespace Files.Uwp.UserControls.MultitaskingControl { diff --git a/src/Files.Uwp/UserControls/MultitaskingControl/TabItem/TabItem.cs b/src/Files.Uwp/UserControls/MultitaskingControl/TabItem/TabItem.cs index 82a0e952cc06..3393de9b98f7 100644 --- a/src/Files.Uwp/UserControls/MultitaskingControl/TabItem/TabItem.cs +++ b/src/Files.Uwp/UserControls/MultitaskingControl/TabItem/TabItem.cs @@ -1,4 +1,4 @@ -using Files.Uwp.ViewModels; +using Files.Uwp.ViewModels; using Files.Uwp.Views; using CommunityToolkit.Mvvm.ComponentModel; using Microsoft.UI.Xaml.Controls; diff --git a/src/Files.Uwp/UserControls/MultitaskingControl/TabItem/TabItemControl.xaml.cs b/src/Files.Uwp/UserControls/MultitaskingControl/TabItem/TabItemControl.xaml.cs index 5f8a5a8fdfca..afb3590d735a 100644 --- a/src/Files.Uwp/UserControls/MultitaskingControl/TabItem/TabItemControl.xaml.cs +++ b/src/Files.Uwp/UserControls/MultitaskingControl/TabItem/TabItemControl.xaml.cs @@ -1,5 +1,5 @@ -using System; -using Windows.UI.Xaml.Controls; +using System; +using Microsoft.UI.Xaml.Controls; namespace Files.Uwp.UserControls.MultitaskingControl { @@ -45,7 +45,7 @@ public TabItemControl() this.InitializeComponent(); } - private void ContentFrame_Navigated(object sender, Windows.UI.Xaml.Navigation.NavigationEventArgs e) + private void ContentFrame_Navigated(object sender, Microsoft.UI.Xaml.Navigation.NavigationEventArgs e) { if (TabItemContent != null) { diff --git a/src/Files.Uwp/UserControls/MultitaskingControl/VerticalTabViewControl.xaml.cs b/src/Files.Uwp/UserControls/MultitaskingControl/VerticalTabViewControl.xaml.cs index c5959f7b37cf..665daf5eaf78 100644 --- a/src/Files.Uwp/UserControls/MultitaskingControl/VerticalTabViewControl.xaml.cs +++ b/src/Files.Uwp/UserControls/MultitaskingControl/VerticalTabViewControl.xaml.cs @@ -1,11 +1,11 @@ -using Files.Uwp.Helpers; +using Files.Uwp.Helpers; using Files.Uwp.ViewModels; using Microsoft.Toolkit.Uwp; using Microsoft.UI.Xaml.Controls; using System; using Windows.ApplicationModel.DataTransfer; using Windows.Storage; -using Windows.UI.Xaml; +using Microsoft.UI.Xaml; namespace Files.Uwp.UserControls.MultitaskingControl { diff --git a/src/Files.Uwp/UserControls/OngoingTasksFlyout.xaml.cs b/src/Files.Uwp/UserControls/OngoingTasksFlyout.xaml.cs index fad46de1951c..7b3109f71ffc 100644 --- a/src/Files.Uwp/UserControls/OngoingTasksFlyout.xaml.cs +++ b/src/Files.Uwp/UserControls/OngoingTasksFlyout.xaml.cs @@ -1,8 +1,8 @@ -using Files.Uwp.ViewModels; +using Files.Uwp.ViewModels; using System; using System.Threading.Tasks; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; // The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236 diff --git a/src/Files.Uwp/UserControls/Pane/Pane.cs b/src/Files.Uwp/UserControls/Pane/Pane.cs index 30bce939ded6..f8f4a1873848 100644 --- a/src/Files.Uwp/UserControls/Pane/Pane.cs +++ b/src/Files.Uwp/UserControls/Pane/Pane.cs @@ -1,4 +1,4 @@ -namespace Files.Uwp.UserControls +namespace Files.Uwp.UserControls { public interface IPane { diff --git a/src/Files.Uwp/UserControls/Pane/PaneControl.xaml.cs b/src/Files.Uwp/UserControls/Pane/PaneControl.xaml.cs index f68dfe092d8c..be9137bc8ae0 100644 --- a/src/Files.Uwp/UserControls/Pane/PaneControl.xaml.cs +++ b/src/Files.Uwp/UserControls/Pane/PaneControl.xaml.cs @@ -1,8 +1,8 @@ -using Files.Shared.Enums; +using Files.Shared.Enums; using Files.Backend.Services.Settings; using CommunityToolkit.Mvvm.DependencyInjection; using System.ComponentModel; -using Windows.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Controls; namespace Files.Uwp.UserControls { diff --git a/src/Files.Uwp/UserControls/Pane/PreviewPane.xaml.cs b/src/Files.Uwp/UserControls/Pane/PreviewPane.xaml.cs index f4866246cf1f..66d0a6de0f14 100644 --- a/src/Files.Uwp/UserControls/Pane/PreviewPane.xaml.cs +++ b/src/Files.Uwp/UserControls/Pane/PreviewPane.xaml.cs @@ -1,11 +1,11 @@ -using Files.Backend.Services.Settings; +using Files.Backend.Services.Settings; using Files.Uwp.ViewModels; using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.DependencyInjection; using Microsoft.Toolkit.Uwp; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Input; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Input; namespace Files.Uwp.UserControls { diff --git a/src/Files.Uwp/UserControls/PathBreadcrumb.xaml.cs b/src/Files.Uwp/UserControls/PathBreadcrumb.xaml.cs index a880874a816d..c5375241f599 100644 --- a/src/Files.Uwp/UserControls/PathBreadcrumb.xaml.cs +++ b/src/Files.Uwp/UserControls/PathBreadcrumb.xaml.cs @@ -1,7 +1,7 @@ -using Files.Uwp.ViewModels; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Input; +using Files.Uwp.ViewModels; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Input; // The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236 diff --git a/src/Files.Uwp/UserControls/RestartControl.xaml.cs b/src/Files.Uwp/UserControls/RestartControl.xaml.cs index 2e8ad44be685..b12a2b70a0a4 100644 --- a/src/Files.Uwp/UserControls/RestartControl.xaml.cs +++ b/src/Files.Uwp/UserControls/RestartControl.xaml.cs @@ -1,8 +1,8 @@ -using System; +using System; using System.Diagnostics; using Windows.System; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; namespace Files.Uwp.UserControls { diff --git a/src/Files.Uwp/UserControls/SearchBox.xaml.cs b/src/Files.Uwp/UserControls/SearchBox.xaml.cs index 868b47829938..2607ff899e9b 100644 --- a/src/Files.Uwp/UserControls/SearchBox.xaml.cs +++ b/src/Files.Uwp/UserControls/SearchBox.xaml.cs @@ -1,7 +1,7 @@ -using Files.Uwp.ViewModels; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Input; +using Files.Uwp.ViewModels; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Input; namespace Files.Uwp.UserControls { diff --git a/src/Files.Uwp/UserControls/Selection/ExtendPreviousItemSelectionStrategy.cs b/src/Files.Uwp/UserControls/Selection/ExtendPreviousItemSelectionStrategy.cs index f37342b988b2..b8489e79d285 100644 --- a/src/Files.Uwp/UserControls/Selection/ExtendPreviousItemSelectionStrategy.cs +++ b/src/Files.Uwp/UserControls/Selection/ExtendPreviousItemSelectionStrategy.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Runtime.InteropServices; namespace Files.Uwp.UserControls.Selection diff --git a/src/Files.Uwp/UserControls/Selection/IgnorePreviousItemSelectionStrategy.cs b/src/Files.Uwp/UserControls/Selection/IgnorePreviousItemSelectionStrategy.cs index 8fed8d1754ae..7686ef345547 100644 --- a/src/Files.Uwp/UserControls/Selection/IgnorePreviousItemSelectionStrategy.cs +++ b/src/Files.Uwp/UserControls/Selection/IgnorePreviousItemSelectionStrategy.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Runtime.InteropServices; namespace Files.Uwp.UserControls.Selection diff --git a/src/Files.Uwp/UserControls/Selection/InvertPreviousItemSelectionStrategy.cs b/src/Files.Uwp/UserControls/Selection/InvertPreviousItemSelectionStrategy.cs index 5c18fce541fe..a41101c641c0 100644 --- a/src/Files.Uwp/UserControls/Selection/InvertPreviousItemSelectionStrategy.cs +++ b/src/Files.Uwp/UserControls/Selection/InvertPreviousItemSelectionStrategy.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Runtime.InteropServices; namespace Files.Uwp.UserControls.Selection diff --git a/src/Files.Uwp/UserControls/Selection/ItemSelectionStrategy.cs b/src/Files.Uwp/UserControls/Selection/ItemSelectionStrategy.cs index e2adf0e784a8..e48641a84c79 100644 --- a/src/Files.Uwp/UserControls/Selection/ItemSelectionStrategy.cs +++ b/src/Files.Uwp/UserControls/Selection/ItemSelectionStrategy.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; namespace Files.Uwp.UserControls.Selection { diff --git a/src/Files.Uwp/UserControls/Selection/RectangleSelection.cs b/src/Files.Uwp/UserControls/Selection/RectangleSelection.cs index 4636467e9fb0..c54a8f71d12f 100644 --- a/src/Files.Uwp/UserControls/Selection/RectangleSelection.cs +++ b/src/Files.Uwp/UserControls/Selection/RectangleSelection.cs @@ -1,9 +1,9 @@ -using System; +using System; using Windows.Foundation; using Windows.UI.Input; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Shapes; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Shapes; namespace Files.Uwp.UserControls.Selection { diff --git a/src/Files.Uwp/UserControls/Selection/RectangleSelection_ListViewBase.cs b/src/Files.Uwp/UserControls/Selection/RectangleSelection_ListViewBase.cs index 46e9dcd9aeb4..fb6bd28a2af6 100644 --- a/src/Files.Uwp/UserControls/Selection/RectangleSelection_ListViewBase.cs +++ b/src/Files.Uwp/UserControls/Selection/RectangleSelection_ListViewBase.cs @@ -1,14 +1,14 @@ -using Files.Uwp.Helpers.XamlHelpers; +using Files.Uwp.Helpers.XamlHelpers; using Microsoft.Toolkit.Uwp.UI; using System; using System.Collections.Generic; using System.Linq; using Windows.Foundation; using Windows.System; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Input; -using Windows.UI.Xaml.Shapes; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Input; +using Microsoft.UI.Xaml.Shapes; namespace Files.Uwp.UserControls.Selection { diff --git a/src/Files.Uwp/UserControls/Settings/SettingsBlockControl.xaml.cs b/src/Files.Uwp/UserControls/Settings/SettingsBlockControl.xaml.cs index 42ca7d749d8e..8eb2f53733ad 100644 --- a/src/Files.Uwp/UserControls/Settings/SettingsBlockControl.xaml.cs +++ b/src/Files.Uwp/UserControls/Settings/SettingsBlockControl.xaml.cs @@ -1,9 +1,9 @@ -using System; +using System; using System.Windows.Input; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Automation; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Markup; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Automation; +using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Markup; namespace Files.Uwp.UserControls.Settings { diff --git a/src/Files.Uwp/UserControls/Settings/SettingsDisplayControl.xaml.cs b/src/Files.Uwp/UserControls/Settings/SettingsDisplayControl.xaml.cs index f6242cf0b655..5ca99ae63c3e 100644 --- a/src/Files.Uwp/UserControls/Settings/SettingsDisplayControl.xaml.cs +++ b/src/Files.Uwp/UserControls/Settings/SettingsDisplayControl.xaml.cs @@ -1,6 +1,6 @@ -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Markup; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Markup; namespace Files.Uwp.UserControls.Settings { diff --git a/src/Files.Uwp/UserControls/Settings/ThemeSampleDisplayControl.xaml.cs b/src/Files.Uwp/UserControls/Settings/ThemeSampleDisplayControl.xaml.cs index 5a8b69771300..2efd6c7291b7 100644 --- a/src/Files.Uwp/UserControls/Settings/ThemeSampleDisplayControl.xaml.cs +++ b/src/Files.Uwp/UserControls/Settings/ThemeSampleDisplayControl.xaml.cs @@ -1,8 +1,8 @@ -using Files.Uwp.Helpers; +using Files.Uwp.Helpers; using System; using System.Threading.Tasks; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; namespace Files.Uwp.UserControls.Settings { diff --git a/src/Files.Uwp/UserControls/SidebarControl.xaml.cs b/src/Files.Uwp/UserControls/SidebarControl.xaml.cs index 188fad59536e..8fabb5e44a62 100644 --- a/src/Files.Uwp/UserControls/SidebarControl.xaml.cs +++ b/src/Files.Uwp/UserControls/SidebarControl.xaml.cs @@ -1,4 +1,4 @@ -using CommunityToolkit.Mvvm.DependencyInjection; +using CommunityToolkit.Mvvm.DependencyInjection; using CommunityToolkit.Mvvm.Input; using Files.Backend.Services.Settings; using Files.Shared.Extensions; @@ -22,10 +22,10 @@ using Windows.ApplicationModel.DataTransfer.DragDrop; using Windows.System; using Windows.UI.Core; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Controls.Primitives; -using Windows.UI.Xaml.Input; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Controls.Primitives; +using Microsoft.UI.Xaml.Input; namespace Files.Uwp.UserControls { @@ -510,7 +510,7 @@ private async void Sidebar_ItemInvoked(Microsoft.UI.Xaml.Controls.NavigationView return; } - var ctrlPressed = Window.Current.CoreWindow.GetKeyState(VirtualKey.Control).HasFlag(CoreVirtualKeyStates.Down); + var ctrlPressed = App.Window.CoreWindow.GetKeyState(VirtualKey.Control).HasFlag(CoreVirtualKeyStates.Down); if (ctrlPressed && navigationPath is not null) { await NavigationHelpers.OpenPathInNewTab(navigationPath); @@ -1024,7 +1024,7 @@ private void SidebarControl_DisplayModeChanged(Microsoft.UI.Xaml.Controls.Naviga private void Border_KeyDown(object sender, KeyRoutedEventArgs e) { var step = 1; - var ctrl = Window.Current.CoreWindow.GetKeyState(VirtualKey.Control); + var ctrl = App.Window.CoreWindow.GetKeyState(VirtualKey.Control); originalSize = IsPaneOpen ? UserSettingsService.AppearanceSettingsService.SidebarWidth : CompactPaneLength; if (ctrl.HasFlag(CoreVirtualKeyStates.Down)) @@ -1072,7 +1072,7 @@ private void Border_PointerExited(object sender, PointerRoutedEventArgs e) { if (!dragging) // keep showing pressed event if currently resizing the sidebar { - Window.Current.CoreWindow.PointerCursor = new CoreCursor(CoreCursorType.Arrow, 0); + App.Window.CoreWindow.PointerCursor = new CoreCursor(CoreCursorType.Arrow, 0); VisualStateManager.GoToState((sender as Grid).FindAscendant(), "ResizerNormal", true); } } @@ -1081,7 +1081,7 @@ private void Border_PointerEntered(object sender, PointerRoutedEventArgs e) { if (DisplayMode == Microsoft.UI.Xaml.Controls.NavigationViewDisplayMode.Expanded) { - Window.Current.CoreWindow.PointerCursor = new CoreCursor(CoreCursorType.SizeWestEast, 0); + App.Window.CoreWindow.PointerCursor = new CoreCursor(CoreCursorType.SizeWestEast, 0); VisualStateManager.GoToState((sender as Grid).FindAscendant(), "ResizerPointerOver", true); } } @@ -1116,7 +1116,7 @@ private void SetSize(double val, bool closeImmediatleyOnOversize = false) private void ResizeElementBorder_ManipulationCompleted(object sender, ManipulationCompletedRoutedEventArgs e) { - Window.Current.CoreWindow.PointerCursor = new CoreCursor(CoreCursorType.Arrow, 0); + App.Window.CoreWindow.PointerCursor = new CoreCursor(CoreCursorType.Arrow, 0); VisualStateManager.GoToState((sender as Grid).FindAscendant(), "ResizerNormal", true); UserSettingsService.AppearanceSettingsService.SidebarWidth = OpenPaneLength; dragging = false; @@ -1132,7 +1132,7 @@ private void ResizeElementBorder_ManipulationStarted(object sender, Manipulation if (DisplayMode == Microsoft.UI.Xaml.Controls.NavigationViewDisplayMode.Expanded) { originalSize = IsPaneOpen ? UserSettingsService.AppearanceSettingsService.SidebarWidth : CompactPaneLength; - Window.Current.CoreWindow.PointerCursor = new CoreCursor(CoreCursorType.SizeWestEast, 0); + App.Window.CoreWindow.PointerCursor = new CoreCursor(CoreCursorType.SizeWestEast, 0); VisualStateManager.GoToState((sender as Grid).FindAscendant(), "ResizerPressed", true); dragging = true; } @@ -1171,7 +1171,7 @@ private async void LoadShellMenuItems(Microsoft.UI.Xaml.Controls.CommandBarFlyou } if (options.IsLocationItem) { - var shiftPressed = Window.Current.CoreWindow.GetKeyState(VirtualKey.Shift).HasFlag(CoreVirtualKeyStates.Down); + var shiftPressed = App.Window.CoreWindow.GetKeyState(VirtualKey.Shift).HasFlag(CoreVirtualKeyStates.Down); var shellMenuItems = await ContextFlyoutItemHelper.GetItemContextShellCommandsAsync(connection: await AppServiceConnectionHelper.Instance, currentInstanceViewModel: null, workingDir: null, new List() { new ListedItem(null) { ItemPath = rightClickedItem.Path } }, shiftPressed: shiftPressed, showOpenMenu: false); if (!UserSettingsService.AppearanceSettingsService.MoveOverflowMenuItemsToSubMenu) @@ -1179,7 +1179,7 @@ private async void LoadShellMenuItems(Microsoft.UI.Xaml.Controls.CommandBarFlyou var (_, secondaryElements) = ItemModelListToContextFlyoutHelper.GetAppBarItemsFromModel(shellMenuItems); if (secondaryElements.Any()) { - var openedPopups = Windows.UI.Xaml.Media.VisualTreeHelper.GetOpenPopups(Window.Current); + var openedPopups = Microsoft.UI.Xaml.Media.VisualTreeHelper.GetOpenPopups(App.Window); var secondaryMenu = openedPopups.FirstOrDefault(popup => popup.Name == "OverflowPopup"); var itemsControl = secondaryMenu?.Child.FindDescendant(); if (itemsControl is not null) diff --git a/src/Files.Uwp/UserControls/StatusBarControl.xaml.cs b/src/Files.Uwp/UserControls/StatusBarControl.xaml.cs index 0385704176f9..61505f61a50e 100644 --- a/src/Files.Uwp/UserControls/StatusBarControl.xaml.cs +++ b/src/Files.Uwp/UserControls/StatusBarControl.xaml.cs @@ -1,8 +1,8 @@ -using Files.Uwp.ViewModels; +using Files.Uwp.ViewModels; using System.ComponentModel; using System.Runtime.CompilerServices; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; namespace Files.Uwp.UserControls { @@ -44,7 +44,7 @@ public StatusBarControl() this.InitializeComponent(); } - private void FullTrustStatus_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e) + private void FullTrustStatus_Click(object sender, Microsoft.UI.Xaml.RoutedEventArgs e) { FullTrustStatusTeachingTip.IsOpen = true; } diff --git a/src/Files.Uwp/UserControls/StringEncodedImage.xaml.cs b/src/Files.Uwp/UserControls/StringEncodedImage.xaml.cs index 179baf413637..ffd9d3ca8c9c 100644 --- a/src/Files.Uwp/UserControls/StringEncodedImage.xaml.cs +++ b/src/Files.Uwp/UserControls/StringEncodedImage.xaml.cs @@ -1,10 +1,10 @@ -using System; +using System; using System.Diagnostics; using System.IO; using System.Runtime.InteropServices.WindowsRuntime; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Media.Imaging; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Media.Imaging; // The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236 diff --git a/src/Files.Uwp/UserControls/Widgets/BundlesWidget.xaml.cs b/src/Files.Uwp/UserControls/Widgets/BundlesWidget.xaml.cs index ff84e7709303..743b7f85bfbb 100644 --- a/src/Files.Uwp/UserControls/Widgets/BundlesWidget.xaml.cs +++ b/src/Files.Uwp/UserControls/Widgets/BundlesWidget.xaml.cs @@ -1,10 +1,10 @@ -using Files.Backend.Services.Settings; +using Files.Backend.Services.Settings; using Files.Uwp.ViewModels.Widgets; using Files.Uwp.ViewModels.Widgets.Bundles; using CommunityToolkit.Mvvm.DependencyInjection; using Microsoft.Toolkit.Uwp; using System; -using Windows.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Controls; using System.Threading.Tasks; // The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236 diff --git a/src/Files.Uwp/UserControls/Widgets/DrivesWidget.xaml.cs b/src/Files.Uwp/UserControls/Widgets/DrivesWidget.xaml.cs index 3d2af29ae7fe..71956ed3021c 100644 --- a/src/Files.Uwp/UserControls/Widgets/DrivesWidget.xaml.cs +++ b/src/Files.Uwp/UserControls/Widgets/DrivesWidget.xaml.cs @@ -1,4 +1,4 @@ -using Files.Uwp.DataModels.NavigationControlItems; +using Files.Uwp.DataModels.NavigationControlItems; using Files.Uwp.Helpers; using Files.Backend.Services.Settings; using Files.Uwp.ViewModels.Widgets; @@ -13,11 +13,11 @@ using Windows.Foundation.Collections; using Windows.System; using Windows.UI.Core; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Input; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Input; using CommunityToolkit.Mvvm.ComponentModel; -using Windows.UI.Xaml.Media.Imaging; +using Microsoft.UI.Xaml.Media.Imaging; using Windows.ApplicationModel.Core; using System.Collections.Specialized; @@ -111,7 +111,9 @@ public DrivesWidget() private async void Manager_DataChanged(object sender, NotifyCollectionChangedEventArgs e) { - await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async () => + await /* + TODO UA306_A2: UWP CoreDispatcher : Windows.UI.Core.CoreDispatcher is no longer supported. Use DispatcherQueue instead. Read: https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/guides/threading + */Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async () => { foreach (DriveItem drive in App.DrivesManager.Drives) { @@ -203,7 +205,7 @@ private async void Button_Click(object sender, RoutedEventArgs e) return; } - var ctrlPressed = Window.Current.CoreWindow.GetKeyState(VirtualKey.Control).HasFlag(CoreVirtualKeyStates.Down); + var ctrlPressed = App.Window.CoreWindow.GetKeyState(VirtualKey.Control).HasFlag(CoreVirtualKeyStates.Down); if (ctrlPressed) { await NavigationHelpers.OpenPathInNewTab(NavigationPath); diff --git a/src/Files.Uwp/UserControls/Widgets/FolderWidget.xaml.cs b/src/Files.Uwp/UserControls/Widgets/FolderWidget.xaml.cs index 8b17294cf474..fc7eccb1394d 100644 --- a/src/Files.Uwp/UserControls/Widgets/FolderWidget.xaml.cs +++ b/src/Files.Uwp/UserControls/Widgets/FolderWidget.xaml.cs @@ -1,4 +1,4 @@ -using Files.Uwp.Filesystem; +using Files.Uwp.Filesystem; using Files.Uwp.Helpers; using Files.Backend.Services.Settings; using Files.Uwp.ViewModels.Widgets; @@ -16,10 +16,10 @@ using Windows.Storage; using Windows.System; using Windows.UI.Core; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Input; -using Windows.UI.Xaml.Media.Imaging; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Input; +using Microsoft.UI.Xaml.Media.Imaging; using Files.Uwp.DataModels.NavigationControlItems; namespace Files.Uwp.UserControls.Widgets @@ -258,7 +258,7 @@ private async Task OpenLibraryCard(FolderCardItem item) return; } - var ctrlPressed = Window.Current.CoreWindow.GetKeyState(VirtualKey.Control).HasFlag(CoreVirtualKeyStates.Down); + var ctrlPressed = App.Window.CoreWindow.GetKeyState(VirtualKey.Control).HasFlag(CoreVirtualKeyStates.Down); if (ctrlPressed) { await NavigationHelpers.OpenPathInNewTab(item.Path); diff --git a/src/Files.Uwp/UserControls/Widgets/IWidgetCardItem.cs b/src/Files.Uwp/UserControls/Widgets/IWidgetCardItem.cs index 9d141aa8d158..d711fcfb3dd0 100644 --- a/src/Files.Uwp/UserControls/Widgets/IWidgetCardItem.cs +++ b/src/Files.Uwp/UserControls/Widgets/IWidgetCardItem.cs @@ -1,5 +1,5 @@ -using System.Threading.Tasks; -using Windows.UI.Xaml.Media.Imaging; +using System.Threading.Tasks; +using Microsoft.UI.Xaml.Media.Imaging; namespace Files.Uwp.UserControls.Widgets { diff --git a/src/Files.Uwp/UserControls/Widgets/RecentFilesWidget.xaml.cs b/src/Files.Uwp/UserControls/Widgets/RecentFilesWidget.xaml.cs index ac897eca85f2..97dc9309968d 100644 --- a/src/Files.Uwp/UserControls/Widgets/RecentFilesWidget.xaml.cs +++ b/src/Files.Uwp/UserControls/Widgets/RecentFilesWidget.xaml.cs @@ -1,4 +1,4 @@ -using Files.Shared.Enums; +using Files.Shared.Enums; using Files.Uwp.Filesystem; using Files.Uwp.Filesystem.StorageItems; using Files.Backend.Services.Settings; @@ -15,9 +15,9 @@ using System.Threading.Tasks; using Windows.Storage; using Windows.Storage.AccessCache; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Media.Imaging; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Media.Imaging; using System.Collections.Specialized; using Windows.UI.Core; using System.Threading; @@ -68,7 +68,9 @@ public RecentFilesWidget() private async void Manager_RecentFilesChanged(object sender, NotifyCollectionChangedEventArgs e) { - await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async () => + await /* + TODO UA306_A2: UWP CoreDispatcher : Windows.UI.Core.CoreDispatcher is no longer supported. Use DispatcherQueue instead. Read: https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/guides/threading + */Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async () => { // e.Action can only be Reset right now; naively refresh everything for simplicity await UpdateRecentsList(e); diff --git a/src/Files.Uwp/UserControls/Widgets/WidgetsListControl.xaml.cs b/src/Files.Uwp/UserControls/Widgets/WidgetsListControl.xaml.cs index 4b460ab2af25..719d134d7f7e 100644 --- a/src/Files.Uwp/UserControls/Widgets/WidgetsListControl.xaml.cs +++ b/src/Files.Uwp/UserControls/Widgets/WidgetsListControl.xaml.cs @@ -1,6 +1,6 @@ -using Files.Uwp.ViewModels.Widgets; +using Files.Uwp.ViewModels.Widgets; using System; -using Windows.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Controls; // The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236 diff --git a/src/Files.Uwp/ValueConverters/ColorModelToColorConverter.cs b/src/Files.Uwp/ValueConverters/ColorModelToColorConverter.cs index c1ef0522f8db..ef71bfc09b1a 100644 --- a/src/Files.Uwp/ValueConverters/ColorModelToColorConverter.cs +++ b/src/Files.Uwp/ValueConverters/ColorModelToColorConverter.cs @@ -1,8 +1,8 @@ -using Files.Backend.Models.Coloring; +using Files.Backend.Models.Coloring; using Files.Uwp.Helpers; using System; -using Windows.UI.Xaml.Data; -using Windows.UI.Xaml.Media; +using Microsoft.UI.Xaml.Data; +using Microsoft.UI.Xaml.Media; namespace Files.Uwp.ValueConverters { diff --git a/src/Files.Uwp/ValueConverters/EnumConverters/ConflictResolveOptionToIndexConverter.cs b/src/Files.Uwp/ValueConverters/EnumConverters/ConflictResolveOptionToIndexConverter.cs index 59b0e7e7d052..09b2c5ea84ef 100644 --- a/src/Files.Uwp/ValueConverters/EnumConverters/ConflictResolveOptionToIndexConverter.cs +++ b/src/Files.Uwp/ValueConverters/EnumConverters/ConflictResolveOptionToIndexConverter.cs @@ -1,5 +1,5 @@ -using System; -using Windows.UI.Xaml.Data; +using System; +using Microsoft.UI.Xaml.Data; using Files.Shared.Enums; namespace Files.Uwp.ValueConverters.EnumConverters diff --git a/src/Files.Uwp/ValueConverters/GenericEnumConverter.cs b/src/Files.Uwp/ValueConverters/GenericEnumConverter.cs index 1f8936b4b700..3a5ee3bcc14a 100644 --- a/src/Files.Uwp/ValueConverters/GenericEnumConverter.cs +++ b/src/Files.Uwp/ValueConverters/GenericEnumConverter.cs @@ -1,7 +1,7 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; -using Windows.UI.Xaml.Data; +using Microsoft.UI.Xaml.Data; namespace Files.Uwp.ValueConverters { diff --git a/src/Files.Uwp/ValueConverters/ImageModelToImageConverter.cs b/src/Files.Uwp/ValueConverters/ImageModelToImageConverter.cs index f3237c57f9a8..a2025b5e8cc5 100644 --- a/src/Files.Uwp/ValueConverters/ImageModelToImageConverter.cs +++ b/src/Files.Uwp/ValueConverters/ImageModelToImageConverter.cs @@ -1,8 +1,8 @@ -using Files.Uwp.Imaging; +using Files.Uwp.Imaging; using System; using System.Linq; -using Windows.UI.Xaml.Data; -using Windows.UI.Xaml.Media.Imaging; +using Microsoft.UI.Xaml.Data; +using Microsoft.UI.Xaml.Media.Imaging; #nullable enable diff --git a/src/Files.Uwp/ViewModels/ColumnsViewModel.cs b/src/Files.Uwp/ViewModels/ColumnsViewModel.cs index 7aa384107f13..715e674922e9 100644 --- a/src/Files.Uwp/ViewModels/ColumnsViewModel.cs +++ b/src/Files.Uwp/ViewModels/ColumnsViewModel.cs @@ -1,5 +1,5 @@ -using CommunityToolkit.Mvvm.ComponentModel; -using Windows.UI.Xaml; +using CommunityToolkit.Mvvm.ComponentModel; +using Microsoft.UI.Xaml; namespace Files.Uwp.ViewModels { diff --git a/src/Files.Uwp/ViewModels/ContextMenuFlyoutItemViewModel.cs b/src/Files.Uwp/ViewModels/ContextMenuFlyoutItemViewModel.cs index 22ed154b1cc3..4db14048268b 100644 --- a/src/Files.Uwp/ViewModels/ContextMenuFlyoutItemViewModel.cs +++ b/src/Files.Uwp/ViewModels/ContextMenuFlyoutItemViewModel.cs @@ -1,8 +1,8 @@ -using Files.Uwp.UserControls; +using Files.Uwp.UserControls; using System.Collections.Generic; using System.Windows.Input; -using Windows.UI.Xaml.Input; -using Windows.UI.Xaml.Media.Imaging; +using Microsoft.UI.Xaml.Input; +using Microsoft.UI.Xaml.Media.Imaging; namespace Files.Uwp.ViewModels { diff --git a/src/Files.Uwp/ViewModels/CurrentInstanceViewModel.cs b/src/Files.Uwp/ViewModels/CurrentInstanceViewModel.cs index 841ff776df56..2bbd53957020 100644 --- a/src/Files.Uwp/ViewModels/CurrentInstanceViewModel.cs +++ b/src/Files.Uwp/ViewModels/CurrentInstanceViewModel.cs @@ -1,4 +1,4 @@ -using Files.Shared.Enums; +using Files.Shared.Enums; using CommunityToolkit.Mvvm.ComponentModel; namespace Files.Uwp.ViewModels diff --git a/src/Files.Uwp/ViewModels/Dialogs/DecompressArchiveDialogViewModel.cs b/src/Files.Uwp/ViewModels/Dialogs/DecompressArchiveDialogViewModel.cs index 015254dfa18c..1878e58fb36d 100644 --- a/src/Files.Uwp/ViewModels/Dialogs/DecompressArchiveDialogViewModel.cs +++ b/src/Files.Uwp/ViewModels/Dialogs/DecompressArchiveDialogViewModel.cs @@ -1,4 +1,4 @@ -using CommunityToolkit.Mvvm.ComponentModel; +using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.Input; using System; using System.IO; @@ -44,7 +44,7 @@ public DecompressArchiveDialogViewModel(IStorageFile archive) private async Task SelectDestination() { - FolderPicker folderPicker = new FolderPicker(); + FolderPicker folderPicker = this.InitializeWithWindow(new FolderPicker()); folderPicker.FileTypeFilter.Add("*"); DestinationFolder = await folderPicker.PickSingleFolderAsync(); @@ -58,6 +58,11 @@ private async Task SelectDestination() DestinationFolderPath = DefaultDestinationFolderPath(); } } + private FolderPicker InitializeWithWindow(FolderPicker obj) + { + WinRT.Interop.InitializeWithWindow.Initialize(obj, App.WindowHandle); + return obj; + } private string DefaultDestinationFolderPath() { diff --git a/src/Files.Uwp/ViewModels/Dialogs/DynamicDialogViewModel.cs b/src/Files.Uwp/ViewModels/Dialogs/DynamicDialogViewModel.cs index db77c15c165b..12dc7cc77634 100644 --- a/src/Files.Uwp/ViewModels/Dialogs/DynamicDialogViewModel.cs +++ b/src/Files.Uwp/ViewModels/Dialogs/DynamicDialogViewModel.cs @@ -1,4 +1,4 @@ -using Files.Shared.Enums; +using Files.Shared.Enums; using Files.Uwp.Helpers.XamlHelpers; using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.Input; @@ -6,9 +6,9 @@ using System.Diagnostics; using System.Windows.Input; using Windows.System; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Input; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Input; namespace Files.Uwp.ViewModels.Dialogs { diff --git a/src/Files.Uwp/ViewModels/DirectoryPropertiesViewModel.cs b/src/Files.Uwp/ViewModels/DirectoryPropertiesViewModel.cs index f658f87b5816..eacb61264de3 100644 --- a/src/Files.Uwp/ViewModels/DirectoryPropertiesViewModel.cs +++ b/src/Files.Uwp/ViewModels/DirectoryPropertiesViewModel.cs @@ -1,4 +1,4 @@ -using CommunityToolkit.Mvvm.ComponentModel; +using CommunityToolkit.Mvvm.ComponentModel; namespace Files.Uwp.ViewModels { diff --git a/src/Files.Uwp/ViewModels/FolderSettingsViewModel.cs b/src/Files.Uwp/ViewModels/FolderSettingsViewModel.cs index 1ebe1925eeef..6426dede764e 100644 --- a/src/Files.Uwp/ViewModels/FolderSettingsViewModel.cs +++ b/src/Files.Uwp/ViewModels/FolderSettingsViewModel.cs @@ -1,4 +1,4 @@ -using Files.Shared.Enums; +using Files.Shared.Enums; using Files.Uwp.EventArguments; using Files.Uwp.Helpers; using Files.Uwp.Helpers.LayoutPreferences; diff --git a/src/Files.Uwp/ViewModels/ItemViewModel.cs b/src/Files.Uwp/ViewModels/ItemViewModel.cs index f87fcb760db7..24dfb8ef3d57 100644 --- a/src/Files.Uwp/ViewModels/ItemViewModel.cs +++ b/src/Files.Uwp/ViewModels/ItemViewModel.cs @@ -41,9 +41,9 @@ using Windows.Storage.FileProperties; using Windows.Storage.Search; using Windows.System; -using Windows.UI.Xaml.Data; -using Windows.UI.Xaml.Media; -using Windows.UI.Xaml.Media.Imaging; +using Microsoft.UI.Xaml.Data; +using Microsoft.UI.Xaml.Media; +using Microsoft.UI.Xaml.Media.Imaging; using static Files.Backend.Helpers.NativeFindStorageItemHelper; using static Files.Uwp.Helpers.NativeDirectoryChangesHelper; using FileAttributes = System.IO.FileAttributes; diff --git a/src/Files.Uwp/ViewModels/MainPageViewModel.cs b/src/Files.Uwp/ViewModels/MainPageViewModel.cs index 051e88db963b..30575a328644 100644 --- a/src/Files.Uwp/ViewModels/MainPageViewModel.cs +++ b/src/Files.Uwp/ViewModels/MainPageViewModel.cs @@ -1,4 +1,4 @@ -using Files.Shared.Extensions; +using Files.Shared.Extensions; using Files.Uwp.Filesystem; using Files.Uwp.Filesystem.StorageItems; using Files.Uwp.Helpers; @@ -18,9 +18,9 @@ using Windows.Storage; using Windows.System; using Windows.UI.ViewManagement; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Input; -using Windows.UI.Xaml.Navigation; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Input; +using Microsoft.UI.Xaml.Navigation; namespace Files.Uwp.ViewModels { @@ -233,6 +233,11 @@ public async void UpdateInstanceProperties(object navigationArg) } if (navigationArg == SelectedTabItem?.TabItemArguments?.NavigationArg) { + + /* + TODO UA315_A Use Microsoft.UI.Windowing.AppWindow for window Management instead of ApplicationView/CoreWindow or Microsoft.UI.Windowing.AppWindow APIs + Read: https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/guides/windowing + */ ApplicationView.GetForCurrentView().Title = windowTitle; } } @@ -269,7 +274,7 @@ public static async Task UpdateTabInfo(TabItem tabItem, object navigationArg) if (string.IsNullOrEmpty(currentPath) || currentPath == "Home".GetLocalized()) { tabLocationHeader = "Home".GetLocalized(); - iconSource.ImageSource = new Windows.UI.Xaml.Media.Imaging.BitmapImage(new Uri("ms-appx:///Assets/FluentIcons/Home.png")); + iconSource.ImageSource = new Microsoft.UI.Xaml.Media.Imaging.BitmapImage(new Uri("ms-appx:///Assets/FluentIcons/Home.png")); } else if (currentPath.Equals(CommonPaths.DesktopPath, StringComparison.OrdinalIgnoreCase)) { diff --git a/src/Files.Uwp/ViewModels/MainViewModel.cs b/src/Files.Uwp/ViewModels/MainViewModel.cs index 57102fbe4608..b40cc6d68a9b 100644 --- a/src/Files.Uwp/ViewModels/MainViewModel.cs +++ b/src/Files.Uwp/ViewModels/MainViewModel.cs @@ -1,4 +1,4 @@ -using Files.Uwp.Dialogs; +using Files.Uwp.Dialogs; using Files.Uwp.Helpers; using Files.Uwp.Views; using CommunityToolkit.Mvvm.ComponentModel; @@ -6,9 +6,9 @@ using System; using Windows.ApplicationModel.DataTransfer; using Windows.System.Profile; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Media; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Media; using CommunityToolkit.Mvvm.DependencyInjection; using Files.Backend.Services; using Files.Backend.ViewModels.Dialogs; @@ -22,7 +22,7 @@ public class MainViewModel : ObservableObject public MainViewModel() { - Window.Current.SizeChanged += Current_SizeChanged; + App.Window.SizeChanged += Current_SizeChanged; Clipboard.ContentChanged += Clipboard_ContentChanged; DetectFontName(); @@ -71,7 +71,7 @@ public int TabStripSelectedIndex if (value < MainPageViewModel.AppInstances.Count) { - Frame rootFrame = Window.Current.Content as Frame; + Frame rootFrame = App.Window.Content as Frame; var mainView = rootFrame.Content as MainPage; mainView.ViewModel.SelectedTabItem = MainPageViewModel.AppInstances[value]; } @@ -99,7 +99,7 @@ public bool IsPasteEnabled public static bool IsWindowResizedToCompactWidth() { - return Window.Current.Bounds.Width <= 750; + return App.Window.Bounds.Width <= 750; } public bool IsWindowCompactSize diff --git a/src/Files.Uwp/ViewModels/Pages/YourHomeViewModel.cs b/src/Files.Uwp/ViewModels/Pages/YourHomeViewModel.cs index 6aae8d286e6d..35b6ae365e76 100644 --- a/src/Files.Uwp/ViewModels/Pages/YourHomeViewModel.cs +++ b/src/Files.Uwp/ViewModels/Pages/YourHomeViewModel.cs @@ -1,4 +1,4 @@ -using Files.Uwp.EventArguments.Bundles; +using Files.Uwp.EventArguments.Bundles; using Files.Uwp.Helpers; using Files.Uwp.ViewModels.Widgets; using Files.Uwp.ViewModels.Widgets.Bundles; @@ -6,7 +6,7 @@ using CommunityToolkit.Mvvm.Input; using System; using System.Windows.Input; -using Windows.UI.Xaml; +using Microsoft.UI.Xaml; using System.Threading.Tasks; using System.Collections.Generic; using Newtonsoft.Json; diff --git a/src/Files.Uwp/ViewModels/PaneViewModel.cs b/src/Files.Uwp/ViewModels/PaneViewModel.cs index 3d9a6a8c5624..d4f9f8f132aa 100644 --- a/src/Files.Uwp/ViewModels/PaneViewModel.cs +++ b/src/Files.Uwp/ViewModels/PaneViewModel.cs @@ -1,4 +1,4 @@ -using Files.Shared.Enums; +using Files.Shared.Enums; using Files.Backend.Services.Settings; using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.DependencyInjection; diff --git a/src/Files.Uwp/ViewModels/PreviewPaneViewModel.cs b/src/Files.Uwp/ViewModels/PreviewPaneViewModel.cs index 6b4415ab71ab..89c6bea81901 100644 --- a/src/Files.Uwp/ViewModels/PreviewPaneViewModel.cs +++ b/src/Files.Uwp/ViewModels/PreviewPaneViewModel.cs @@ -1,4 +1,4 @@ -using CommunityToolkit.Mvvm.ComponentModel; +using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.DependencyInjection; using CommunityToolkit.Mvvm.Input; using Files.Backend.Services.Settings; @@ -13,8 +13,8 @@ using System.Threading.Tasks; using System.Windows.Input; using Windows.Storage; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; namespace Files.Uwp.ViewModels { diff --git a/src/Files.Uwp/ViewModels/Previews/ArchivePreviewViewModel.cs b/src/Files.Uwp/ViewModels/Previews/ArchivePreviewViewModel.cs index cef89bf941c4..716b726e35a6 100644 --- a/src/Files.Uwp/ViewModels/Previews/ArchivePreviewViewModel.cs +++ b/src/Files.Uwp/ViewModels/Previews/ArchivePreviewViewModel.cs @@ -1,4 +1,4 @@ -using Files.Uwp.Extensions; +using Files.Uwp.Extensions; using Files.Uwp.Filesystem; using Files.Uwp.ViewModels.Properties; using SevenZip; diff --git a/src/Files.Uwp/ViewModels/Previews/BasePreviewModel.cs b/src/Files.Uwp/ViewModels/Previews/BasePreviewModel.cs index 79fbc5b718d1..4783ba1ca99e 100644 --- a/src/Files.Uwp/ViewModels/Previews/BasePreviewModel.cs +++ b/src/Files.Uwp/ViewModels/Previews/BasePreviewModel.cs @@ -1,4 +1,4 @@ -using CommunityToolkit.Mvvm.ComponentModel; +using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.DependencyInjection; using Files.Backend.Services.Settings; using Files.Uwp.Filesystem; @@ -13,8 +13,8 @@ using System.Threading.Tasks; using Windows.ApplicationModel.Core; using Windows.Storage.FileProperties; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Media.Imaging; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Media.Imaging; namespace Files.Uwp.ViewModels.Previews { diff --git a/src/Files.Uwp/ViewModels/Previews/BasicPreviewViewModel.cs b/src/Files.Uwp/ViewModels/Previews/BasicPreviewViewModel.cs index d94864150032..549095aa0020 100644 --- a/src/Files.Uwp/ViewModels/Previews/BasicPreviewViewModel.cs +++ b/src/Files.Uwp/ViewModels/Previews/BasicPreviewViewModel.cs @@ -1,4 +1,4 @@ -using Files.Uwp.Filesystem; +using Files.Uwp.Filesystem; namespace Files.Uwp.ViewModels.Previews { diff --git a/src/Files.Uwp/ViewModels/Previews/CodePreviewViewModel.cs b/src/Files.Uwp/ViewModels/Previews/CodePreviewViewModel.cs index 2e72b316e5db..31327a979f52 100644 --- a/src/Files.Uwp/ViewModels/Previews/CodePreviewViewModel.cs +++ b/src/Files.Uwp/ViewModels/Previews/CodePreviewViewModel.cs @@ -1,4 +1,4 @@ -using ColorCode; +using ColorCode; using Files.Shared.Extensions; using Files.Uwp.Filesystem; using Files.Uwp.ViewModels.Properties; diff --git a/src/Files.Uwp/ViewModels/Previews/FolderPreviewViewModel.cs b/src/Files.Uwp/ViewModels/Previews/FolderPreviewViewModel.cs index 190294dd696d..035037e59fef 100644 --- a/src/Files.Uwp/ViewModels/Previews/FolderPreviewViewModel.cs +++ b/src/Files.Uwp/ViewModels/Previews/FolderPreviewViewModel.cs @@ -1,4 +1,4 @@ -using CommunityToolkit.Mvvm.DependencyInjection; +using CommunityToolkit.Mvvm.DependencyInjection; using Files.Backend.Services.Settings; using Files.Shared.Services.DateTimeFormatter; using Files.Uwp.Filesystem; @@ -9,7 +9,7 @@ using System.Linq; using System.Threading.Tasks; using Windows.Storage.FileProperties; -using Windows.UI.Xaml.Media.Imaging; +using Microsoft.UI.Xaml.Media.Imaging; namespace Files.Uwp.ViewModels.Previews { diff --git a/src/Files.Uwp/ViewModels/Previews/HtmlPreviewViewModel.cs b/src/Files.Uwp/ViewModels/Previews/HtmlPreviewViewModel.cs index 32dd24a8f527..555fec36729e 100644 --- a/src/Files.Uwp/ViewModels/Previews/HtmlPreviewViewModel.cs +++ b/src/Files.Uwp/ViewModels/Previews/HtmlPreviewViewModel.cs @@ -1,4 +1,4 @@ -using Files.Uwp.Filesystem; +using Files.Uwp.Filesystem; using Files.Uwp.ViewModels.Properties; using System.Collections.Generic; using System.Threading.Tasks; diff --git a/src/Files.Uwp/ViewModels/Previews/ImagePreviewViewModel.cs b/src/Files.Uwp/ViewModels/Previews/ImagePreviewViewModel.cs index c91fc5b678dd..e0410354a9d4 100644 --- a/src/Files.Uwp/ViewModels/Previews/ImagePreviewViewModel.cs +++ b/src/Files.Uwp/ViewModels/Previews/ImagePreviewViewModel.cs @@ -1,4 +1,4 @@ -using Files.Uwp.Filesystem; +using Files.Uwp.Filesystem; using Files.Uwp.ViewModels.Properties; using Microsoft.Toolkit.Uwp; using System; @@ -7,8 +7,8 @@ using Windows.ApplicationModel.Core; using Windows.Storage; using Windows.Storage.Streams; -using Windows.UI.Xaml.Media; -using Windows.UI.Xaml.Media.Imaging; +using Microsoft.UI.Xaml.Media; +using Microsoft.UI.Xaml.Media.Imaging; namespace Files.Uwp.ViewModels.Previews { diff --git a/src/Files.Uwp/ViewModels/Previews/MarkdownPreviewViewModel.cs b/src/Files.Uwp/ViewModels/Previews/MarkdownPreviewViewModel.cs index d92e66569fc0..933ddca9174b 100644 --- a/src/Files.Uwp/ViewModels/Previews/MarkdownPreviewViewModel.cs +++ b/src/Files.Uwp/ViewModels/Previews/MarkdownPreviewViewModel.cs @@ -1,4 +1,4 @@ -using Files.Shared.Extensions; +using Files.Shared.Extensions; using Files.Uwp.Filesystem; using Files.Uwp.ViewModels.Properties; using System.Collections.Generic; diff --git a/src/Files.Uwp/ViewModels/Previews/MediaPreviewViewModel.cs b/src/Files.Uwp/ViewModels/Previews/MediaPreviewViewModel.cs index 365b03bf6800..9641be2edcbe 100644 --- a/src/Files.Uwp/ViewModels/Previews/MediaPreviewViewModel.cs +++ b/src/Files.Uwp/ViewModels/Previews/MediaPreviewViewModel.cs @@ -1,10 +1,10 @@ -using Files.Uwp.Filesystem; +using Files.Uwp.Filesystem; using Files.Uwp.ViewModels.Properties; using System; using System.Collections.Generic; using System.Threading.Tasks; using Windows.Media.Core; -using Windows.UI.Xaml; +using Microsoft.UI.Xaml; namespace Files.Uwp.ViewModels.Previews { diff --git a/src/Files.Uwp/ViewModels/Previews/PDFPreviewViewModel.cs b/src/Files.Uwp/ViewModels/Previews/PDFPreviewViewModel.cs index 7518ded83fb6..52409eceb210 100644 --- a/src/Files.Uwp/ViewModels/Previews/PDFPreviewViewModel.cs +++ b/src/Files.Uwp/ViewModels/Previews/PDFPreviewViewModel.cs @@ -1,4 +1,4 @@ -using Files.Uwp.Filesystem; +using Files.Uwp.Filesystem; using Files.Uwp.ViewModels.Properties; using Microsoft.Toolkit.Uwp; using System; @@ -10,8 +10,8 @@ using Windows.Data.Pdf; using Windows.Graphics.Imaging; using Windows.Storage.Streams; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Media.Imaging; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Media.Imaging; namespace Files.Uwp.ViewModels.Previews { diff --git a/src/Files.Uwp/ViewModels/Previews/RichTextPreviewViewModel.cs b/src/Files.Uwp/ViewModels/Previews/RichTextPreviewViewModel.cs index 5ffea561916a..13033ae52b59 100644 --- a/src/Files.Uwp/ViewModels/Previews/RichTextPreviewViewModel.cs +++ b/src/Files.Uwp/ViewModels/Previews/RichTextPreviewViewModel.cs @@ -1,4 +1,4 @@ -using Files.Uwp.Filesystem; +using Files.Uwp.Filesystem; using Files.Uwp.ViewModels.Properties; using System; using System.Collections.Generic; diff --git a/src/Files.Uwp/ViewModels/Previews/ShortcutPreviewViewModel.cs b/src/Files.Uwp/ViewModels/Previews/ShortcutPreviewViewModel.cs index c4d9c1287d76..b22f35a99f72 100644 --- a/src/Files.Uwp/ViewModels/Previews/ShortcutPreviewViewModel.cs +++ b/src/Files.Uwp/ViewModels/Previews/ShortcutPreviewViewModel.cs @@ -1,4 +1,4 @@ -using Files.Uwp.Filesystem; +using Files.Uwp.Filesystem; using Files.Uwp.Helpers; using Files.Uwp.ViewModels.Properties; using System.Collections.Generic; diff --git a/src/Files.Uwp/ViewModels/Previews/TextPreviewViewModel.cs b/src/Files.Uwp/ViewModels/Previews/TextPreviewViewModel.cs index 0fe074215356..3e20445a1f19 100644 --- a/src/Files.Uwp/ViewModels/Previews/TextPreviewViewModel.cs +++ b/src/Files.Uwp/ViewModels/Previews/TextPreviewViewModel.cs @@ -1,4 +1,4 @@ -using Files.Shared.Extensions; +using Files.Shared.Extensions; using Files.Uwp.Filesystem; using Files.Uwp.UserControls.FilePreviews; using Files.Uwp.ViewModels.Properties; diff --git a/src/Files.Uwp/ViewModels/Properties/BaseProperties.cs b/src/Files.Uwp/ViewModels/Properties/BaseProperties.cs index 8a5f300c8763..cbe270c5f41b 100644 --- a/src/Files.Uwp/ViewModels/Properties/BaseProperties.cs +++ b/src/Files.Uwp/ViewModels/Properties/BaseProperties.cs @@ -1,4 +1,4 @@ -using CommunityToolkit.Mvvm.DependencyInjection; +using CommunityToolkit.Mvvm.DependencyInjection; using Files.Backend.Extensions; using Files.Shared.Services.DateTimeFormatter; using Files.Uwp.Extensions; @@ -24,7 +24,9 @@ public abstract class BaseProperties public CancellationTokenSource TokenSource { get; set; } - public CoreDispatcher Dispatcher { get; set; } + public /* + TODO UA306_A1: UWP CoreDispatcher : Windows.UI.Core.CoreDispatcher is no longer supported. Use DispatcherQueue instead. Read: https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/guides/threading + */CoreDispatcher Dispatcher { get; set; } public abstract void GetBaseProperties(); diff --git a/src/Files.Uwp/ViewModels/Properties/CombinedProperties.cs b/src/Files.Uwp/ViewModels/Properties/CombinedProperties.cs index 12186bc6eb98..2eedc4cb26d2 100644 --- a/src/Files.Uwp/ViewModels/Properties/CombinedProperties.cs +++ b/src/Files.Uwp/ViewModels/Properties/CombinedProperties.cs @@ -1,4 +1,4 @@ -using Files.Uwp.Extensions; +using Files.Uwp.Extensions; using Files.Uwp.Filesystem; using Files.Uwp.Helpers; using Microsoft.Toolkit.Uwp; @@ -18,7 +18,9 @@ internal class CombinedProperties : BaseProperties public List List { get; } public CombinedProperties(SelectedItemsPropertiesViewModel viewModel, CancellationTokenSource tokenSource, - CoreDispatcher coreDispatcher, List listedItems, IShellPage instance) +/* + TODO UA306_A1: UWP CoreDispatcher : Windows.UI.Core.CoreDispatcher is no longer supported. Use DispatcherQueue instead. Read: https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/guides/threading + */CoreDispatcher coreDispatcher, List listedItems, IShellPage instance) { ViewModel = viewModel; TokenSource = tokenSource; diff --git a/src/Files.Uwp/ViewModels/Properties/CompatibilityProperties.cs b/src/Files.Uwp/ViewModels/Properties/CompatibilityProperties.cs index 142de186f29a..ad5473eedb2a 100644 --- a/src/Files.Uwp/ViewModels/Properties/CompatibilityProperties.cs +++ b/src/Files.Uwp/ViewModels/Properties/CompatibilityProperties.cs @@ -1,4 +1,4 @@ -using Files.Shared; +using Files.Shared; using Files.Shared.Extensions; using Files.Uwp.Filesystem; using Files.Uwp.Helpers; diff --git a/src/Files.Uwp/ViewModels/Properties/DriveProperties.cs b/src/Files.Uwp/ViewModels/Properties/DriveProperties.cs index 552fbe828abc..735b3244bd60 100644 --- a/src/Files.Uwp/ViewModels/Properties/DriveProperties.cs +++ b/src/Files.Uwp/ViewModels/Properties/DriveProperties.cs @@ -1,4 +1,4 @@ -using Files.Uwp.DataModels.NavigationControlItems; +using Files.Uwp.DataModels.NavigationControlItems; using Files.Uwp.Filesystem; using Files.Uwp.Filesystem.StorageItems; using Files.Uwp.Helpers; diff --git a/src/Files.Uwp/ViewModels/Properties/FileProperties.cs b/src/Files.Uwp/ViewModels/Properties/FileProperties.cs index e83e398a8a0f..0c0bc8513478 100644 --- a/src/Files.Uwp/ViewModels/Properties/FileProperties.cs +++ b/src/Files.Uwp/ViewModels/Properties/FileProperties.cs @@ -1,4 +1,4 @@ -using Files.Uwp.Extensions; +using Files.Uwp.Extensions; using Files.Uwp.Filesystem; using Files.Uwp.Filesystem.StorageItems; using Files.Uwp.Helpers; @@ -21,7 +21,7 @@ using Windows.Storage; using Windows.Storage.Streams; using Windows.UI.Core; -using Windows.UI.Xaml; +using Microsoft.UI.Xaml; namespace Files.Uwp.ViewModels.Properties { @@ -31,7 +31,9 @@ public class FileProperties : BaseProperties private IProgress hashProgress; - public FileProperties(SelectedItemsPropertiesViewModel viewModel, CancellationTokenSource tokenSource, CoreDispatcher coreDispatcher, IProgress hashProgress, ListedItem item, IShellPage instance) + public FileProperties(SelectedItemsPropertiesViewModel viewModel, CancellationTokenSource tokenSource, /* + TODO UA306_A1: UWP CoreDispatcher : Windows.UI.Core.CoreDispatcher is no longer supported. Use DispatcherQueue instead. Read: https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/guides/threading + */CoreDispatcher coreDispatcher, IProgress hashProgress, ListedItem item, IShellPage instance) { ViewModel = viewModel; TokenSource = tokenSource; diff --git a/src/Files.Uwp/ViewModels/Properties/FileProperty.cs b/src/Files.Uwp/ViewModels/Properties/FileProperty.cs index 1eca436517cc..53e91243baf9 100644 --- a/src/Files.Uwp/ViewModels/Properties/FileProperty.cs +++ b/src/Files.Uwp/ViewModels/Properties/FileProperty.cs @@ -1,4 +1,4 @@ -using Files.Uwp.Converters; +using Files.Uwp.Converters; using Files.Uwp.Filesystem.StorageItems; using Files.Uwp.Helpers; using CommunityToolkit.Mvvm.ComponentModel; @@ -10,8 +10,8 @@ using System.Linq; using System.Threading.Tasks; using Windows.Storage; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Data; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Data; namespace Files.Uwp.ViewModels.Properties { diff --git a/src/Files.Uwp/ViewModels/Properties/FilePropertySection.cs b/src/Files.Uwp/ViewModels/Properties/FilePropertySection.cs index 389ae8c88b92..768ae357379a 100644 --- a/src/Files.Uwp/ViewModels/Properties/FilePropertySection.cs +++ b/src/Files.Uwp/ViewModels/Properties/FilePropertySection.cs @@ -1,6 +1,6 @@ -using Microsoft.Toolkit.Uwp; +using Microsoft.Toolkit.Uwp; using System.Collections.Generic; -using Windows.UI.Xaml; +using Microsoft.UI.Xaml; namespace Files.Uwp.ViewModels.Properties { diff --git a/src/Files.Uwp/ViewModels/Properties/FolderProperties.cs b/src/Files.Uwp/ViewModels/Properties/FolderProperties.cs index ace2f88a2f6d..6cab8d35d644 100644 --- a/src/Files.Uwp/ViewModels/Properties/FolderProperties.cs +++ b/src/Files.Uwp/ViewModels/Properties/FolderProperties.cs @@ -1,4 +1,4 @@ -using ByteSizeLib; +using ByteSizeLib; using CommunityToolkit.Mvvm.Input; using Files.Uwp.Extensions; using Files.Uwp.Filesystem; @@ -19,7 +19,9 @@ internal class FolderProperties : BaseProperties { public ListedItem Item { get; } - public FolderProperties(SelectedItemsPropertiesViewModel viewModel, CancellationTokenSource tokenSource, CoreDispatcher coreDispatcher, ListedItem item, IShellPage instance) + public FolderProperties(SelectedItemsPropertiesViewModel viewModel, CancellationTokenSource tokenSource, /* + TODO UA306_A1: UWP CoreDispatcher : Windows.UI.Core.CoreDispatcher is no longer supported. Use DispatcherQueue instead. Read: https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/guides/threading + */CoreDispatcher coreDispatcher, ListedItem item, IShellPage instance) { ViewModel = viewModel; TokenSource = tokenSource; diff --git a/src/Files.Uwp/ViewModels/Properties/LibraryProperties.cs b/src/Files.Uwp/ViewModels/Properties/LibraryProperties.cs index 1c83ef47e78b..282a5657d13d 100644 --- a/src/Files.Uwp/ViewModels/Properties/LibraryProperties.cs +++ b/src/Files.Uwp/ViewModels/Properties/LibraryProperties.cs @@ -1,4 +1,4 @@ -using CommunityToolkit.Mvvm.DependencyInjection; +using CommunityToolkit.Mvvm.DependencyInjection; using Files.Shared.Services.DateTimeFormatter; using Files.Uwp.Extensions; using Files.Uwp.Filesystem; @@ -19,7 +19,9 @@ internal class LibraryProperties : BaseProperties public LibraryItem Library { get; private set; } - public LibraryProperties(SelectedItemsPropertiesViewModel viewModel, CancellationTokenSource tokenSource, CoreDispatcher coreDispatcher, LibraryItem item, IShellPage instance) + public LibraryProperties(SelectedItemsPropertiesViewModel viewModel, CancellationTokenSource tokenSource, /* + TODO UA306_A1: UWP CoreDispatcher : Windows.UI.Core.CoreDispatcher is no longer supported. Use DispatcherQueue instead. Read: https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/guides/threading + */CoreDispatcher coreDispatcher, LibraryItem item, IShellPage instance) { ViewModel = viewModel; TokenSource = tokenSource; diff --git a/src/Files.Uwp/ViewModels/Properties/PropertiesTab.cs b/src/Files.Uwp/ViewModels/Properties/PropertiesTab.cs index 7a3ed52e84d6..fb1137ff16fd 100644 --- a/src/Files.Uwp/ViewModels/Properties/PropertiesTab.cs +++ b/src/Files.Uwp/ViewModels/Properties/PropertiesTab.cs @@ -1,12 +1,12 @@ -using Files.Uwp.DataModels.NavigationControlItems; +using Files.Uwp.DataModels.NavigationControlItems; using Files.Uwp.Filesystem; using System; using System.Collections.Generic; using System.Threading.Tasks; using Windows.Storage; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Navigation; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Navigation; namespace Files.Uwp.ViewModels.Properties { diff --git a/src/Files.Uwp/ViewModels/Properties/SecurityProperties.cs b/src/Files.Uwp/ViewModels/Properties/SecurityProperties.cs index ef0f8a68fc40..ee23d059e1da 100644 --- a/src/Files.Uwp/ViewModels/Properties/SecurityProperties.cs +++ b/src/Files.Uwp/ViewModels/Properties/SecurityProperties.cs @@ -1,4 +1,4 @@ -using Files.Shared; +using Files.Shared; using Files.Uwp.DataModels.NavigationControlItems; using Files.Uwp.Filesystem; using Files.Uwp.Filesystem.Permissions; diff --git a/src/Files.Uwp/ViewModels/SearchBoxViewModel.cs b/src/Files.Uwp/ViewModels/SearchBoxViewModel.cs index 134bdd8d186b..670033d4e961 100644 --- a/src/Files.Uwp/ViewModels/SearchBoxViewModel.cs +++ b/src/Files.Uwp/ViewModels/SearchBoxViewModel.cs @@ -1,12 +1,12 @@ -using Files.Uwp.Filesystem; +using Files.Uwp.Filesystem; using CommunityToolkit.Mvvm.ComponentModel; using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using Windows.Foundation; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Input; +using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Input; namespace Files.Uwp.ViewModels { diff --git a/src/Files.Uwp/ViewModels/SelectedItemsPropertiesViewModel.cs b/src/Files.Uwp/ViewModels/SelectedItemsPropertiesViewModel.cs index 15a28809179d..3b9238ccb19e 100644 --- a/src/Files.Uwp/ViewModels/SelectedItemsPropertiesViewModel.cs +++ b/src/Files.Uwp/ViewModels/SelectedItemsPropertiesViewModel.cs @@ -4,7 +4,7 @@ using CommunityToolkit.Mvvm.Input; using System; using System.Collections.ObjectModel; -using Windows.UI.Xaml; +using Microsoft.UI.Xaml; namespace Files.Uwp.ViewModels { diff --git a/src/Files.Uwp/ViewModels/SettingsViewModels/AboutViewModel.cs b/src/Files.Uwp/ViewModels/SettingsViewModels/AboutViewModel.cs index e9444aae00a8..66c5dfdf85d3 100644 --- a/src/Files.Uwp/ViewModels/SettingsViewModels/AboutViewModel.cs +++ b/src/Files.Uwp/ViewModels/SettingsViewModels/AboutViewModel.cs @@ -1,4 +1,4 @@ -using Files.Backend.Services.Settings; +using Files.Backend.Services.Settings; using Files.Uwp.Filesystem; using Files.Uwp.Filesystem.StorageItems; using Files.Uwp.Helpers; @@ -17,7 +17,7 @@ using Windows.Storage; using Windows.Storage.Pickers; using Windows.System; -using Windows.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Controls; namespace Files.Uwp.ViewModels.SettingsViewModels { @@ -50,7 +50,7 @@ public AboutViewModel() private async Task ExportSettings() { - FileSavePicker filePicker = new FileSavePicker(); + FileSavePicker filePicker = this.InitializeWithWindow(new FileSavePicker()); filePicker.FileTypeChoices.Add("Zip File", new[] { ".zip" }); filePicker.SuggestedFileName = $"Files_{App.AppVersion}"; @@ -97,10 +97,15 @@ private async Task ExportSettings() } } } + private FileSavePicker InitializeWithWindow(FileSavePicker obj) + { + WinRT.Interop.InitializeWithWindow.Initialize(obj, App.WindowHandle); + return obj; + } private async Task ImportSettings() { - FileOpenPicker filePicker = new FileOpenPicker(); + FileOpenPicker filePicker = this.InitializeWithWindow(new FileOpenPicker()); filePicker.FileTypeFilter.Add(".zip"); StorageFile file = await filePicker.PickSingleFileAsync(); @@ -150,6 +155,11 @@ private async Task ImportSettings() } } } + private FileOpenPicker InitializeWithWindow(FileOpenPicker obj) + { + WinRT.Interop.InitializeWithWindow.Initialize(obj, App.WindowHandle); + return obj; + } public void CopyVersionInfo() { diff --git a/src/Files.Uwp/ViewModels/SettingsViewModels/AppearanceViewModel.cs b/src/Files.Uwp/ViewModels/SettingsViewModels/AppearanceViewModel.cs index 42c0dd080355..c5158e7358dd 100644 --- a/src/Files.Uwp/ViewModels/SettingsViewModels/AppearanceViewModel.cs +++ b/src/Files.Uwp/ViewModels/SettingsViewModels/AppearanceViewModel.cs @@ -1,4 +1,4 @@ -using CommunityToolkit.Mvvm.ComponentModel; +using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.DependencyInjection; using Files.Backend.Services.Settings; using Files.Uwp.Helpers; @@ -7,7 +7,7 @@ using System.Collections.Generic; using System.Threading.Tasks; using Windows.ApplicationModel.Core; -using Windows.UI.Xaml; +using Microsoft.UI.Xaml; namespace Files.Uwp.ViewModels.SettingsViewModels { @@ -251,7 +251,9 @@ public bool ShowFileTagsSection public async Task OpenThemesFolder() { - await CoreApplication.MainView.Dispatcher.YieldAsync(); + await /* + TODO UA306_A2: UWP CoreDispatcher : Windows.UI.Core.CoreDispatcher is no longer supported. Use DispatcherQueue instead. Read: https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/guides/threading + */CoreApplication.MainView.Dispatcher.YieldAsync(); await NavigationHelpers.OpenPathInNewTab(App.ExternalResourcesHelper.ImportedThemesFolder.Path); } } diff --git a/src/Files.Uwp/ViewModels/SettingsViewModels/ExperimentalViewModel.cs b/src/Files.Uwp/ViewModels/SettingsViewModels/ExperimentalViewModel.cs index bfeeb86ca75c..9ad0b7610bce 100644 --- a/src/Files.Uwp/ViewModels/SettingsViewModels/ExperimentalViewModel.cs +++ b/src/Files.Uwp/ViewModels/SettingsViewModels/ExperimentalViewModel.cs @@ -1,4 +1,4 @@ -using Files.Shared.Extensions; +using Files.Shared.Extensions; using Files.Uwp.Helpers; using Files.Backend.Services.Settings; using CommunityToolkit.Mvvm.ComponentModel; diff --git a/src/Files.Uwp/ViewModels/SettingsViewModels/MultitaskingViewModel.cs b/src/Files.Uwp/ViewModels/SettingsViewModels/MultitaskingViewModel.cs index 5b4a060ab087..f063c4b3b673 100644 --- a/src/Files.Uwp/ViewModels/SettingsViewModels/MultitaskingViewModel.cs +++ b/src/Files.Uwp/ViewModels/SettingsViewModels/MultitaskingViewModel.cs @@ -1,4 +1,4 @@ -using Files.Backend.Services.Settings; +using Files.Backend.Services.Settings; using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.DependencyInjection; diff --git a/src/Files.Uwp/ViewModels/SettingsViewModels/PreferencesViewModel.cs b/src/Files.Uwp/ViewModels/SettingsViewModels/PreferencesViewModel.cs index 6c4d02044bf1..5dae9a685239 100644 --- a/src/Files.Uwp/ViewModels/SettingsViewModels/PreferencesViewModel.cs +++ b/src/Files.Uwp/ViewModels/SettingsViewModels/PreferencesViewModel.cs @@ -1,4 +1,4 @@ -using CommunityToolkit.Mvvm.ComponentModel; +using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.DependencyInjection; using CommunityToolkit.Mvvm.Input; using Files.Backend.Services.Settings; @@ -221,7 +221,7 @@ public bool AlwaysOpenANewInstance private async Task ChangePage() { - var folderPicker = new FolderPicker(); + var folderPicker = this.InitializeWithWindow(new FolderPicker()); folderPicker.FileTypeFilter.Add("*"); StorageFolder folder = await folderPicker.PickSingleFolderAsync(); @@ -233,6 +233,11 @@ private async Task ChangePage() } } } + private FolderPicker InitializeWithWindow(FolderPicker obj) + { + WinRT.Interop.InitializeWithWindow.Initialize(obj, App.WindowHandle); + return obj; + } private void RemovePage() { @@ -255,7 +260,7 @@ private async Task AddPage(string path = null) { if (string.IsNullOrWhiteSpace(path)) { - var folderPicker = new FolderPicker(); + var folderPicker = this.InitializeWithWindow(new FolderPicker()); folderPicker.FileTypeFilter.Add("*"); var folder = await folderPicker.PickSingleFolderAsync(); diff --git a/src/Files.Uwp/ViewModels/SidebarViewModel.cs b/src/Files.Uwp/ViewModels/SidebarViewModel.cs index e7dc564a5fff..b59054a62af9 100644 --- a/src/Files.Uwp/ViewModels/SidebarViewModel.cs +++ b/src/Files.Uwp/ViewModels/SidebarViewModel.cs @@ -1,4 +1,4 @@ -using CommunityToolkit.Mvvm.ComponentModel; +using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.DependencyInjection; using CommunityToolkit.Mvvm.Input; using Files.Backend.Services.Settings; @@ -18,8 +18,8 @@ using System.Threading.Tasks; using System.Windows.Input; using Windows.System; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Media.Imaging; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Media.Imaging; namespace Files.Uwp.ViewModels { diff --git a/src/Files.Uwp/ViewModels/StatusCenterViewModel.cs b/src/Files.Uwp/ViewModels/StatusCenterViewModel.cs index 2effe680f486..f59ccf4ff56b 100644 --- a/src/Files.Uwp/ViewModels/StatusCenterViewModel.cs +++ b/src/Files.Uwp/ViewModels/StatusCenterViewModel.cs @@ -1,4 +1,4 @@ -using Files.Shared.Enums; +using Files.Shared.Enums; using Files.Uwp.Helpers; using Files.Uwp.Interacts; using CommunityToolkit.Mvvm.ComponentModel; @@ -11,9 +11,9 @@ using System.Threading; using System.Windows.Input; using Windows.UI; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Media; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Media; namespace Files.Uwp.ViewModels { diff --git a/src/Files.Uwp/ViewModels/ToolbarViewModel.cs b/src/Files.Uwp/ViewModels/ToolbarViewModel.cs index 1c8ae2cc7931..2cb412d13b7b 100644 --- a/src/Files.Uwp/ViewModels/ToolbarViewModel.cs +++ b/src/Files.Uwp/ViewModels/ToolbarViewModel.cs @@ -1,4 +1,4 @@ -using CommunityToolkit.Mvvm.ComponentModel; +using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.DependencyInjection; using CommunityToolkit.Mvvm.Input; using Files.Backend.Services; @@ -25,10 +25,10 @@ using Windows.Storage; using Windows.System; using Windows.UI.Text; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Controls.Primitives; -using Windows.UI.Xaml.Input; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Controls.Primitives; +using Microsoft.UI.Xaml.Input; using static Files.Uwp.UserControls.IAddressToolbar; using SearchBox = Files.Uwp.UserControls.SearchBox; using SortDirection = Files.Shared.Enums.SortDirection; @@ -716,7 +716,15 @@ public async void PathBoxItem_Tapped(object sender, TappedRoutedEventArgs e) if (pointerRoutedEventArgs != null) { - await Windows.UI.Core.CoreWindow.GetForCurrentThread().Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Low, async () => + await /* + TODO UA306_A2: UWP CoreDispatcher : Windows.UI.Core.CoreDispatcher is no longer supported. Use DispatcherQueue instead. Read: https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/guides/threading + */ + /* + TODO UA315_B + Use Microsoft.UI.Windowing.AppWindow.Create instead of GetForCurrentThread. + Read: https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/guides/windowing + */ + Windows.UI.Core.CoreWindow.GetForCurrentThread().Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Low, async () => { await MainPageViewModel.AddNewTabByPathAsync(typeof(PaneHolderPage), itemTappedPath); }); @@ -756,7 +764,7 @@ public void UpdateAdditionalActions() OnPropertyChanged(nameof(CanEmptyRecycleBin)); } - private AddressToolbar AddressToolbar => (Window.Current.Content as Frame).FindDescendant(); + private AddressToolbar AddressToolbar => (App.Window.Content as Frame).FindDescendant(); #region WidgetsPage Widgets diff --git a/src/Files.Uwp/ViewModels/Widgets/Bundles/BundleContainerViewModel.cs b/src/Files.Uwp/ViewModels/Widgets/Bundles/BundleContainerViewModel.cs index f944ae46a1a3..e689ccd97051 100644 --- a/src/Files.Uwp/ViewModels/Widgets/Bundles/BundleContainerViewModel.cs +++ b/src/Files.Uwp/ViewModels/Widgets/Bundles/BundleContainerViewModel.cs @@ -1,4 +1,4 @@ -using Files.Uwp.Dialogs; +using Files.Uwp.Dialogs; using Files.Shared.Enums; using Files.Uwp.Filesystem; using Files.Uwp.Helpers; @@ -19,8 +19,8 @@ using Windows.Storage; using Windows.Storage.Pickers; using Windows.System; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; namespace Files.Uwp.ViewModels.Widgets.Bundles { @@ -135,7 +135,7 @@ public BundleContainerViewModel() private async Task AddFolder() { - FolderPicker folderPicker = new FolderPicker(); + FolderPicker folderPicker = this.InitializeWithWindow(new FolderPicker()); folderPicker.FileTypeFilter.Add("*"); StorageFolder folder = await folderPicker.PickSingleFolderAsync(); @@ -146,10 +146,15 @@ private async Task AddFolder() SaveBundle(); } } + private FolderPicker InitializeWithWindow(FolderPicker obj) + { + WinRT.Interop.InitializeWithWindow.Initialize(obj, App.WindowHandle); + return obj; + } private async Task AddFile() { - FileOpenPicker filePicker = new FileOpenPicker(); + FileOpenPicker filePicker = this.InitializeWithWindow(new FileOpenPicker()); filePicker.FileTypeFilter.Add("*"); StorageFile file = await filePicker.PickSingleFileAsync(); @@ -160,6 +165,11 @@ private async Task AddFile() SaveBundle(); } } + private FileOpenPicker InitializeWithWindow(FileOpenPicker obj) + { + WinRT.Interop.InitializeWithWindow.Initialize(obj, App.WindowHandle); + return obj; + } private void RemoveBundle() { diff --git a/src/Files.Uwp/ViewModels/Widgets/Bundles/BundleItemViewModel.cs b/src/Files.Uwp/ViewModels/Widgets/Bundles/BundleItemViewModel.cs index ceedbd2afea7..dd3ce7ac6390 100644 --- a/src/Files.Uwp/ViewModels/Widgets/Bundles/BundleItemViewModel.cs +++ b/src/Files.Uwp/ViewModels/Widgets/Bundles/BundleItemViewModel.cs @@ -1,4 +1,4 @@ -using Files.Shared.Extensions; +using Files.Shared.Extensions; using Files.Uwp.Filesystem; using Files.Uwp.Helpers; using Files.Backend.Services.Settings; @@ -11,8 +11,8 @@ using System.Threading.Tasks; using System.Windows.Input; using Windows.Storage.FileProperties; -using Windows.UI.Xaml.Media; -using Windows.UI.Xaml.Media.Imaging; +using Microsoft.UI.Xaml.Media; +using Microsoft.UI.Xaml.Media.Imaging; namespace Files.Uwp.ViewModels.Widgets.Bundles { diff --git a/src/Files.Uwp/ViewModels/Widgets/Bundles/BundlesViewModel.cs b/src/Files.Uwp/ViewModels/Widgets/Bundles/BundlesViewModel.cs index f5652a0b265e..57615e1d70bf 100644 --- a/src/Files.Uwp/ViewModels/Widgets/Bundles/BundlesViewModel.cs +++ b/src/Files.Uwp/ViewModels/Widgets/Bundles/BundlesViewModel.cs @@ -1,4 +1,4 @@ -using Files.Uwp.Dialogs; +using Files.Uwp.Dialogs; using Files.Shared.Enums; using Files.Uwp.EventArguments.Bundles; using Files.Uwp.Filesystem; @@ -19,9 +19,9 @@ using Windows.Storage; using Windows.Storage.Pickers; using Windows.System; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Input; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Input; namespace Files.Uwp.ViewModels.Widgets.Bundles { @@ -225,7 +225,7 @@ private void AddBundle(string name) private async Task ImportBundles() { - FileOpenPicker filePicker = new FileOpenPicker(); + FileOpenPicker filePicker = this.InitializeWithWindow(new FileOpenPicker()); filePicker.FileTypeFilter.Add(System.IO.Path.GetExtension(Constants.LocalSettings.BundlesSettingsFileName)); StorageFile file = await filePicker.PickSingleFileAsync(); @@ -241,10 +241,15 @@ private async Task ImportBundles() } } } + private FileOpenPicker InitializeWithWindow(FileOpenPicker obj) + { + WinRT.Interop.InitializeWithWindow.Initialize(obj, App.WindowHandle); + return obj; + } private async Task ExportBundles() { - FileSavePicker filePicker = new FileSavePicker(); + FileSavePicker filePicker = this.InitializeWithWindow(new FileSavePicker()); filePicker.FileTypeChoices.Add("Json File", new List() { System.IO.Path.GetExtension(Constants.LocalSettings.BundlesSettingsFileName) }); StorageFile file = await filePicker.PickSaveFileAsync(); @@ -253,6 +258,11 @@ private async Task ExportBundles() NativeFileOperationsHelper.WriteStringToFile(file.Path, (string)BundlesSettingsService.ExportSettings()); } } + private FileSavePicker InitializeWithWindow(FileSavePicker obj) + { + WinRT.Interop.InitializeWithWindow.Initialize(obj, App.WindowHandle); + return obj; + } #endregion Command Implementation diff --git a/src/Files.Uwp/ViewModels/Widgets/ICustomWidgetItemModel.cs b/src/Files.Uwp/ViewModels/Widgets/ICustomWidgetItemModel.cs index ed78a838aa4c..560d15f8d5a2 100644 --- a/src/Files.Uwp/ViewModels/Widgets/ICustomWidgetItemModel.cs +++ b/src/Files.Uwp/ViewModels/Widgets/ICustomWidgetItemModel.cs @@ -1,4 +1,4 @@ -namespace Files.Uwp.ViewModels.Widgets +namespace Files.Uwp.ViewModels.Widgets { /// /// This interface is used to mark widgets that are not standard to Files i.e. custom widgets diff --git a/src/Files.Uwp/ViewModels/Widgets/IWidgetItemModel.cs b/src/Files.Uwp/ViewModels/Widgets/IWidgetItemModel.cs index 513da040e88d..99fc2f4082ca 100644 --- a/src/Files.Uwp/ViewModels/Widgets/IWidgetItemModel.cs +++ b/src/Files.Uwp/ViewModels/Widgets/IWidgetItemModel.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Threading.Tasks; namespace Files.Uwp.ViewModels.Widgets diff --git a/src/Files.Uwp/ViewModels/Widgets/WidgetsListControlItemViewModel.cs b/src/Files.Uwp/ViewModels/Widgets/WidgetsListControlItemViewModel.cs index ef827807e9e2..b3a0df190a9a 100644 --- a/src/Files.Uwp/ViewModels/Widgets/WidgetsListControlItemViewModel.cs +++ b/src/Files.Uwp/ViewModels/Widgets/WidgetsListControlItemViewModel.cs @@ -1,4 +1,4 @@ -using CommunityToolkit.Mvvm.ComponentModel; +using CommunityToolkit.Mvvm.ComponentModel; using System; namespace Files.Uwp.ViewModels.Widgets diff --git a/src/Files.Uwp/ViewModels/Widgets/WidgetsListControlViewModel.cs b/src/Files.Uwp/ViewModels/Widgets/WidgetsListControlViewModel.cs index eb33288732a0..75a472a9b222 100644 --- a/src/Files.Uwp/ViewModels/Widgets/WidgetsListControlViewModel.cs +++ b/src/Files.Uwp/ViewModels/Widgets/WidgetsListControlViewModel.cs @@ -1,4 +1,4 @@ -using CommunityToolkit.Mvvm.ComponentModel; +using CommunityToolkit.Mvvm.ComponentModel; using System; using System.Collections.ObjectModel; using System.Linq; diff --git a/src/Files.Uwp/Views/Brushes/MicaBrush.cs b/src/Files.Uwp/Views/Brushes/MicaBrush.cs index 06568fc719e0..33d6dcd3c1ee 100644 --- a/src/Files.Uwp/Views/Brushes/MicaBrush.cs +++ b/src/Files.Uwp/Views/Brushes/MicaBrush.cs @@ -1,17 +1,17 @@ -using System; +using System; using System.Collections.Generic; using Windows.ApplicationModel; using Windows.System; using Windows.System.Power; using Windows.UI; -using Windows.UI.Composition; +using Microsoft.UI.Composition; using Windows.UI.Input; using Windows.UI.Input.Preview; using Windows.UI.ViewManagement; using Windows.UI.WindowManagement; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Hosting; -using Windows.UI.Xaml.Media; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Hosting; +using Microsoft.UI.Xaml.Media; using Windows.Foundation.Metadata; using System.Runtime.InteropServices; using Microsoft.Graphics.Canvas.Effects; @@ -28,7 +28,7 @@ public MicaBrush(bool checkForCompositionSupport = true) FallbackColor = Colors.Transparent; - _wallpaperBrushSupported = checkForCompositionSupport ? ApiInformation.IsMethodPresent("Windows.UI.Composition.Compositor", "TryCreateBlurredWallpaperBackdropBrush") : true; + _wallpaperBrushSupported = checkForCompositionSupport ? ApiInformation.IsMethodPresent("Microsoft.UI.Composition.Compositor", "TryCreateBlurredWallpaperBackdropBrush") : true; } [ComImport] @@ -39,7 +39,12 @@ interface ICompositorWithBlurredWallpaperBackdropBrush CompositionBackdropBrush TryCreateBlurredWallpaperBackdropBrush(); } - public void SetAppWindow(AppWindow window) + public void SetAppWindow( + /* + TODO UA315_A Use Microsoft.UI.Windowing.AppWindow for window Management instead of ApplicationView/CoreWindow or Microsoft.UI.Windowing.AppWindow APIs + Read: https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/guides/windowing + */ + Microsoft.UI.Windowing.AppWindow window) { if (_window != null) { @@ -145,7 +150,7 @@ private void UpdateBrush() bool useSolidColorFallback = !_settings.AdvancedEffectsEnabled || !_wallpaperBrushSupported || !_windowActivated || _fastEffects == false || _energySaver == true; - Compositor compositor = Window.Current.Compositor; + Compositor compositor = App.Window.Compositor; ElementTheme currentTheme = root.ActualTheme; Color tintColor = currentTheme == ElementTheme.Light ? Color.FromArgb(255, 243, 243, 243) : Color.FromArgb(255, 32, 32, 32); @@ -201,7 +206,12 @@ private void UpdateBrush() } } - private void AppWindow_Changed(AppWindow sender, AppWindowChangedEventArgs args) + private void AppWindow_Changed( + /* + TODO UA315_A Use Microsoft.UI.Windowing.AppWindow for window Management instead of ApplicationView/CoreWindow or Microsoft.UI.Windowing.AppWindow APIs + Read: https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/guides/windowing + */ + Microsoft.UI.Windowing.AppWindow sender, AppWindowChangedEventArgs args) { // InputActivationListener.CreateForApplicationWindow throws an exception if called too early // Delay it until the window visibility has changed @@ -333,7 +343,12 @@ protected override void OnDisconnected() private UISettings _settings; private AccessibilitySettings _accessibilitySettings; private bool _windowActivated; - private AppWindow _window; + private + /* + TODO UA315_A Use Microsoft.UI.Windowing.AppWindow for window Management instead of ApplicationView/CoreWindow or Microsoft.UI.Windowing.AppWindow APIs + Read: https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/guides/windowing + */ + Microsoft.UI.Windowing.AppWindow _window; private InputActivationListener _appWindowActivationListener; private FrameworkElement _root; } diff --git a/src/Files.Uwp/Views/ColumnParam.cs b/src/Files.Uwp/Views/ColumnParam.cs index 654ef0cc784a..a6ff954c7fa9 100644 --- a/src/Files.Uwp/Views/ColumnParam.cs +++ b/src/Files.Uwp/Views/ColumnParam.cs @@ -1,4 +1,4 @@ -using Windows.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Controls; namespace Files.Uwp.Views { diff --git a/src/Files.Uwp/Views/ColumnShellPage.xaml.cs b/src/Files.Uwp/Views/ColumnShellPage.xaml.cs index 24cd61d6e611..5008209435cf 100644 --- a/src/Files.Uwp/Views/ColumnShellPage.xaml.cs +++ b/src/Files.Uwp/Views/ColumnShellPage.xaml.cs @@ -22,16 +22,16 @@ using System.Runtime.CompilerServices; using System.Threading; using System.Threading.Tasks; -using Windows.ApplicationModel.Resources.Core; +using Microsoft.Windows.ApplicationModel.Resources; using Windows.Storage; using Windows.System; using Windows.UI.Core; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Input; -using Windows.UI.Xaml.Media; -using Windows.UI.Xaml.Media.Animation; -using Windows.UI.Xaml.Navigation; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Input; +using Microsoft.UI.Xaml.Media; +using Microsoft.UI.Xaml.Media.Animation; +using Microsoft.UI.Xaml.Navigation; using Files.Uwp.Interacts; using SortDirection = Files.Shared.Enums.SortDirection; using Files.Backend.Enums; @@ -153,7 +153,12 @@ public ColumnShellPage() DisplayFilesystemConsentDialog(); - var flowDirectionSetting = ResourceContext.GetForCurrentView().QualifierValues["LayoutDirection"]; + var flowDirectionSetting = /* + TODO ResourceContext.GetForCurrentView and ResourceContext.GetForViewIndependentUse do not exist in Windows App SDK + Use your ResourceManager instance to create a ResourceContext as below. If you already have a ResourceManager instance, + replace the new instance created below with correct instance. + Read: https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/guides/mrtcore + */new Microsoft.Windows.ApplicationModel.Resources.ResourceManager().CreateResourceContext().QualifierValues["LayoutDirection"]; if (flowDirectionSetting == "RTL") { @@ -172,7 +177,14 @@ public ColumnShellPage() ToolbarViewModel.ToolbarPathItemLoaded += ColumnShellPage_ToolbarPathItemLoaded; ToolbarViewModel.AddressBarTextEntered += ColumnShellPage_AddressBarTextEntered; ToolbarViewModel.PathBoxItemDropped += ColumnShellPage_PathBoxItemDropped; - ToolbarViewModel.BackRequested += ColumnShellPage_BackNavRequested; + + /* + + TODO UA307 Default back button in the title bar does not exist in WinUI3 apps. + The tool has generated a custom back button in the MainWindow.xaml.cs file. + Feel free to edit its position, behavior and use the custom back button instead. + Read: https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/case-study-1#restoring-back-button-functionality + */ToolbarViewModel.BackRequested += ColumnShellPage_BackNavRequested; ToolbarViewModel.UpRequested += ColumnShellPage_UpNavRequested; ToolbarViewModel.RefreshRequested += ColumnShellPage_RefreshRequested; ToolbarViewModel.ForwardRequested += ColumnShellPage_ForwardNavRequested; @@ -191,8 +203,15 @@ public ColumnShellPage() InstanceViewModel.FolderSettings.SortOptionPreferenceUpdated += AppSettings_SortOptionPreferenceUpdated; InstanceViewModel.FolderSettings.SortDirectoriesAlongsideFilesPreferenceUpdated += AppSettings_SortDirectoriesAlongsideFilesPreferenceUpdated; - Window.Current.CoreWindow.PointerPressed += CoreWindow_PointerPressed; - SystemNavigationManager.GetForCurrentView().BackRequested += ColumnShellPage_BackRequested; + App.Window.CoreWindow.PointerPressed += CoreWindow_PointerPressed; + + /* + + TODO UA307 Default back button in the title bar does not exist in WinUI3 apps. + The tool has generated a custom back button in the MainWindow.xaml.cs file. + Feel free to edit its position, behavior and use the custom back button instead. + Read: https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/case-study-1#restoring-back-button-functionality + */SystemNavigationManager.GetForCurrentView().BackRequested += ColumnShellPage_BackRequested; App.DrivesManager.PropertyChanged += DrivesManager_PropertyChanged; @@ -205,9 +224,9 @@ public ColumnShellPage() */ private async void ColumnShellPage_PreviewKeyDown(object sender, KeyRoutedEventArgs args) { - var ctrl = Window.Current.CoreWindow.GetKeyState(VirtualKey.Control).HasFlag(CoreVirtualKeyStates.Down); - var shift = Window.Current.CoreWindow.GetKeyState(VirtualKey.Shift).HasFlag(CoreVirtualKeyStates.Down); - var alt = Window.Current.CoreWindow.GetKeyState(VirtualKey.Menu).HasFlag(CoreVirtualKeyStates.Down); + var ctrl = App.Window.CoreWindow.GetKeyState(VirtualKey.Control).HasFlag(CoreVirtualKeyStates.Down); + var shift = App.Window.CoreWindow.GetKeyState(VirtualKey.Shift).HasFlag(CoreVirtualKeyStates.Down); + var alt = App.Window.CoreWindow.GetKeyState(VirtualKey.Menu).HasFlag(CoreVirtualKeyStates.Down); var tabInstance = CurrentPageType == typeof(DetailsLayoutBrowser) || CurrentPageType == typeof(GridViewBrowser) || CurrentPageType == typeof(ColumnViewBrowser) || @@ -464,7 +483,9 @@ private void DrivesManager_PropertyChanged(object sender, System.ComponentModel. private async Task GetContentOrNullAsync() { BaseLayout FrameContent = null; - await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, + await /* + TODO UA306_A2: UWP CoreDispatcher : Windows.UI.Core.CoreDispatcher is no longer supported. Use DispatcherQueue instead. Read: https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/guides/threading + */Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { FrameContent = ItemDisplayFrame.Content as BaseLayout; @@ -878,7 +899,7 @@ private void SelectSidebarItemFromPath(Type incomingSourcePageType = null) public void Dispose() { PreviewKeyDown -= ColumnShellPage_PreviewKeyDown; - Window.Current.CoreWindow.PointerPressed -= CoreWindow_PointerPressed; + App.Window.CoreWindow.PointerPressed -= CoreWindow_PointerPressed; SystemNavigationManager.GetForCurrentView().BackRequested -= ColumnShellPage_BackRequested; App.DrivesManager.PropertyChanged -= DrivesManager_PropertyChanged; @@ -982,7 +1003,7 @@ private void FilesystemViewModel_ItemLoadStatusChanged(object sender, ItemLoadSt private void SetLoadingIndicatorForTabs(bool isLoading) { - var multitaskingControls = ((Window.Current.Content as Frame).Content as MainPage).ViewModel.MultitaskingControls; + var multitaskingControls = ((App.Window.Content as Frame).Content as MainPage).ViewModel.MultitaskingControls; foreach (var x in multitaskingControls) { diff --git a/src/Files.Uwp/Views/CustomFolderIcons.xaml.cs b/src/Files.Uwp/Views/CustomFolderIcons.xaml.cs index 6a19105def4d..3b48d5b7a5f2 100644 --- a/src/Files.Uwp/Views/CustomFolderIcons.xaml.cs +++ b/src/Files.Uwp/Views/CustomFolderIcons.xaml.cs @@ -1,4 +1,4 @@ -using Files.Shared; +using Files.Shared; using Files.Uwp.Helpers; using CommunityToolkit.Mvvm.Input; using Microsoft.Toolkit.Uwp; @@ -11,9 +11,9 @@ using Windows.ApplicationModel.Core; using Windows.Foundation.Collections; using Windows.UI.Core; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Navigation; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Navigation; using static Files.Uwp.Views.PropertiesCustomization; using Files.Shared.Extensions; @@ -124,7 +124,9 @@ await CoreApplication.MainView.DispatcherQueue.EnqueueAsync(() => { appInstance?.FilesystemViewModel?.RefreshItems(null, async () => { - await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => RestoreDefaultButton.IsEnabled = true); + await /* + TODO UA306_A2: UWP CoreDispatcher : Windows.UI.Core.CoreDispatcher is no longer supported. Use DispatcherQueue instead. Read: https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/guides/threading + */Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => RestoreDefaultButton.IsEnabled = true); }); }); } diff --git a/src/Files.Uwp/Views/LayoutModes/ColumnViewBase.xaml.cs b/src/Files.Uwp/Views/LayoutModes/ColumnViewBase.xaml.cs index 75a50a41cf8f..ef96289beaf1 100644 --- a/src/Files.Uwp/Views/LayoutModes/ColumnViewBase.xaml.cs +++ b/src/Files.Uwp/Views/LayoutModes/ColumnViewBase.xaml.cs @@ -1,4 +1,4 @@ -using Files.Uwp.EventArguments; +using Files.Uwp.EventArguments; using Files.Uwp.Filesystem; using Files.Uwp.Helpers; using Files.Uwp.Helpers.XamlHelpers; @@ -12,11 +12,11 @@ using Windows.Storage; using Windows.System; using Windows.UI.Core; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Controls.Primitives; -using Windows.UI.Xaml.Input; -using Windows.UI.Xaml.Navigation; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Controls.Primitives; +using Microsoft.UI.Xaml.Input; +using Microsoft.UI.Xaml.Navigation; using static Files.Uwp.Constants; namespace Files.Uwp.Views.LayoutModes @@ -356,8 +356,8 @@ private void FileList_PreviewKeyUp(object sender, KeyRoutedEventArgs e) private async void FileList_PreviewKeyDown(object sender, KeyRoutedEventArgs e) { - var ctrlPressed = Window.Current.CoreWindow.GetKeyState(VirtualKey.Control).HasFlag(CoreVirtualKeyStates.Down); - var shiftPressed = Window.Current.CoreWindow.GetKeyState(VirtualKey.Shift).HasFlag(CoreVirtualKeyStates.Down); + var ctrlPressed = App.Window.CoreWindow.GetKeyState(VirtualKey.Control).HasFlag(CoreVirtualKeyStates.Down); + var shiftPressed = App.Window.CoreWindow.GetKeyState(VirtualKey.Shift).HasFlag(CoreVirtualKeyStates.Down); if (e.Key == VirtualKey.Enter && !e.KeyStatus.IsMenuKeyDown) { @@ -493,8 +493,8 @@ private void HandleRightClick(object sender, HoldingRoutedEventArgs e) private void FileList_ItemTapped(object sender, TappedRoutedEventArgs e) { - var ctrlPressed = Window.Current.CoreWindow.GetKeyState(VirtualKey.Control).HasFlag(CoreVirtualKeyStates.Down); - var shiftPressed = Window.Current.CoreWindow.GetKeyState(VirtualKey.Shift).HasFlag(CoreVirtualKeyStates.Down); + var ctrlPressed = App.Window.CoreWindow.GetKeyState(VirtualKey.Control).HasFlag(CoreVirtualKeyStates.Down); + var shiftPressed = App.Window.CoreWindow.GetKeyState(VirtualKey.Shift).HasFlag(CoreVirtualKeyStates.Down); var item = (e.OriginalSource as FrameworkElement)?.DataContext as ListedItem; if (ctrlPressed || shiftPressed) // Allow for Ctrl+Shift selection diff --git a/src/Files.Uwp/Views/LayoutModes/ColumnViewBrowser.xaml.cs b/src/Files.Uwp/Views/LayoutModes/ColumnViewBrowser.xaml.cs index e834f8819f6f..ca90590e41b3 100644 --- a/src/Files.Uwp/Views/LayoutModes/ColumnViewBrowser.xaml.cs +++ b/src/Files.Uwp/Views/LayoutModes/ColumnViewBrowser.xaml.cs @@ -1,4 +1,4 @@ -using Files.Uwp.Extensions; +using Files.Uwp.Extensions; using Files.Uwp.Filesystem; using Files.Uwp.Helpers; using Files.Uwp.Interacts; @@ -8,9 +8,9 @@ using Microsoft.Toolkit.Uwp.UI.Controls; using System; using System.Linq; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Navigation; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Navigation; using static Files.Uwp.Constants; namespace Files.Uwp.Views.LayoutModes diff --git a/src/Files.Uwp/Views/LayoutModes/DetailsLayoutBrowser.xaml.cs b/src/Files.Uwp/Views/LayoutModes/DetailsLayoutBrowser.xaml.cs index 6eea7380a280..b5ad38afefa3 100644 --- a/src/Files.Uwp/Views/LayoutModes/DetailsLayoutBrowser.xaml.cs +++ b/src/Files.Uwp/Views/LayoutModes/DetailsLayoutBrowser.xaml.cs @@ -16,12 +16,12 @@ using Windows.Storage; using Windows.System; using Windows.UI.Core; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Controls.Primitives; -using Windows.UI.Xaml.Input; -using Windows.UI.Xaml.Media; -using Windows.UI.Xaml.Navigation; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Controls.Primitives; +using Microsoft.UI.Xaml.Input; +using Microsoft.UI.Xaml.Media; +using Microsoft.UI.Xaml.Navigation; using SortDirection = Files.Shared.Enums.SortDirection; @@ -449,8 +449,8 @@ private void EndRename(TextBox textBox) private async void FileList_PreviewKeyDown(object sender, KeyRoutedEventArgs e) { - var ctrlPressed = Window.Current.CoreWindow.GetKeyState(VirtualKey.Control).HasFlag(CoreVirtualKeyStates.Down); - var shiftPressed = Window.Current.CoreWindow.GetKeyState(VirtualKey.Shift).HasFlag(CoreVirtualKeyStates.Down); + var ctrlPressed = App.Window.CoreWindow.GetKeyState(VirtualKey.Control).HasFlag(CoreVirtualKeyStates.Down); + var shiftPressed = App.Window.CoreWindow.GetKeyState(VirtualKey.Shift).HasFlag(CoreVirtualKeyStates.Down); var focusedElement = FocusManager.GetFocusedElement() as FrameworkElement; var isHeaderFocused = DependencyObjectHelpers.FindParent(focusedElement) != null; var isFooterFocused = focusedElement is HyperlinkButton; @@ -558,8 +558,8 @@ private async void ReloadItemIcons() private void FileList_ItemTapped(object sender, TappedRoutedEventArgs e) { - var ctrlPressed = Window.Current.CoreWindow.GetKeyState(VirtualKey.Control).HasFlag(CoreVirtualKeyStates.Down); - var shiftPressed = Window.Current.CoreWindow.GetKeyState(VirtualKey.Shift).HasFlag(CoreVirtualKeyStates.Down); + var ctrlPressed = App.Window.CoreWindow.GetKeyState(VirtualKey.Control).HasFlag(CoreVirtualKeyStates.Down); + var shiftPressed = App.Window.CoreWindow.GetKeyState(VirtualKey.Shift).HasFlag(CoreVirtualKeyStates.Down); var item = (e.OriginalSource as FrameworkElement)?.DataContext as ListedItem; if (item == null) { diff --git a/src/Files.Uwp/Views/LayoutModes/GridViewBrowser.xaml.cs b/src/Files.Uwp/Views/LayoutModes/GridViewBrowser.xaml.cs index 8a0299adbe0a..6ba4229e1a98 100644 --- a/src/Files.Uwp/Views/LayoutModes/GridViewBrowser.xaml.cs +++ b/src/Files.Uwp/Views/LayoutModes/GridViewBrowser.xaml.cs @@ -1,4 +1,4 @@ -using Files.Shared.Enums; +using Files.Shared.Enums; using Files.Uwp.EventArguments; using Files.Uwp.Filesystem; using Files.Uwp.Helpers; @@ -12,12 +12,12 @@ using Windows.Storage; using Windows.System; using Windows.UI.Core; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Controls.Primitives; -using Windows.UI.Xaml.Input; -using Windows.UI.Xaml.Media; -using Windows.UI.Xaml.Navigation; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Controls.Primitives; +using Microsoft.UI.Xaml.Input; +using Microsoft.UI.Xaml.Media; +using Microsoft.UI.Xaml.Navigation; namespace Files.Uwp.Views.LayoutModes { @@ -381,8 +381,8 @@ private void EndRename(TextBox textBox) private async void FileList_PreviewKeyDown(object sender, KeyRoutedEventArgs e) { - var ctrlPressed = Window.Current.CoreWindow.GetKeyState(VirtualKey.Control).HasFlag(CoreVirtualKeyStates.Down); - var shiftPressed = Window.Current.CoreWindow.GetKeyState(VirtualKey.Shift).HasFlag(CoreVirtualKeyStates.Down); + var ctrlPressed = App.Window.CoreWindow.GetKeyState(VirtualKey.Control).HasFlag(CoreVirtualKeyStates.Down); + var shiftPressed = App.Window.CoreWindow.GetKeyState(VirtualKey.Shift).HasFlag(CoreVirtualKeyStates.Down); var focusedElement = FocusManager.GetFocusedElement() as FrameworkElement; var isFooterFocused = focusedElement is HyperlinkButton; @@ -499,8 +499,8 @@ private async void ReloadSelectedItemsIcon() private void FileList_ItemTapped(object sender, TappedRoutedEventArgs e) { - var ctrlPressed = Window.Current.CoreWindow.GetKeyState(VirtualKey.Control).HasFlag(CoreVirtualKeyStates.Down); - var shiftPressed = Window.Current.CoreWindow.GetKeyState(VirtualKey.Shift).HasFlag(CoreVirtualKeyStates.Down); + var ctrlPressed = App.Window.CoreWindow.GetKeyState(VirtualKey.Control).HasFlag(CoreVirtualKeyStates.Down); + var shiftPressed = App.Window.CoreWindow.GetKeyState(VirtualKey.Shift).HasFlag(CoreVirtualKeyStates.Down); var item = (e.OriginalSource as FrameworkElement)?.DataContext as ListedItem; if (item == null) { diff --git a/src/Files.Uwp/Views/MainPage.xaml.cs b/src/Files.Uwp/Views/MainPage.xaml.cs index 3a7f3ca0160c..156f891ae33b 100644 --- a/src/Files.Uwp/Views/MainPage.xaml.cs +++ b/src/Files.Uwp/Views/MainPage.xaml.cs @@ -1,4 +1,4 @@ -using CommunityToolkit.Mvvm.DependencyInjection; +using CommunityToolkit.Mvvm.DependencyInjection; using CommunityToolkit.Mvvm.Input; using Files.Backend.Extensions; using Files.Backend.Services.Settings; @@ -20,14 +20,14 @@ using System.Windows.Input; using Windows.ApplicationModel; using Windows.ApplicationModel.Core; -using Windows.ApplicationModel.Resources.Core; +using Microsoft.Windows.ApplicationModel.Resources; using Windows.Services.Store; using Windows.Storage; using Windows.UI.ViewManagement; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Input; -using Windows.UI.Xaml.Navigation; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Input; +using Microsoft.UI.Xaml.Navigation; namespace Files.Uwp.Views { @@ -63,11 +63,20 @@ public MainPage() { InitializeComponent(); - ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.Auto; + /* + TODO UA315_A Use Microsoft.UI.Windowing.AppWindow for window Management instead of ApplicationView/CoreWindow or Microsoft.UI.Windowing.AppWindow APIs + Read: https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/guides/windowing + */ + ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.Auto; var CoreTitleBar = CoreApplication.GetCurrentView().TitleBar; CoreTitleBar.ExtendViewIntoTitleBar = true; CoreTitleBar.LayoutMetricsChanged += TitleBar_LayoutMetricsChanged; - var flowDirectionSetting = ResourceContext.GetForCurrentView().QualifierValues["LayoutDirection"]; + var flowDirectionSetting = /* + TODO ResourceContext.GetForCurrentView and ResourceContext.GetForViewIndependentUse do not exist in Windows App SDK + Use your ResourceManager instance to create a ResourceContext as below. If you already have a ResourceManager instance, + replace the new instance created below with correct instance. + Read: https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/guides/mrtcore + */new Microsoft.Windows.ApplicationModel.Resources.ResourceManager().CreateResourceContext().QualifierValues["LayoutDirection"]; if (flowDirectionSetting == "RTL") { @@ -98,7 +107,7 @@ private async void PromptForReview() SecondaryButtonText = "No".ToLocalized() }; - var result = await AskForReviewDialog.ShowAsync(); + var result = await this.SetContentDialogRoot(AskForReviewDialog).ShowAsync(); if (result == ContentDialogResult.Primary) { @@ -110,6 +119,14 @@ private async void PromptForReview() catch (Exception) { } } } + private ContentDialog SetContentDialogRoot(ContentDialog contentDialog) + { + if (Windows.Foundation.Metadata.ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 8)) + { + contentDialog.XamlRoot = this.Content.XamlRoot; + } + return contentDialog; + } private void UserSettingsService_OnSettingChangedEvent(object sender, SettingChangedEventArgs e) { @@ -150,7 +167,7 @@ private void VerticalTabStripInvokeButton_Loaded(object sender, RoutedEventArgs private void DragArea_Loaded(object sender, RoutedEventArgs e) { - Window.Current.SetTitleBar(sender as Grid); + App.Window.SetTitleBar(sender as Grid); } private void TitleBar_LayoutMetricsChanged(CoreApplicationViewTitleBar sender, object args) @@ -367,17 +384,17 @@ private void Page_Loaded(object sender, RoutedEventArgs e) FindName(nameof(NavToolbar)); // the adaptive triggers do not evaluate on app startup, manually checking and calling GoToState here fixes https://github.com/files-community/Files/issues/5801 - if (Window.Current.Bounds.Width < CollapseSearchBoxAdaptiveTrigger.MinWindowWidth) + if (App.Window.Bounds.Width < CollapseSearchBoxAdaptiveTrigger.MinWindowWidth) { _ = VisualStateManager.GoToState(this, nameof(CollapseSearchBoxState), true); } - if (Window.Current.Bounds.Width < MinimalSidebarAdaptiveTrigger.MinWindowWidth) + if (App.Window.Bounds.Width < MinimalSidebarAdaptiveTrigger.MinWindowWidth) { _ = VisualStateManager.GoToState(this, nameof(MinimalSidebarState), true); } - if (Window.Current.Bounds.Width < CollapseHorizontalTabViewTrigger.MinWindowWidth) + if (App.Window.Bounds.Width < CollapseHorizontalTabViewTrigger.MinWindowWidth) { _ = VisualStateManager.GoToState(this, nameof(HorizontalTabViewCollapsed), true); } @@ -400,7 +417,17 @@ private void Page_SizeChanged(object sender, SizeChangedEventArgs e) private void ToggleFullScreenAccelerator(KeyboardAcceleratorInvokedEventArgs e) { - ApplicationView view = ApplicationView.GetForCurrentView(); + + /* + TODO UA315_A Use Microsoft.UI.Windowing.AppWindow for window Management instead of ApplicationView/CoreWindow or Microsoft.UI.Windowing.AppWindow APIs + Read: https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/guides/windowing + */ + ApplicationView view = + /* + TODO UA315_A Use Microsoft.UI.Windowing.AppWindow for window Management instead of ApplicationView/CoreWindow or Microsoft.UI.Windowing.AppWindow APIs + Read: https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/guides/windowing + */ + ApplicationView.GetForCurrentView(); if (view.IsFullScreenMode) { view.ExitFullScreenMode(); @@ -512,7 +539,7 @@ public bool IsPreviewPaneEnabled { bool isHomePage = !(SidebarAdaptiveViewModel.PaneHolder?.ActivePane?.InstanceViewModel?.IsPageTypeNotHome ?? false); bool isMultiPane = SidebarAdaptiveViewModel.PaneHolder?.IsMultiPaneActive ?? false; - bool isBigEnough = Window.Current.Bounds.Width > 450 && Window.Current.Bounds.Height > 400; + bool isBigEnough = App.Window.Bounds.Width > 450 && App.Window.Bounds.Height > 400; return (!isHomePage || isMultiPane) && isBigEnough; } @@ -532,11 +559,21 @@ private void OnPropertyChanged([CallerMemberName] string propertyName = "") PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } - private void ToggleCompactOverlay() => SetCompactOverlay(ApplicationView.GetForCurrentView().ViewMode != ApplicationViewMode.CompactOverlay); + private void ToggleCompactOverlay() => SetCompactOverlay( + /* + TODO UA315_A Use Microsoft.UI.Windowing.AppWindow for window Management instead of ApplicationView/CoreWindow or Microsoft.UI.Windowing.AppWindow APIs + Read: https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/guides/windowing + */ + ApplicationView.GetForCurrentView().ViewMode != ApplicationViewMode.CompactOverlay); private async void SetCompactOverlay(bool isCompact) { - var view = ApplicationView.GetForCurrentView(); + var view = + /* + TODO UA315_A Use Microsoft.UI.Windowing.AppWindow for window Management instead of ApplicationView/CoreWindow or Microsoft.UI.Windowing.AppWindow APIs + Read: https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/guides/windowing + */ + ApplicationView.GetForCurrentView(); if (!isCompact) { diff --git a/src/Files.Uwp/Views/ModernShellPage.xaml.cs b/src/Files.Uwp/Views/ModernShellPage.xaml.cs index e5ccc9eeadec..441d79639849 100644 --- a/src/Files.Uwp/Views/ModernShellPage.xaml.cs +++ b/src/Files.Uwp/Views/ModernShellPage.xaml.cs @@ -1,4 +1,4 @@ -using Files.Shared; +using Files.Shared; using Files.Uwp.Dialogs; using Files.Shared.Enums; using Files.Uwp.EventArguments; @@ -22,16 +22,16 @@ using System.Runtime.CompilerServices; using System.Threading; using System.Threading.Tasks; -using Windows.ApplicationModel.Resources.Core; +using Microsoft.Windows.ApplicationModel.Resources; using Windows.Storage; using Windows.System; using Windows.UI.Core; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Input; -using Windows.UI.Xaml.Media; -using Windows.UI.Xaml.Media.Animation; -using Windows.UI.Xaml.Navigation; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Input; +using Microsoft.UI.Xaml.Media; +using Microsoft.UI.Xaml.Media.Animation; +using Microsoft.UI.Xaml.Navigation; using SortDirection = Files.Shared.Enums.SortDirection; using Files.Backend.Enums; using Files.Backend.Services; @@ -159,7 +159,12 @@ public ModernShellPage() DisplayFilesystemConsentDialog(); - var flowDirectionSetting = ResourceContext.GetForCurrentView().QualifierValues["LayoutDirection"]; + var flowDirectionSetting = /* + TODO ResourceContext.GetForCurrentView and ResourceContext.GetForViewIndependentUse do not exist in Windows App SDK + Use your ResourceManager instance to create a ResourceContext as below. If you already have a ResourceManager instance, + replace the new instance created below with correct instance. + Read: https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/guides/mrtcore + */new Microsoft.Windows.ApplicationModel.Resources.ResourceManager().CreateResourceContext().QualifierValues["LayoutDirection"]; if (flowDirectionSetting == "RTL") { @@ -173,7 +178,14 @@ public ModernShellPage() ToolbarViewModel.ToolbarPathItemLoaded += ModernShellPage_ToolbarPathItemLoaded; ToolbarViewModel.AddressBarTextEntered += ModernShellPage_AddressBarTextEntered; ToolbarViewModel.PathBoxItemDropped += ModernShellPage_PathBoxItemDropped; - ToolbarViewModel.BackRequested += ModernShellPage_BackNavRequested; + + /* + + TODO UA307 Default back button in the title bar does not exist in WinUI3 apps. + The tool has generated a custom back button in the MainWindow.xaml.cs file. + Feel free to edit its position, behavior and use the custom back button instead. + Read: https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/case-study-1#restoring-back-button-functionality + */ToolbarViewModel.BackRequested += ModernShellPage_BackNavRequested; ToolbarViewModel.UpRequested += ModernShellPage_UpNavRequested; ToolbarViewModel.RefreshRequested += ModernShellPage_RefreshRequested; ToolbarViewModel.ForwardRequested += ModernShellPage_ForwardNavRequested; @@ -186,8 +198,15 @@ public ModernShellPage() InstanceViewModel.FolderSettings.SortOptionPreferenceUpdated += AppSettings_SortOptionPreferenceUpdated; InstanceViewModel.FolderSettings.SortDirectoriesAlongsideFilesPreferenceUpdated += AppSettings_SortDirectoriesAlongsideFilesPreferenceUpdated; - Window.Current.CoreWindow.PointerPressed += CoreWindow_PointerPressed; - SystemNavigationManager.GetForCurrentView().BackRequested += ModernShellPage_BackRequested; + App.Window.CoreWindow.PointerPressed += CoreWindow_PointerPressed; + + /* + + TODO UA307 Default back button in the title bar does not exist in WinUI3 apps. + The tool has generated a custom back button in the MainWindow.xaml.cs file. + Feel free to edit its position, behavior and use the custom back button instead. + Read: https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/case-study-1#restoring-back-button-functionality + */SystemNavigationManager.GetForCurrentView().BackRequested += ModernShellPage_BackRequested; App.DrivesManager.PropertyChanged += DrivesManager_PropertyChanged; @@ -200,9 +219,9 @@ public ModernShellPage() */ private async void ModernShellPage_PreviewKeyDown(object sender, KeyRoutedEventArgs args) { - var ctrl = Window.Current.CoreWindow.GetKeyState(VirtualKey.Control).HasFlag(CoreVirtualKeyStates.Down); - var shift = Window.Current.CoreWindow.GetKeyState(VirtualKey.Shift).HasFlag(CoreVirtualKeyStates.Down); - var alt = Window.Current.CoreWindow.GetKeyState(VirtualKey.Menu).HasFlag(CoreVirtualKeyStates.Down); + var ctrl = App.Window.CoreWindow.GetKeyState(VirtualKey.Control).HasFlag(CoreVirtualKeyStates.Down); + var shift = App.Window.CoreWindow.GetKeyState(VirtualKey.Shift).HasFlag(CoreVirtualKeyStates.Down); + var alt = App.Window.CoreWindow.GetKeyState(VirtualKey.Menu).HasFlag(CoreVirtualKeyStates.Down); var tabInstance = CurrentPageType == typeof(DetailsLayoutBrowser) || CurrentPageType == typeof(GridViewBrowser); @@ -497,7 +516,9 @@ private void DrivesManager_PropertyChanged(object sender, System.ComponentModel. private async Task GetContentOrNullAsync() { BaseLayout FrameContent = null; - await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, + await /* + TODO UA306_A2: UWP CoreDispatcher : Windows.UI.Core.CoreDispatcher is no longer supported. Use DispatcherQueue instead. Read: https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/guides/threading + */Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { FrameContent = ItemDisplayFrame.Content as BaseLayout; @@ -994,7 +1015,7 @@ private void SelectSidebarItemFromPath(Type incomingSourcePageType = null) public void Dispose() { PreviewKeyDown -= ModernShellPage_PreviewKeyDown; - Window.Current.CoreWindow.PointerPressed -= CoreWindow_PointerPressed; + App.Window.CoreWindow.PointerPressed -= CoreWindow_PointerPressed; SystemNavigationManager.GetForCurrentView().BackRequested -= ModernShellPage_BackRequested; App.DrivesManager.PropertyChanged -= DrivesManager_PropertyChanged; @@ -1095,7 +1116,7 @@ private void FilesystemViewModel_ItemLoadStatusChanged(object sender, ItemLoadSt private void SetLoadingIndicatorForTabs(bool isLoading) { - var multitaskingControls = ((Window.Current.Content as Frame).Content as MainPage).ViewModel.MultitaskingControls; + var multitaskingControls = ((App.Window.Content as Frame).Content as MainPage).ViewModel.MultitaskingControls; foreach (var x in multitaskingControls) { diff --git a/src/Files.Uwp/Views/Pages/Properties.xaml.cs b/src/Files.Uwp/Views/Pages/Properties.xaml.cs index 4d30478acc3e..95a12ab33d11 100644 --- a/src/Files.Uwp/Views/Pages/Properties.xaml.cs +++ b/src/Files.Uwp/Views/Pages/Properties.xaml.cs @@ -1,4 +1,4 @@ -using Files.Uwp.DataModels.NavigationControlItems; +using Files.Uwp.DataModels.NavigationControlItems; using Files.Uwp.Filesystem; using Files.Uwp.Helpers; using Files.Uwp.Helpers.XamlHelpers; @@ -8,20 +8,20 @@ using System; using System.Threading; using Windows.ApplicationModel.Core; -using Windows.ApplicationModel.Resources.Core; +using Microsoft.Windows.ApplicationModel.Resources; using Windows.Foundation.Metadata; using Windows.System; using Windows.UI; using Windows.UI.Core; using Windows.UI.ViewManagement; using Windows.UI.WindowManagement; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Input; -using Windows.UI.Xaml.Markup; -using Windows.UI.Xaml.Media; -using Windows.UI.Xaml.Media.Animation; -using Windows.UI.Xaml.Navigation; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Input; +using Microsoft.UI.Xaml.Markup; +using Microsoft.UI.Xaml.Media; +using Microsoft.UI.Xaml.Media.Animation; +using Microsoft.UI.Xaml.Navigation; namespace Files.Uwp.Views { @@ -47,13 +47,23 @@ public sealed partial class Properties : Page public SettingsViewModel AppSettings => App.AppSettings; - public AppWindow appWindow; + public + /* + TODO UA315_A Use Microsoft.UI.Windowing.AppWindow for window Management instead of ApplicationView/CoreWindow or Microsoft.UI.Windowing.AppWindow APIs + Read: https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/guides/windowing + */ + Microsoft.UI.Windowing.AppWindow appWindow; public Properties() { InitializeComponent(); - var flowDirectionSetting = ResourceContext.GetForCurrentView().QualifierValues["LayoutDirection"]; + var flowDirectionSetting = /* + TODO ResourceContext.GetForCurrentView and ResourceContext.GetForViewIndependentUse do not exist in Windows App SDK + Use your ResourceManager instance to create a ResourceContext as below. If you already have a ResourceManager instance, + replace the new instance created below with correct instance. + Read: https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/guides/mrtcore + */new Microsoft.Windows.ApplicationModel.Resources.ResourceManager().CreateResourceContext().QualifierValues["LayoutDirection"]; if (flowDirectionSetting == "RTL") { @@ -100,7 +110,7 @@ private async void Properties_Loaded(object sender, RoutedEventArgs e) _ => new SolidColorBrush((Color)Application.Current.Resources["SystemBaseHighColor"]) }; - var micaIsSupported = ApiInformation.IsMethodPresent("Windows.UI.Composition.Compositor", "TryCreateBlurredWallpaperBackdropBrush"); + var micaIsSupported = ApiInformation.IsMethodPresent("Microsoft.UI.Composition.Compositor", "TryCreateBlurredWallpaperBackdropBrush"); if (micaIsSupported) { micaBrush = new Brushes.MicaBrush(false); @@ -158,10 +168,15 @@ private async void Properties_Loaded(object sender, RoutedEventArgs e) { Microsoft.UI.Xaml.Controls.BackdropMaterial.SetApplyToRootOrPageBackground(sender as Control, true); - TitleBar = ApplicationView.GetForCurrentView().TitleBar; + TitleBar = + /* + TODO UA315_A Use Microsoft.UI.Windowing.AppWindow for window Management instead of ApplicationView/CoreWindow or Microsoft.UI.Windowing.AppWindow APIs + Read: https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/guides/windowing + */ + ApplicationView.GetForCurrentView().TitleBar; TitleBar.ButtonBackgroundColor = Colors.Transparent; TitleBar.ButtonInactiveBackgroundColor = Colors.Transparent; - Window.Current.SetTitleBar(TitleBarDragArea); + App.Window.SetTitleBar(TitleBarDragArea); } await CoreApplication.MainView.DispatcherQueue.EnqueueAsync(() => AppSettings.UpdateThemeElements.Execute(null)); } @@ -193,7 +208,9 @@ private void Properties_Unloaded(object sender, RoutedEventArgs e) private async void AppSettings_ThemeModeChanged(object sender, EventArgs e) { var selectedTheme = ThemeHelper.RootTheme; - await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => + await /* + TODO UA306_A2: UWP CoreDispatcher : Windows.UI.Core.CoreDispatcher is no longer supported. Use DispatcherQueue instead. Read: https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/guides/threading + */Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { RequestedTheme = selectedTheme; if (ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 8)) @@ -268,7 +285,12 @@ private async void OKButton_Click(object sender, RoutedEventArgs e) } else { - await ApplicationView.GetForCurrentView().TryConsolidateAsync(); + await + /* + TODO UA315_A Use Microsoft.UI.Windowing.AppWindow for window Management instead of ApplicationView/CoreWindow or Microsoft.UI.Windowing.AppWindow APIs + Read: https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/guides/windowing + */ + ApplicationView.GetForCurrentView().TryConsolidateAsync(); } } else @@ -287,7 +309,12 @@ private async void CancelButton_Click(object sender, RoutedEventArgs e) } else { - await ApplicationView.GetForCurrentView().TryConsolidateAsync(); + await + /* + TODO UA315_A Use Microsoft.UI.Windowing.AppWindow for window Management instead of ApplicationView/CoreWindow or Microsoft.UI.Windowing.AppWindow APIs + Read: https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/guides/windowing + */ + ApplicationView.GetForCurrentView().TryConsolidateAsync(); } } else @@ -308,7 +335,12 @@ private async void Page_KeyDown(object sender, KeyRoutedEventArgs e) } else { - await ApplicationView.GetForCurrentView().TryConsolidateAsync(); + await + /* + TODO UA315_A Use Microsoft.UI.Windowing.AppWindow for window Management instead of ApplicationView/CoreWindow or Microsoft.UI.Windowing.AppWindow APIs + Read: https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/guides/windowing + */ + ApplicationView.GetForCurrentView().TryConsolidateAsync(); } } else diff --git a/src/Files.Uwp/Views/Pages/PropertiesCompatibility.xaml.cs b/src/Files.Uwp/Views/Pages/PropertiesCompatibility.xaml.cs index c5524bf91877..be828b857b06 100644 --- a/src/Files.Uwp/Views/Pages/PropertiesCompatibility.xaml.cs +++ b/src/Files.Uwp/Views/Pages/PropertiesCompatibility.xaml.cs @@ -1,8 +1,8 @@ -using Files.Uwp.Filesystem; +using Files.Uwp.Filesystem; using Files.Uwp.ViewModels.Properties; using System.Threading.Tasks; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Navigation; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Navigation; namespace Files.Uwp.Views { diff --git a/src/Files.Uwp/Views/Pages/PropertiesCustomization.xaml.cs b/src/Files.Uwp/Views/Pages/PropertiesCustomization.xaml.cs index 7dd64116c0b5..1d77ab473cf1 100644 --- a/src/Files.Uwp/Views/Pages/PropertiesCustomization.xaml.cs +++ b/src/Files.Uwp/Views/Pages/PropertiesCustomization.xaml.cs @@ -1,9 +1,9 @@ -using Files.Uwp.Filesystem; +using Files.Uwp.Filesystem; using Files.Uwp.ViewModels.Properties; using System.Threading.Tasks; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Media.Animation; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Media.Animation; namespace Files.Uwp.Views { diff --git a/src/Files.Uwp/Views/Pages/PropertiesDetails.xaml.cs b/src/Files.Uwp/Views/Pages/PropertiesDetails.xaml.cs index ff3a358d4292..b664c359a8ea 100644 --- a/src/Files.Uwp/Views/Pages/PropertiesDetails.xaml.cs +++ b/src/Files.Uwp/Views/Pages/PropertiesDetails.xaml.cs @@ -1,11 +1,11 @@ -using Files.Uwp.Dialogs; +using Files.Uwp.Dialogs; using Files.Shared.Enums; using Files.Uwp.Filesystem; using Files.Uwp.Helpers; using Files.Uwp.ViewModels.Properties; using System.Diagnostics; using System.Threading.Tasks; -using Windows.UI.Xaml; +using Microsoft.UI.Xaml; namespace Files.Uwp.Views { diff --git a/src/Files.Uwp/Views/Pages/PropertiesGeneral.xaml.cs b/src/Files.Uwp/Views/Pages/PropertiesGeneral.xaml.cs index e665e5ceedee..d95f208fc61c 100644 --- a/src/Files.Uwp/Views/Pages/PropertiesGeneral.xaml.cs +++ b/src/Files.Uwp/Views/Pages/PropertiesGeneral.xaml.cs @@ -106,7 +106,7 @@ public override void Dispose() { } - private void DiskCleanupButton_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e) + private void DiskCleanupButton_Click(object sender, Microsoft.UI.Xaml.RoutedEventArgs e) { if (BaseProperties is DriveProperties driveProps) { diff --git a/src/Files.Uwp/Views/Pages/PropertiesLibrary.xaml.cs b/src/Files.Uwp/Views/Pages/PropertiesLibrary.xaml.cs index 703adf5e81f3..6ccfa00262d3 100644 --- a/src/Files.Uwp/Views/Pages/PropertiesLibrary.xaml.cs +++ b/src/Files.Uwp/Views/Pages/PropertiesLibrary.xaml.cs @@ -1,4 +1,4 @@ -using Files.Shared.Enums; +using Files.Shared.Enums; using Files.Uwp.Filesystem; using Files.Uwp.Helpers; using Files.Uwp.ViewModels.Properties; @@ -11,7 +11,7 @@ using System.Threading.Tasks; using System.Windows.Input; using Windows.Storage.Pickers; -using Windows.UI.Xaml; +using Microsoft.UI.Xaml; namespace Files.Uwp.Views { @@ -98,7 +98,7 @@ protected override void Properties_Loaded(object sender, RoutedEventArgs e) private async Task AddLocation() { - var folderPicker = new FolderPicker(); + var folderPicker = this.InitializeWithWindow(new FolderPicker()); folderPicker.FileTypeFilter.Add("*"); var folder = await folderPicker.PickSingleFolderAsync(); @@ -112,6 +112,11 @@ private async Task AddLocation() } } } + private FolderPicker InitializeWithWindow(FolderPicker obj) + { + WinRT.Interop.InitializeWithWindow.Initialize(obj, App.WindowHandle); + return obj; + } private void SetDefaultLocation() { diff --git a/src/Files.Uwp/Views/Pages/PropertiesSecurity.xaml.cs b/src/Files.Uwp/Views/Pages/PropertiesSecurity.xaml.cs index 1a774c01675c..32fb4d5b1953 100644 --- a/src/Files.Uwp/Views/Pages/PropertiesSecurity.xaml.cs +++ b/src/Files.Uwp/Views/Pages/PropertiesSecurity.xaml.cs @@ -1,4 +1,4 @@ -using Files.Uwp.DataModels.NavigationControlItems; +using Files.Uwp.DataModels.NavigationControlItems; using Files.Uwp.Filesystem; using Files.Uwp.ViewModels.Properties; using CommunityToolkit.Mvvm.Input; @@ -10,10 +10,10 @@ using Windows.Foundation.Metadata; using Windows.UI.Core; using Windows.UI.ViewManagement; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Media.Animation; -using Windows.UI.Xaml.Navigation; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Media.Animation; +using Microsoft.UI.Xaml.Navigation; using static Files.Uwp.Views.PropertiesSecurityAdvanced; namespace Files.Uwp.Views @@ -24,7 +24,12 @@ public sealed partial class PropertiesSecurity : PropertiesTab public SecurityProperties SecurityProperties { get; set; } - private ApplicationView propsView; + private + /* + TODO UA315_A Use Microsoft.UI.Windowing.AppWindow for window Management instead of ApplicationView/CoreWindow or Microsoft.UI.Windowing.AppWindow APIs + Read: https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/guides/windowing + */ + ApplicationView propsView; public PropertiesSecurity() { @@ -96,10 +101,15 @@ await newWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async () => { Item = SecurityProperties.Item }, new SuppressNavigationTransitionInfo()); - Window.Current.Content = frame; - Window.Current.Activate(); - - propsView = ApplicationView.GetForCurrentView(); + App.Window.Content = frame; + App.Window.Activate(); + + propsView = + /* + TODO UA315_A Use Microsoft.UI.Windowing.AppWindow for window Management instead of ApplicationView/CoreWindow or Microsoft.UI.Windowing.AppWindow APIs + Read: https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/guides/windowing + */ + ApplicationView.GetForCurrentView(); newWindow.TitleBar.ExtendViewIntoTitleBar = true; propsView.Title = string.Format("SecurityAdvancedPermissionsTitle".GetLocalized(), SecurityProperties.Item.ItemName); propsView.PersistedStateId = "PropertiesSecurity"; @@ -122,14 +132,21 @@ await newWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async () => } } - private async void PropsView_Consolidated(ApplicationView sender, ApplicationViewConsolidatedEventArgs args) + private async void PropsView_Consolidated( + /* + TODO UA315_A Use Microsoft.UI.Windowing.AppWindow for window Management instead of ApplicationView/CoreWindow or Microsoft.UI.Windowing.AppWindow APIs + Read: https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/guides/windowing + */ + ApplicationView sender, ApplicationViewConsolidatedEventArgs args) { propsView.Consolidated -= PropsView_Consolidated; propsView = null; if (SecurityProperties != null) { - await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => SecurityProperties.GetFilePermissions()); // Reload permissions + await /* + TODO UA306_A2: UWP CoreDispatcher : Windows.UI.Core.CoreDispatcher is no longer supported. Use DispatcherQueue instead. Read: https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/guides/threading + */Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => SecurityProperties.GetFilePermissions()); // Reload permissions } } } diff --git a/src/Files.Uwp/Views/Pages/PropertiesSecurityAdvanced.xaml.cs b/src/Files.Uwp/Views/Pages/PropertiesSecurityAdvanced.xaml.cs index 95793663f844..ceef6efc442d 100644 --- a/src/Files.Uwp/Views/Pages/PropertiesSecurityAdvanced.xaml.cs +++ b/src/Files.Uwp/Views/Pages/PropertiesSecurityAdvanced.xaml.cs @@ -1,4 +1,4 @@ -using Files.Uwp.DataModels.NavigationControlItems; +using Files.Uwp.DataModels.NavigationControlItems; using Files.Uwp.Filesystem; using Files.Uwp.Filesystem.Permissions; using Files.Uwp.Helpers; @@ -7,17 +7,17 @@ using System; using System.Linq; using Windows.ApplicationModel.Core; -using Windows.ApplicationModel.Resources.Core; +using Microsoft.Windows.ApplicationModel.Resources; using Windows.Foundation.Metadata; using Windows.System; using Windows.UI; using Windows.UI.Core; using Windows.UI.ViewManagement; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Input; -using Windows.UI.Xaml.Markup; -using Windows.UI.Xaml.Navigation; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Input; +using Microsoft.UI.Xaml.Markup; +using Microsoft.UI.Xaml.Navigation; // Il modello di elemento Pagina vuota è documentato all'indirizzo https://go.microsoft.com/fwlink/?LinkId=234238 @@ -40,7 +40,12 @@ public PropertiesSecurityAdvanced() { this.InitializeComponent(); - var flowDirectionSetting = ResourceContext.GetForCurrentView().QualifierValues["LayoutDirection"]; + var flowDirectionSetting = /* + TODO ResourceContext.GetForCurrentView and ResourceContext.GetForViewIndependentUse do not exist in Windows App SDK + Use your ResourceManager instance to create a ResourceContext as below. If you already have a ResourceManager instance, + replace the new instance created below with correct instance. + Read: https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/guides/mrtcore + */new Microsoft.Windows.ApplicationModel.Resources.ResourceManager().CreateResourceContext().QualifierValues["LayoutDirection"]; if (flowDirectionSetting == "RTL") { @@ -73,7 +78,12 @@ private async void Properties_Loaded(object sender, RoutedEventArgs e) if (ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 8)) { // Set window size in the loaded event to prevent flickering - TitleBar = ApplicationView.GetForCurrentView().TitleBar; + TitleBar = + /* + TODO UA315_A Use Microsoft.UI.Windowing.AppWindow for window Management instead of ApplicationView/CoreWindow or Microsoft.UI.Windowing.AppWindow APIs + Read: https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/guides/windowing + */ + ApplicationView.GetForCurrentView().TitleBar; TitleBar.ButtonBackgroundColor = Colors.Transparent; TitleBar.ButtonInactiveBackgroundColor = Colors.Transparent; await CoreApplication.MainView.DispatcherQueue.EnqueueAsync(() => App.AppSettings.UpdateThemeElements.Execute(null)); @@ -93,7 +103,9 @@ private void Properties_Unloaded(object sender, RoutedEventArgs e) private async void AppSettings_ThemeModeChanged(object sender, EventArgs e) { var selectedTheme = ThemeHelper.RootTheme; - await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => + await /* + TODO UA306_A2: UWP CoreDispatcher : Windows.UI.Core.CoreDispatcher is no longer supported. Use DispatcherQueue instead. Read: https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/guides/threading + */Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { RequestedTheme = selectedTheme; if (ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 8)) @@ -125,7 +137,12 @@ private async void OKButton_Click(object sender, RoutedEventArgs e) { if (await ViewModel.SetFilePermissions()) { - await ApplicationView.GetForCurrentView().TryConsolidateAsync(); + await + /* + TODO UA315_A Use Microsoft.UI.Windowing.AppWindow for window Management instead of ApplicationView/CoreWindow or Microsoft.UI.Windowing.AppWindow APIs + Read: https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/guides/windowing + */ + ApplicationView.GetForCurrentView().TryConsolidateAsync(); } } else @@ -137,7 +154,12 @@ private async void CancelButton_Click(object sender, RoutedEventArgs e) { if (ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 8)) { - await ApplicationView.GetForCurrentView().TryConsolidateAsync(); + await + /* + TODO UA315_A Use Microsoft.UI.Windowing.AppWindow for window Management instead of ApplicationView/CoreWindow or Microsoft.UI.Windowing.AppWindow APIs + Read: https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/guides/windowing + */ + ApplicationView.GetForCurrentView().TryConsolidateAsync(); } else { @@ -150,7 +172,12 @@ private async void Page_KeyDown(object sender, KeyRoutedEventArgs e) { if (ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 8)) { - await ApplicationView.GetForCurrentView().TryConsolidateAsync(); + await + /* + TODO UA315_A Use Microsoft.UI.Windowing.AppWindow for window Management instead of ApplicationView/CoreWindow or Microsoft.UI.Windowing.AppWindow APIs + Read: https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/guides/windowing + */ + ApplicationView.GetForCurrentView().TryConsolidateAsync(); } else { diff --git a/src/Files.Uwp/Views/Pages/PropertiesShortcut.xaml.cs b/src/Files.Uwp/Views/Pages/PropertiesShortcut.xaml.cs index 6369e055d40b..c886b38ce0b1 100644 --- a/src/Files.Uwp/Views/Pages/PropertiesShortcut.xaml.cs +++ b/src/Files.Uwp/Views/Pages/PropertiesShortcut.xaml.cs @@ -1,4 +1,4 @@ -using Files.Uwp.Filesystem; +using Files.Uwp.Filesystem; using Files.Uwp.ViewModels.Properties; using System.Threading.Tasks; diff --git a/src/Files.Uwp/Views/PaneHolderPage.xaml.cs b/src/Files.Uwp/Views/PaneHolderPage.xaml.cs index 2fa630c3d95b..f1462496afe0 100644 --- a/src/Files.Uwp/Views/PaneHolderPage.xaml.cs +++ b/src/Files.Uwp/Views/PaneHolderPage.xaml.cs @@ -1,4 +1,4 @@ -using Files.Uwp.Filesystem; +using Files.Uwp.Filesystem; using Files.Backend.Services.Settings; using Files.Uwp.UserControls.MultitaskingControl; using Files.Uwp.Views.LayoutModes; @@ -10,10 +10,10 @@ using System.Threading.Tasks; using Windows.System; using Windows.UI.Core; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Input; -using Windows.UI.Xaml.Navigation; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Input; +using Microsoft.UI.Xaml.Navigation; using Files.Shared.EventArguments; namespace Files.Uwp.Views @@ -46,7 +46,7 @@ public TabItemArguments TabItemArguments } } - private bool _windowIsCompact = Window.Current.Bounds.Width <= 750; + private bool _windowIsCompact = App.Window.Bounds.Width <= 750; private bool windowIsCompact { @@ -80,7 +80,7 @@ private bool windowIsCompact public bool IsMultiPaneEnabled { - get => UserSettingsService.MultitaskingSettingsService.IsDualPaneEnabled && !(Window.Current.Bounds.Width <= 750); + get => UserSettingsService.MultitaskingSettingsService.IsDualPaneEnabled && !(App.Window.Bounds.Width <= 750); } private NavigationParams navParamsLeft; @@ -198,7 +198,7 @@ public bool IsCurrentInstance public PaneHolderPage() { this.InitializeComponent(); - Window.Current.SizeChanged += Current_SizeChanged; + App.Window.SizeChanged += Current_SizeChanged; this.ActivePane = PaneLeft; this.IsRightPaneVisible = IsMultiPaneEnabled && UserSettingsService.MultitaskingSettingsService.AlwaysOpenDualPaneInNewTab; UserSettingsService.OnSettingChangedEvent += UserSettingsService_OnSettingChangedEvent; @@ -218,7 +218,7 @@ private void UserSettingsService_OnSettingChangedEvent(object sender, SettingCha private void Current_SizeChanged(object sender, WindowSizeChangedEventArgs e) { - windowIsCompact = Window.Current.Bounds.Width <= 750; + windowIsCompact = App.Window.Bounds.Width <= 750; } protected override void OnNavigatedTo(NavigationEventArgs eventArgs) @@ -364,7 +364,7 @@ private void Pane_GotFocus(object sender, RoutedEventArgs e) public void Dispose() { UserSettingsService.OnSettingChangedEvent -= UserSettingsService_OnSettingChangedEvent; - Window.Current.SizeChanged -= Current_SizeChanged; + App.Window.SizeChanged -= Current_SizeChanged; PaneLeft?.Dispose(); PaneRight?.Dispose(); PaneResizer.DoubleTapped -= PaneResizer_OnDoubleTapped; diff --git a/src/Files.Uwp/Views/SettingsPages/About.xaml.cs b/src/Files.Uwp/Views/SettingsPages/About.xaml.cs index 22c16c4d9db1..7c26fca7d672 100644 --- a/src/Files.Uwp/Views/SettingsPages/About.xaml.cs +++ b/src/Files.Uwp/Views/SettingsPages/About.xaml.cs @@ -1,5 +1,5 @@ -using Files.Uwp.ViewModels.SettingsViewModels; -using Windows.UI.Xaml.Controls; +using Files.Uwp.ViewModels.SettingsViewModels; +using Microsoft.UI.Xaml.Controls; namespace Files.Uwp.SettingsPages { diff --git a/src/Files.Uwp/Views/SettingsPages/Appearance.xaml.cs b/src/Files.Uwp/Views/SettingsPages/Appearance.xaml.cs index a104f016be8f..0ec505154762 100644 --- a/src/Files.Uwp/Views/SettingsPages/Appearance.xaml.cs +++ b/src/Files.Uwp/Views/SettingsPages/Appearance.xaml.cs @@ -1,9 +1,9 @@ -using Files.Uwp.Dialogs; +using Files.Uwp.Dialogs; using Files.Uwp.Helpers.XamlHelpers; using Files.Uwp.UserControls.Settings; using Microsoft.Toolkit.Uwp.UI; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; namespace Files.Uwp.SettingsPages { @@ -26,12 +26,12 @@ private void Appearance_Loaded(object sender, RoutedEventArgs e) } } - private void ThemesLearnMoreButton_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e) + private void ThemesLearnMoreButton_Click(object sender, Microsoft.UI.Xaml.RoutedEventArgs e) { ThemesTeachingTip.IsOpen = true; } - private async void OpenThemesFolderButton_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e) + private async void OpenThemesFolderButton_Click(object sender, Microsoft.UI.Xaml.RoutedEventArgs e) { ThemesTeachingTip.IsOpen = false; this.FindAscendant()?.Hide(); diff --git a/src/Files.Uwp/Views/SettingsPages/Experimental.xaml.cs b/src/Files.Uwp/Views/SettingsPages/Experimental.xaml.cs index 2eabd986ff36..cdd356236bde 100644 --- a/src/Files.Uwp/Views/SettingsPages/Experimental.xaml.cs +++ b/src/Files.Uwp/Views/SettingsPages/Experimental.xaml.cs @@ -1,4 +1,4 @@ -using Windows.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Controls; namespace Files.Uwp.SettingsPages { diff --git a/src/Files.Uwp/Views/SettingsPages/Multitasking.xaml.cs b/src/Files.Uwp/Views/SettingsPages/Multitasking.xaml.cs index 409573c2f5b1..439196918f85 100644 --- a/src/Files.Uwp/Views/SettingsPages/Multitasking.xaml.cs +++ b/src/Files.Uwp/Views/SettingsPages/Multitasking.xaml.cs @@ -1,5 +1,5 @@ -using Files.Uwp.ViewModels.SettingsViewModels; -using Windows.UI.Xaml.Controls; +using Files.Uwp.ViewModels.SettingsViewModels; +using Microsoft.UI.Xaml.Controls; namespace Files.Uwp.SettingsPages { diff --git a/src/Files.Uwp/Views/SettingsPages/Preferences.xaml.cs b/src/Files.Uwp/Views/SettingsPages/Preferences.xaml.cs index 4a15afd0ccc8..8fb1716a8d78 100644 --- a/src/Files.Uwp/Views/SettingsPages/Preferences.xaml.cs +++ b/src/Files.Uwp/Views/SettingsPages/Preferences.xaml.cs @@ -1,4 +1,4 @@ -using Windows.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Controls; namespace Files.Uwp.SettingsPages { diff --git a/src/Files.Uwp/Views/WidgetsPage.xaml.cs b/src/Files.Uwp/Views/WidgetsPage.xaml.cs index f3a9c4956461..d9673988d6d0 100644 --- a/src/Files.Uwp/Views/WidgetsPage.xaml.cs +++ b/src/Files.Uwp/Views/WidgetsPage.xaml.cs @@ -1,4 +1,4 @@ -using Files.Uwp.DataModels.NavigationControlItems; +using Files.Uwp.DataModels.NavigationControlItems; using Files.Uwp.Dialogs; using Files.Uwp.Filesystem; using Files.Uwp.Helpers; @@ -12,8 +12,8 @@ using System.IO; using System.Linq; using System.Runtime.InteropServices; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Navigation; +using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Navigation; using System.Threading.Tasks; namespace Files.Uwp.Views @@ -107,7 +107,7 @@ private void ReloadWidgets() } } - private void ViewModel_YourHomeLoadedInvoked(object sender, Windows.UI.Xaml.RoutedEventArgs e) + private void ViewModel_YourHomeLoadedInvoked(object sender, Microsoft.UI.Xaml.RoutedEventArgs e) { // We must change the associatedInstance because only now it has loaded and not null ViewModel.ChangeAppInstance(AppInstance); diff --git a/src/Files.Uwp/app.manifest b/src/Files.Uwp/app.manifest new file mode 100644 index 000000000000..aa2239d5538c --- /dev/null +++ b/src/Files.Uwp/app.manifest @@ -0,0 +1,15 @@ + + + + + + + + true/PM + PerMonitorV2, PerMonitor + + + From e31654c5b4cba833f7792bf967edad8e1cff5ca2 Mon Sep 17 00:00:00 2001 From: Marco Gavelli Date: Mon, 15 Aug 2022 03:44:29 +0200 Subject: [PATCH 02/99] Fix project files --- src/Files.Uwp.Storage/Files.Uwp.Storage.csproj | 9 +-------- src/Files.Uwp/Files.Uwp.csproj | 10 +++++----- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/src/Files.Uwp.Storage/Files.Uwp.Storage.csproj b/src/Files.Uwp.Storage/Files.Uwp.Storage.csproj index 958a12084518..28276f57d593 100644 --- a/src/Files.Uwp.Storage/Files.Uwp.Storage.csproj +++ b/src/Files.Uwp.Storage/Files.Uwp.Storage.csproj @@ -1,6 +1,6 @@  - net6.0-windows10.0.22000.0 + net6.0-windows10.0.19041.0 x86 Library en-US @@ -8,7 +8,6 @@ 9 enable true - app.manifest true x86;x64;arm64 win10-$(Platform).pubxml @@ -92,10 +91,4 @@ - - - - - - \ No newline at end of file diff --git a/src/Files.Uwp/Files.Uwp.csproj b/src/Files.Uwp/Files.Uwp.csproj index 152eac95d7c3..42b95b267573 100644 --- a/src/Files.Uwp/Files.Uwp.csproj +++ b/src/Files.Uwp/Files.Uwp.csproj @@ -13,6 +13,7 @@ False False Always + false False x86|x64|arm64 0 @@ -161,20 +162,19 @@ 8.0.0 - 36.1.0 + 37.1.0 2.5.2 + + 6.0.8 6.0.0 - - 2.0.1 - 13.0.1 @@ -201,7 +201,7 @@ - + From 906cf5fb5a67e27c619e15cf49a8f277712f15ad Mon Sep 17 00:00:00 2001 From: Marco Gavelli Date: Mon, 15 Aug 2022 03:46:19 +0200 Subject: [PATCH 03/99] Remove themes --- src/Files.Uwp/Themes/Acrylic.xaml | 188 --------------------- src/Files.Uwp/Themes/Blue Acrylic.xaml | 115 ------------- src/Files.Uwp/Themes/Bound to be Blue.xaml | 52 ------ src/Files.Uwp/Themes/Bronze.xaml | 52 ------ src/Files.Uwp/Themes/Burgundy.xaml | 52 ------ src/Files.Uwp/Themes/Deep Sea.xaml | 52 ------ src/Files.Uwp/Themes/Discord.xaml | 53 ------ src/Files.Uwp/Themes/Dracula.xaml | 52 ------ src/Files.Uwp/Themes/Glass.xaml | 172 ------------------- src/Files.Uwp/Themes/Green Grass.xaml | 52 ------ src/Files.Uwp/Themes/Lavender.xaml | 52 ------ src/Files.Uwp/Themes/Leaf Green.xaml | 52 ------ src/Files.Uwp/Themes/Luxury Red.xaml | 52 ------ src/Files.Uwp/Themes/Magentistic.xaml | 52 ------ src/Files.Uwp/Themes/Mica Imitation.xaml | 163 ------------------ src/Files.Uwp/Themes/Middle Blue.xaml | 44 ----- src/Files.Uwp/Themes/Nightshade.xaml | 50 ------ src/Files.Uwp/Themes/Nord.xaml | 52 ------ src/Files.Uwp/Themes/Red Wave.xaml | 37 ---- src/Files.Uwp/Themes/Solarized.xaml | 52 ------ src/Files.Uwp/Themes/Turquoise.xaml | 52 ------ 21 files changed, 1498 deletions(-) delete mode 100644 src/Files.Uwp/Themes/Acrylic.xaml delete mode 100644 src/Files.Uwp/Themes/Blue Acrylic.xaml delete mode 100644 src/Files.Uwp/Themes/Bound to be Blue.xaml delete mode 100644 src/Files.Uwp/Themes/Bronze.xaml delete mode 100644 src/Files.Uwp/Themes/Burgundy.xaml delete mode 100644 src/Files.Uwp/Themes/Deep Sea.xaml delete mode 100644 src/Files.Uwp/Themes/Discord.xaml delete mode 100644 src/Files.Uwp/Themes/Dracula.xaml delete mode 100644 src/Files.Uwp/Themes/Glass.xaml delete mode 100644 src/Files.Uwp/Themes/Green Grass.xaml delete mode 100644 src/Files.Uwp/Themes/Lavender.xaml delete mode 100644 src/Files.Uwp/Themes/Leaf Green.xaml delete mode 100644 src/Files.Uwp/Themes/Luxury Red.xaml delete mode 100644 src/Files.Uwp/Themes/Magentistic.xaml delete mode 100644 src/Files.Uwp/Themes/Mica Imitation.xaml delete mode 100644 src/Files.Uwp/Themes/Middle Blue.xaml delete mode 100644 src/Files.Uwp/Themes/Nightshade.xaml delete mode 100644 src/Files.Uwp/Themes/Nord.xaml delete mode 100644 src/Files.Uwp/Themes/Red Wave.xaml delete mode 100644 src/Files.Uwp/Themes/Solarized.xaml delete mode 100644 src/Files.Uwp/Themes/Turquoise.xaml diff --git a/src/Files.Uwp/Themes/Acrylic.xaml b/src/Files.Uwp/Themes/Acrylic.xaml deleted file mode 100644 index d39c2b51c735..000000000000 --- a/src/Files.Uwp/Themes/Acrylic.xaml +++ /dev/null @@ -1,188 +0,0 @@ - - - - - 0.6 - 0.6 - - - #2D2D2D - - - - - - - - - - - - - - - - - - - - 0.5 - 0.5 - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Files.Uwp/Themes/Blue Acrylic.xaml b/src/Files.Uwp/Themes/Blue Acrylic.xaml deleted file mode 100644 index c789c48df104..000000000000 --- a/src/Files.Uwp/Themes/Blue Acrylic.xaml +++ /dev/null @@ -1,115 +0,0 @@ - - - - - - - - - - - - - - #3d5dfb - #3d5dfb - #3d5dfb - #3d5dfb - #3d5dfb - #3d5dfb - - - - - - - - - - - - - - #46b2ef - #46b2ef - #46b2ef - #46b2ef - #46b2ef - #46b2ef - - - diff --git a/src/Files.Uwp/Themes/Bound to be Blue.xaml b/src/Files.Uwp/Themes/Bound to be Blue.xaml deleted file mode 100644 index 56282213adbe..000000000000 --- a/src/Files.Uwp/Themes/Bound to be Blue.xaml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - #233F6C - #1A2B46 - #213B65 - #274472 - - - - - - #274472 - - #3967B1 - #3967B1 - #3967B1 - #3967B1 - #3967B1 - #3967B1 - #3967B1 - - - - - #4781DE - #4170BE - #4E87E4 - #4781DE - - - - - - #4781DE - - #82B0FE - #82B0FE - #82B0FE - #82B0FE - #82B0FE - #82B0FE - #82B0FE - - - diff --git a/src/Files.Uwp/Themes/Bronze.xaml b/src/Files.Uwp/Themes/Bronze.xaml deleted file mode 100644 index 9fb32c46a0fb..000000000000 --- a/src/Files.Uwp/Themes/Bronze.xaml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - #A26829 - #845a2b - #A26829 - #A26829 - - - - - - #A26829 - - #FFDF87 - #FFDF87 - #FFDF87 - #FFDF87 - #FFDF87 - #FFDF87 - #FFDF87 - - - - - #A26829 - #C58642 - #D58936 - #D5B18A - - - - - - #D5B18A - - #A26829 - #D5B18A - #D5B18A - #D5B18A - #D5B18A - #D5B18A - #D5B18A - - - diff --git a/src/Files.Uwp/Themes/Burgundy.xaml b/src/Files.Uwp/Themes/Burgundy.xaml deleted file mode 100644 index 05ee8c10ebcf..000000000000 --- a/src/Files.Uwp/Themes/Burgundy.xaml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - #97475C - #7F3C4E - #763B4A - #592A37 - - - - - - #592A37 - - #CB607C - #CB607C - #CB607C - #CB607C - #CB607C - #CB607C - #CB607C - - - - - #97475C - #F17293 - #E87490 - #CB607C - - - - - - #CB607C - - #97475C - #97475C - #97475C - #97475C - #97475C - #97475C - #97475C - - - diff --git a/src/Files.Uwp/Themes/Deep Sea.xaml b/src/Files.Uwp/Themes/Deep Sea.xaml deleted file mode 100644 index bcebf4b4fa46..000000000000 --- a/src/Files.Uwp/Themes/Deep Sea.xaml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - #040378 - #00277B - #00368C - #020262 - - - - - - #020262 - - #1D85D7 - #1D85D7 - #1D85D7 - #1D85D7 - #1D85D7 - #1D85D7 - #1D85D7 - - - - - #0705ff - #0050ff - #0061ff - #0404fa - - - - - - #0404fa - - #020262 - #020262 - #020262 - #020262 - #020262 - #020262 - #020262 - - - diff --git a/src/Files.Uwp/Themes/Discord.xaml b/src/Files.Uwp/Themes/Discord.xaml deleted file mode 100644 index 442cbb25d2b7..000000000000 --- a/src/Files.Uwp/Themes/Discord.xaml +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - - #2F3136 - #2F3136 - #37393F - #202225 - - - - - - #2F3136 - - #DCDDDE - #989CF8 - #989CF8 - #989CF8 - #989CF8 - #989CF8 - #989CF8 - - - - - #E2DFDE - #F2F3F5 - #FAFAFA - #E3E5E8 - - - - - - #E3E5E8 - - #2F3338 - #6165F4 - #6165F4 - #6165F4 - #6165F4 - #6165F4 - #6165F4 - - - diff --git a/src/Files.Uwp/Themes/Dracula.xaml b/src/Files.Uwp/Themes/Dracula.xaml deleted file mode 100644 index 2d30fed72572..000000000000 --- a/src/Files.Uwp/Themes/Dracula.xaml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - #434456 - #292A36 - #292A36 - #46475B - - - - - - #46475B - - #BABCF3 - #BABCF3 - #BABCF3 - #BABCF3 - #BABCF3 - #BABCF3 - #BABCF3 - - - - - #9B9EC8 - #8082A7 - #8082A7 - #686989 - - - - - - #686989 - - #282935 - #282935 - #282935 - #282935 - #282935 - #282935 - #282935 - - - diff --git a/src/Files.Uwp/Themes/Glass.xaml b/src/Files.Uwp/Themes/Glass.xaml deleted file mode 100644 index 84a1e31b9775..000000000000 --- a/src/Files.Uwp/Themes/Glass.xaml +++ /dev/null @@ -1,172 +0,0 @@ - - - - - - #020205 - #020205 - #111115 - #020205 - #020205 - - transparent - transparent - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #BBBBBC - #BBBBBC - #C9C9CA - #CBCBCD - - transparent - transparent - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Files.Uwp/Themes/Green Grass.xaml b/src/Files.Uwp/Themes/Green Grass.xaml deleted file mode 100644 index 8cae51f2245b..000000000000 --- a/src/Files.Uwp/Themes/Green Grass.xaml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - #223412 - #3B5A1F - #54802C - #599124 - - - - - - #2C550C - - #6DA639 - #6DA639 - #6DA639 - #6DA639 - #6DA639 - #6DA639 - #6DA639 - - - - - #cdf7d1 - #adedb3 - #9aeaa2 - #88ea91 - - - - - - #70ef7d - - #54bf5d - #54bf5d - #54bf5d - #54bf5d - #54bf5d - #54bf5d - #54bf5d - - - diff --git a/src/Files.Uwp/Themes/Lavender.xaml b/src/Files.Uwp/Themes/Lavender.xaml deleted file mode 100644 index a275a4b0844c..000000000000 --- a/src/Files.Uwp/Themes/Lavender.xaml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - #FF262738 - #FF3F2E4B - #FF332041 - #332041 - - - - - - #332041 - - #8752A8 - #8752A8 - #8752A8 - #8752A8 - #8752A8 - #8752A8 - #8752A8 - - - - - #FFFEF6FF - #FFFBE4FF - #FFF8DFFF - #C3ADCC - - - - - - #C3ADCC - - #948599 - #948599 - #948599 - #948599 - #948599 - #948599 - #948599 - - - diff --git a/src/Files.Uwp/Themes/Leaf Green.xaml b/src/Files.Uwp/Themes/Leaf Green.xaml deleted file mode 100644 index 57003c48fe3c..000000000000 --- a/src/Files.Uwp/Themes/Leaf Green.xaml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - #01573A - #048B5D - #059866 - #036543 - - - - - - #036543 - - #08FFAB - #08FFAB - #08FFAB - #08FFAB - #08FFAB - #08FFAB - #08FFAB - - - - - #01C985 - #06D790 - #05CC95 - #05B175 - - - - - - #05B175 - - #007C52 - #007C52 - #007C52 - #007C52 - #007C52 - #007C52 - #007C52 - - - diff --git a/src/Files.Uwp/Themes/Luxury Red.xaml b/src/Files.Uwp/Themes/Luxury Red.xaml deleted file mode 100644 index 03a6be4c6f00..000000000000 --- a/src/Files.Uwp/Themes/Luxury Red.xaml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - #912f3c - #6D262F - #882F3B - #882F3B - - - - - - #882F3B - - #D4495C - #D4495C - #D4495C - #D4495C - #D4495C - #D4495C - #D4495C - - - - - #A33543 - #93333F - #AE3C4B - #AE3C4B - - - - - - #AE3C4B - - #3B1418 - #3B1418 - #3B1418 - #3B1418 - #3B1418 - #3B1418 - #3B1418 - - - diff --git a/src/Files.Uwp/Themes/Magentistic.xaml b/src/Files.Uwp/Themes/Magentistic.xaml deleted file mode 100644 index bde040970242..000000000000 --- a/src/Files.Uwp/Themes/Magentistic.xaml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - #243447 - #141d26 - #243447 - #243447 - - - - - - #243447 - - #c51f5d - #c51f5d - #c51f5d - #c51f5d - #c51f5d - #c51f5d - #c51f5d - - - - - #c51f5d - #c51f5d - #c51f5d - #c51f5d - - - - - - #c51f5d - - #243447 - #243447 - #243447 - #243447 - #243447 - #243447 - #243447 - - - diff --git a/src/Files.Uwp/Themes/Mica Imitation.xaml b/src/Files.Uwp/Themes/Mica Imitation.xaml deleted file mode 100644 index 66836fad1818..000000000000 --- a/src/Files.Uwp/Themes/Mica Imitation.xaml +++ /dev/null @@ -1,163 +0,0 @@ - - - - - - #222222 - #222222 - #111115 - #222222 - #2D2D2D - #393939 - - - - - - - - - - - - - - - - - - - - - - - - - - - - #f3f3f3 - #f3f3f3 - #ebebeb - #ffffff - #dadada - #d3d3d3 - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Files.Uwp/Themes/Middle Blue.xaml b/src/Files.Uwp/Themes/Middle Blue.xaml deleted file mode 100644 index 71a5ff0a84bd..000000000000 --- a/src/Files.Uwp/Themes/Middle Blue.xaml +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - #5885AF - #41729F - #5885AF - #C3E0E5 - - - - - - #C3E0E5 - - - - - - - - - #5885AF - #41729F - #5885AF - #274472 - - - - - - #274472 - - - - - diff --git a/src/Files.Uwp/Themes/Nightshade.xaml b/src/Files.Uwp/Themes/Nightshade.xaml deleted file mode 100644 index e3152804eff8..000000000000 --- a/src/Files.Uwp/Themes/Nightshade.xaml +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - #2c303b - #373c4a - #373c4a - #535b70 - - - - - #535b70 - - #0f7b6e - #0f7b6e - #084840 - #172f23 - #16ae9d - #4b9573 - #65c99b - - - - - #aaeaefff - #aaeaefff - #eaefff - #eaefff - - - - - #eaefff - - #16ae9d - #0f7b6e - #16ae9d - #31624b - #16ae9d - #4b9573 - #16ae9d - - - diff --git a/src/Files.Uwp/Themes/Nord.xaml b/src/Files.Uwp/Themes/Nord.xaml deleted file mode 100644 index e6f2c7198f8d..000000000000 --- a/src/Files.Uwp/Themes/Nord.xaml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - #3d4252 - #3d4252 - #3d4252 - #3d4252 - - - - - - #3d4252 - - #d9dee9 - #d9dee9 - #d9dee9 - #d9dee9 - #d9dee9 - #d9dee9 - #d9dee9 - - - - - #d9dee9 - #d9dee9 - #d9dee9 - #d9dee9 - - - - - - #d9dee9 - - #3d4252 - #3d4252 - #3d4252 - #3d4252 - #3d4252 - #3d4252 - #3d4252 - - - \ No newline at end of file diff --git a/src/Files.Uwp/Themes/Red Wave.xaml b/src/Files.Uwp/Themes/Red Wave.xaml deleted file mode 100644 index 94f75ac4eabc..000000000000 --- a/src/Files.Uwp/Themes/Red Wave.xaml +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - #db3f18 - #dd4220 - #d45332 - #952f15 - - - - - - #952f15 - - - - - - #db3f18 - #dd4220 - #d45332 - #C9401D - - - - - - #C9401D - - - diff --git a/src/Files.Uwp/Themes/Solarized.xaml b/src/Files.Uwp/Themes/Solarized.xaml deleted file mode 100644 index 2c1c9284856e..000000000000 --- a/src/Files.Uwp/Themes/Solarized.xaml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - #586E75 - #586E75 - #93A1A1 - #3A494E - - - - - - #93A1A1 - - #93A1A1 - #93A1A1 - #93A1A1 - #93A1A1 - #93A1A1 - #93A1A1 - #93A1A1 - - - - - #EEE8D5 - #EEE8D5 - #FDF6E3 - #c9c4b3 - - - - - - #EEE8D5 - - #EEE8D5 - #EEE8D5 - #EEE8D5 - #EEE8D5 - #EEE8D5 - #EEE8D5 - #EEE8D5 - - - diff --git a/src/Files.Uwp/Themes/Turquoise.xaml b/src/Files.Uwp/Themes/Turquoise.xaml deleted file mode 100644 index 7d32b9d797b7..000000000000 --- a/src/Files.Uwp/Themes/Turquoise.xaml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - #2C5653 - #2A847D - #27635E - #2C5653 - - - - - - #26A594 - - #26A594 - #26A594 - #26A594 - #26A594 - #26A594 - #26A594 - #26A594 - - - - - #29E7CD - #29E7CD - #B4F6EE - #29E7CD - - - - - - #3C837A - - #3C837A - #3C837A - #3C837A - #3C837A - #3C837A - #3C837A - #3C837A - - - From 0484d32a5e261fc7742525d2ead5bfff544d8790 Mon Sep 17 00:00:00 2001 From: Marco Gavelli Date: Mon, 15 Aug 2022 04:01:13 +0200 Subject: [PATCH 04/99] Comment unsupported xaml --- src/Files.Uwp/App.xaml | 2 +- src/Files.Uwp/App.xaml.cs | 3 +-- src/Files.Uwp/{App.xaml.old.cs => App.xaml.cs.old} | 0 src/Files.Uwp/Files.Uwp.csproj | 9 --------- src/Files.Uwp/UserControls/FilePreviews/HtmlPreview.xaml | 2 +- .../UserControls/FilePreviews/MediaPreview.xaml | 5 +++-- src/Files.Uwp/UserControls/SidebarControl.xaml | 5 +++-- .../Views/Pages/PropertiesSecurityAdvanced.xaml | 8 -------- src/Files.Uwp/Views/SettingsPages/Appearance.xaml | 2 +- 9 files changed, 10 insertions(+), 26 deletions(-) rename src/Files.Uwp/{App.xaml.old.cs => App.xaml.cs.old} (100%) diff --git a/src/Files.Uwp/App.xaml b/src/Files.Uwp/App.xaml index 2cc90a4cfa5e..ede4642170cf 100644 --- a/src/Files.Uwp/App.xaml +++ b/src/Files.Uwp/App.xaml @@ -16,7 +16,7 @@ 32 - + diff --git a/src/Files.Uwp/App.xaml.cs b/src/Files.Uwp/App.xaml.cs index c1ee548ee0b9..66386d9c3756 100644 --- a/src/Files.Uwp/App.xaml.cs +++ b/src/Files.Uwp/App.xaml.cs @@ -16,12 +16,11 @@ using Windows.ApplicationModel.Activation; using Windows.Foundation; using Windows.Foundation.Collections; -using Files.Uwp; // To learn more about WinUI, the WinUI project structure, // and more about our project templates, see: http://aka.ms/winui-project-info. -namespace Files +namespace Files.Uwp { /// /// Provides application-specific behavior to supplement the default Application class. diff --git a/src/Files.Uwp/App.xaml.old.cs b/src/Files.Uwp/App.xaml.cs.old similarity index 100% rename from src/Files.Uwp/App.xaml.old.cs rename to src/Files.Uwp/App.xaml.cs.old diff --git a/src/Files.Uwp/Files.Uwp.csproj b/src/Files.Uwp/Files.Uwp.csproj index 42b95b267573..ed52caf5df4c 100644 --- a/src/Files.Uwp/Files.Uwp.csproj +++ b/src/Files.Uwp/Files.Uwp.csproj @@ -152,7 +152,6 @@ Designer - @@ -205,11 +204,6 @@ - - - Windows Desktop Extensions for the UWP - - bin\x86\Sideload\ TRACE;NETFX_CORE;WINDOWS_UWP;DISABLE_XAML_GENERATED_MAIN;SIDELOAD;CODE_ANALYSIS @@ -250,7 +244,4 @@ false 9.0 - - - \ No newline at end of file diff --git a/src/Files.Uwp/UserControls/FilePreviews/HtmlPreview.xaml b/src/Files.Uwp/UserControls/FilePreviews/HtmlPreview.xaml index 0b353b1a3b67..60798a77a961 100644 --- a/src/Files.Uwp/UserControls/FilePreviews/HtmlPreview.xaml +++ b/src/Files.Uwp/UserControls/FilePreviews/HtmlPreview.xaml @@ -14,7 +14,7 @@ HorizontalAlignment="Stretch" VerticalAlignment="Stretch" CornerRadius="{StaticResource ControlCornerRadius}"> - - + \ No newline at end of file diff --git a/src/Files.Uwp/UserControls/SidebarControl.xaml b/src/Files.Uwp/UserControls/SidebarControl.xaml index ffa8e7c7ff7e..fd7963fb1d11 100644 --- a/src/Files.Uwp/UserControls/SidebarControl.xaml +++ b/src/Files.Uwp/UserControls/SidebarControl.xaml @@ -69,9 +69,10 @@ - + + diff --git a/src/Files.Uwp/Views/Pages/PropertiesSecurityAdvanced.xaml b/src/Files.Uwp/Views/Pages/PropertiesSecurityAdvanced.xaml index 1effa4d2b992..621bcb155f9e 100644 --- a/src/Files.Uwp/Views/Pages/PropertiesSecurityAdvanced.xaml +++ b/src/Files.Uwp/Views/Pages/PropertiesSecurityAdvanced.xaml @@ -35,14 +35,6 @@ x:Key="BoolToWidthConverter" FalseValue="0" TrueValue="*" /> - - diff --git a/src/Files.Uwp/Views/SettingsPages/Appearance.xaml b/src/Files.Uwp/Views/SettingsPages/Appearance.xaml index d7814d8b468a..f2b095dcf96b 100644 --- a/src/Files.Uwp/Views/SettingsPages/Appearance.xaml +++ b/src/Files.Uwp/Views/SettingsPages/Appearance.xaml @@ -14,7 +14,7 @@ - + From 82aa2c186b6fa90d420f166c67b205713251649a Mon Sep 17 00:00:00 2001 From: Marco Gavelli Date: Mon, 15 Aug 2022 04:41:46 +0200 Subject: [PATCH 05/99] GeLocalized(): Microsoft.Toolkit.Uwp -> CommunityToolkit.WinUI --- src/Files.Shared/Extensions/LinqExtensions.cs | 3 -- src/Files.Uwp/App.xaml.cs | 51 ++++++++++++++----- src/Files.Uwp/BaseLayout.cs | 15 +++--- .../DataModels/DefaultLanguageModel.cs | 2 +- .../NavigationControlItems/DriveItem.cs | 2 +- .../NavigationControlItems/LocationItem.cs | 2 +- .../DataModels/SidebarPinnedModel.cs | 2 +- src/Files.Uwp/Extensions/StringExtensions.cs | 2 +- .../Cloud/CloudDriveSyncStatusUI.cs | 2 +- .../Filesystem/Cloud/CloudDrivesManager.cs | 2 +- src/Files.Uwp/Filesystem/Drives.cs | 2 +- .../FilesystemOperations.cs | 2 +- .../Helpers/FilesystemHelpers.cs | 2 +- .../ShellFilesystemOperations.cs | 2 +- src/Files.Uwp/Filesystem/LibraryManager.cs | 2 +- src/Files.Uwp/Filesystem/ListedItem.cs | 2 +- .../Filesystem/NetworkDrivesManager.cs | 2 +- .../Permissions/FileSystemAccessRuleForUI.cs | 2 +- .../Filesystem/Permissions/UserGroup.cs | 2 +- .../Filesystem/RecentItemsManager.cs | 2 +- .../Filesystem/Search/FolderSearch.cs | 2 +- .../Win32StorageEnumerator.cs | 2 +- .../Filesystem/StorageItems/FtpStorageFile.cs | 12 ++--- .../StorageItems/FtpStorageFolder.cs | 2 +- .../StorageItems/NativeStorageFile.cs | 2 +- .../Filesystem/StorageItems/ZipStorageFile.cs | 2 +- .../StorageItems/ZipStorageFolder.cs | 2 +- src/Files.Uwp/Helpers/AppUpdater.cs | 20 ++++---- src/Files.Uwp/Helpers/CommonPaths.cs | 2 +- .../Helpers/ContextFlyoutItemHelper.cs | 2 +- src/Files.Uwp/Helpers/DriveHelpers.cs | 4 +- src/Files.Uwp/Helpers/DynamicDialogFactory.cs | 2 +- .../Helpers/ExternalResourcesHelper.cs | 2 +- .../Helpers/FilePropertiesHelpers.cs | 2 +- .../GroupedCollection.cs | 2 +- .../ItemListDisplayHelpers/GroupingHelper.cs | 2 +- src/Files.Uwp/Helpers/LibraryHelper.cs | 2 +- src/Files.Uwp/Helpers/LocalizedEnumHelper.cs | 2 +- .../Helpers/MultitaskingTabsHelpers.cs | 2 +- src/Files.Uwp/Helpers/NavigationHelpers.cs | 18 ++++--- src/Files.Uwp/Helpers/PostBannerHelpers.cs | 2 +- src/Files.Uwp/Helpers/RecycleBinHelpers.cs | 20 ++++---- .../Helpers/ShellContextMenuHelper.cs | 2 +- src/Files.Uwp/Helpers/UIFilesystemHelpers.cs | 2 +- .../BaseLayoutCommandImplementationModel.cs | 2 +- .../AbstractDateTimeFormatter.cs | 2 +- .../ApplicationDateTimeFormatter.cs | 2 +- .../SystemDateTimeFormatter.cs | 2 +- .../UniversalDateTimeFormatter.cs | 2 +- .../LocalizationService.cs | 2 +- .../Settings/FileTagsSettingsService.cs | 2 +- .../ThreadingService.cs | 4 +- .../ServicesImplementation/UpdateService.cs | 30 ++++++----- .../UserControls/FolderEmptyIndicator.xaml.cs | 2 +- .../HorizontalMultitaskingControl.xaml.cs | 2 +- .../VerticalTabViewControl.xaml.cs | 2 +- .../UserControls/Pane/PreviewPane.xaml.cs | 2 +- .../UserControls/SidebarControl.xaml.cs | 8 +-- .../Widgets/BundlesWidget.xaml.cs | 2 +- .../UserControls/Widgets/DrivesWidget.xaml.cs | 2 +- .../UserControls/Widgets/FolderWidget.xaml.cs | 2 +- .../Widgets/RecentFilesWidget.xaml.cs | 2 +- src/Files.Uwp/ViewModels/ItemViewModel.cs | 35 ++++++------- src/Files.Uwp/ViewModels/MainPageViewModel.cs | 2 +- .../Previews/ArchivePreviewViewModel.cs | 2 +- .../ViewModels/Previews/BasePreviewModel.cs | 2 +- .../Previews/ImagePreviewViewModel.cs | 2 +- .../Previews/PDFPreviewViewModel.cs | 2 +- .../ViewModels/Properties/BaseProperties.cs | 2 +- .../Properties/CombinedProperties.cs | 2 +- .../ViewModels/Properties/DriveProperties.cs | 2 +- .../ViewModels/Properties/FileProperties.cs | 2 +- .../ViewModels/Properties/FileProperty.cs | 2 +- .../Properties/FilePropertySection.cs | 2 +- .../ViewModels/Properties/FolderProperties.cs | 2 +- .../Properties/LibraryProperties.cs | 2 +- .../Properties/SecurityProperties.cs | 2 +- src/Files.Uwp/ViewModels/SettingsViewModel.cs | 2 +- .../SettingsViewModels/AboutViewModel.cs | 4 +- .../SettingsViewModels/AppearanceViewModel.cs | 2 +- .../PreferencesViewModel.cs | 3 +- src/Files.Uwp/ViewModels/SidebarViewModel.cs | 4 +- .../ViewModels/StatusCenterViewModel.cs | 2 +- src/Files.Uwp/ViewModels/ToolbarViewModel.cs | 12 ++--- .../Bundles/BundleContainerViewModel.cs | 2 +- .../Widgets/Bundles/BundlesViewModel.cs | 2 +- src/Files.Uwp/Views/ColumnShellPage.xaml.cs | 4 +- src/Files.Uwp/Views/CustomFolderIcons.xaml.cs | 2 +- src/Files.Uwp/Views/MainPage.xaml.cs | 6 +-- src/Files.Uwp/Views/ModernShellPage.xaml.cs | 2 +- src/Files.Uwp/Views/Pages/Properties.xaml.cs | 2 +- .../Views/Pages/PropertiesGeneral.xaml.cs | 2 +- .../Views/Pages/PropertiesSecurity.xaml.cs | 2 +- .../Pages/PropertiesSecurityAdvanced.xaml.cs | 2 +- src/Files.Uwp/Views/PaneHolderPage.xaml.cs | 2 +- src/Files.Uwp/Views/WidgetsPage.xaml.cs | 2 +- 96 files changed, 220 insertions(+), 189 deletions(-) diff --git a/src/Files.Shared/Extensions/LinqExtensions.cs b/src/Files.Shared/Extensions/LinqExtensions.cs index 1268b0f50d92..cf90863834a9 100644 --- a/src/Files.Shared/Extensions/LinqExtensions.cs +++ b/src/Files.Shared/Extensions/LinqExtensions.cs @@ -78,9 +78,6 @@ public static IEnumerable ExceptBy(this IEnumerable DistinctBy(this IEnumerable items, Func property) - => items.GroupBy(property).Select(x => x.First()); - public static IEnumerable IntersectBy(this IEnumerable items, IEnumerable others, Func keySelector) => items.Join(others.Select(keySelector), keySelector, id => id, (o, id) => o); diff --git a/src/Files.Uwp/App.xaml.cs b/src/Files.Uwp/App.xaml.cs index 66386d9c3756..cf5b9354cfdb 100644 --- a/src/Files.Uwp/App.xaml.cs +++ b/src/Files.Uwp/App.xaml.cs @@ -1,21 +1,14 @@ using Microsoft.UI.Xaml; -using Microsoft.UI.Xaml.Controls; -using Microsoft.UI.Xaml.Controls.Primitives; -using Microsoft.UI.Xaml.Data; -using Microsoft.UI.Xaml.Input; -using Microsoft.UI.Xaml.Media; -using Microsoft.UI.Xaml.Navigation; -using Microsoft.UI.Xaml.Shapes; using Microsoft.Windows.AppLifecycle; using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Runtime.InteropServices.WindowsRuntime; using Windows.ApplicationModel; -using Windows.ApplicationModel.Activation; -using Windows.Foundation; -using Windows.Foundation.Collections; +using Files.Uwp.Filesystem.FilesystemHistory; +using Files.Uwp.ViewModels; +using Files.Uwp.Helpers; +using Files.Uwp.Controllers; +using Files.Uwp.Filesystem; +using Files.Shared; +using Files.Uwp.Filesystem.Cloud; // To learn more about WinUI, the WinUI project structure, // and more about our project templates, see: http://aka.ms/winui-project-info. @@ -27,6 +20,36 @@ namespace Files.Uwp /// public partial class App : Application { + private static bool ShowErrorNotification = false; + private static string OutputPath = null; + + public static StorageHistoryWrapper HistoryWrapper = new StorageHistoryWrapper(); + public static SettingsViewModel AppSettings { get; private set; } + public static MainViewModel MainViewModel { get; private set; } + public static PaneViewModel PaneViewModel { get; private set; } + public static PreviewPaneViewModel PreviewPaneViewModel { get; private set; } + public static JumpListManager JumpList { get; private set; } + public static RecentItemsManager RecentItemsManager { get; private set; } + public static SidebarPinnedController SidebarPinnedController { get; private set; } + public static TerminalController TerminalController { get; private set; } + public static CloudDrivesManager CloudDrivesManager { get; private set; } + public static NetworkDrivesManager NetworkDrivesManager { get; private set; } + public static DrivesManager DrivesManager { get; private set; } + public static WSLDistroManager WSLDistroManager { get; private set; } + public static LibraryManager LibraryManager { get; private set; } + public static FileTagsManager FileTagsManager { get; private set; } + public static ExternalResourcesHelper ExternalResourcesHelper { get; private set; } + + public static ILogger Logger { get; private set; } + private static readonly UniversalLogWriter logWriter = new UniversalLogWriter(); + + public static OngoingTasksViewModel OngoingTasksViewModel { get; } = new OngoingTasksViewModel(); + public static SecondaryTileHelper SecondaryTileHelper { get; private set; } = new SecondaryTileHelper(); + + public static string AppVersion = $"{Package.Current.Id.Version.Major}.{Package.Current.Id.Version.Minor}.{Package.Current.Id.Version.Build}.{Package.Current.Id.Version.Revision}"; + + public IServiceProvider Services { get; private set; } + /// /// Initializes the singleton application object. This is the first line of authored code /// executed, and as such is the logical equivalent of main() or WinMain(). diff --git a/src/Files.Uwp/BaseLayout.cs b/src/Files.Uwp/BaseLayout.cs index 8f66b24452ab..9917d9c0852b 100644 --- a/src/Files.Uwp/BaseLayout.cs +++ b/src/Files.Uwp/BaseLayout.cs @@ -12,8 +12,7 @@ using Files.Uwp.UserControls; using Files.Uwp.ViewModels; using Files.Uwp.Views; -using Microsoft.Toolkit.Uwp; -using Microsoft.Toolkit.Uwp.UI; +using CommunityToolkit.WinUI.UI; using System; using System.Collections.Generic; using System.ComponentModel; @@ -37,6 +36,8 @@ using Microsoft.UI.Xaml.Navigation; using Files.Uwp.UserControls.Menus; using static Files.Uwp.Helpers.PathNormalization; +using CommunityToolkit.WinUI; +using DispatcherQueueTimer = Microsoft.UI.Dispatching.DispatcherQueueTimer; namespace Files.Uwp { @@ -45,7 +46,7 @@ namespace Files.Uwp /// public abstract class BaseLayout : Page, IBaseLayout, INotifyPropertyChanged { - private readonly DispatcherTimer jumpTimer; + private readonly DispatcherQueueTimer jumpTimer; protected IUserSettingsService UserSettingsService { get; } = Ioc.Default.GetService(); @@ -264,7 +265,7 @@ internal set if (SelectedItems.Count == 1) { SelectedItemsPropertiesViewModel.SelectedItemsCountString = $"{SelectedItems.Count} {"ItemSelected/Text".GetLocalized()}"; - DispatcherQueue.GetForCurrentThread().EnqueueAsync(async () => + DispatcherQueue.EnqueueAsync(async () => { await Task.Delay(50); // Tapped event must be executed first preRenamingItem = SelectedItem; @@ -300,15 +301,15 @@ public BaseLayout() HookBaseEvents(); HookEvents(); - jumpTimer = new DispatcherTimer(); + jumpTimer = DispatcherQueue.CreateTimer(); jumpTimer.Interval = TimeSpan.FromSeconds(0.8); jumpTimer.Tick += JumpTimer_Tick; SelectedItemsPropertiesViewModel = new SelectedItemsPropertiesViewModel(); DirectoryPropertiesViewModel = new DirectoryPropertiesViewModel(); - dragOverTimer = DispatcherQueue.GetForCurrentThread().CreateTimer(); - tapDebounceTimer = DispatcherQueue.GetForCurrentThread().CreateTimer(); + dragOverTimer = DispatcherQueue.CreateTimer(); + tapDebounceTimer = DispatcherQueue.CreateTimer(); } protected abstract void HookEvents(); diff --git a/src/Files.Uwp/DataModels/DefaultLanguageModel.cs b/src/Files.Uwp/DataModels/DefaultLanguageModel.cs index 18ae3a908d86..3bf5802651b2 100644 --- a/src/Files.Uwp/DataModels/DefaultLanguageModel.cs +++ b/src/Files.Uwp/DataModels/DefaultLanguageModel.cs @@ -1,4 +1,4 @@ -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using System.Globalization; namespace Files.Uwp.DataModels diff --git a/src/Files.Uwp/DataModels/NavigationControlItems/DriveItem.cs b/src/Files.Uwp/DataModels/NavigationControlItems/DriveItem.cs index 8732425ddbb4..3a79c661fc10 100644 --- a/src/Files.Uwp/DataModels/NavigationControlItems/DriveItem.cs +++ b/src/Files.Uwp/DataModels/NavigationControlItems/DriveItem.cs @@ -3,7 +3,7 @@ using Files.Uwp.Filesystem; using Files.Uwp.Helpers; using CommunityToolkit.Mvvm.ComponentModel; -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using System; using System.Threading.Tasks; using Windows.ApplicationModel.Core; diff --git a/src/Files.Uwp/DataModels/NavigationControlItems/LocationItem.cs b/src/Files.Uwp/DataModels/NavigationControlItems/LocationItem.cs index 0715f3446a0f..5df26ebf0845 100644 --- a/src/Files.Uwp/DataModels/NavigationControlItems/LocationItem.cs +++ b/src/Files.Uwp/DataModels/NavigationControlItems/LocationItem.cs @@ -1,7 +1,7 @@ using Files.Shared; using Files.Uwp.Filesystem; using CommunityToolkit.Mvvm.ComponentModel; -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using System; using Microsoft.UI.Xaml.Media; using Microsoft.UI.Xaml.Media.Imaging; diff --git a/src/Files.Uwp/DataModels/SidebarPinnedModel.cs b/src/Files.Uwp/DataModels/SidebarPinnedModel.cs index 3e4187df26ad..83de180691e3 100644 --- a/src/Files.Uwp/DataModels/SidebarPinnedModel.cs +++ b/src/Files.Uwp/DataModels/SidebarPinnedModel.cs @@ -5,7 +5,7 @@ using Files.Uwp.Filesystem; using Files.Uwp.Helpers; using Files.Uwp.ViewModels; -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using Newtonsoft.Json; using System; using System.Collections.Generic; diff --git a/src/Files.Uwp/Extensions/StringExtensions.cs b/src/Files.Uwp/Extensions/StringExtensions.cs index bc6cc9261adb..018fa2bbeb58 100644 --- a/src/Files.Uwp/Extensions/StringExtensions.cs +++ b/src/Files.Uwp/Extensions/StringExtensions.cs @@ -1,9 +1,9 @@ using ByteSizeLib; using Files.Shared.Extensions; -using Microsoft.Toolkit.Uwp; using System; using System.Collections.Generic; using System.IO; +using CommunityToolkit.WinUI; namespace Files.Uwp.Extensions { diff --git a/src/Files.Uwp/Filesystem/Cloud/CloudDriveSyncStatusUI.cs b/src/Files.Uwp/Filesystem/Cloud/CloudDriveSyncStatusUI.cs index 5dc9f2a66bed..242e78aab7f6 100644 --- a/src/Files.Uwp/Filesystem/Cloud/CloudDriveSyncStatusUI.cs +++ b/src/Files.Uwp/Filesystem/Cloud/CloudDriveSyncStatusUI.cs @@ -1,6 +1,6 @@ using CommunityToolkit.Mvvm.ComponentModel; using Files.Shared.Cloud; -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; namespace Files.Uwp.Filesystem.Cloud { diff --git a/src/Files.Uwp/Filesystem/Cloud/CloudDrivesManager.cs b/src/Files.Uwp/Filesystem/Cloud/CloudDrivesManager.cs index 62fbfad5a7e1..485b9aca07d6 100644 --- a/src/Files.Uwp/Filesystem/Cloud/CloudDrivesManager.cs +++ b/src/Files.Uwp/Filesystem/Cloud/CloudDrivesManager.cs @@ -3,7 +3,7 @@ using Files.Shared.Cloud; using Files.Uwp.DataModels.NavigationControlItems; using Files.Uwp.Helpers; -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using System; using System.Collections.Generic; using System.Collections.Specialized; diff --git a/src/Files.Uwp/Filesystem/Drives.cs b/src/Files.Uwp/Filesystem/Drives.cs index e8942b50399c..1c293e88a306 100644 --- a/src/Files.Uwp/Filesystem/Drives.cs +++ b/src/Files.Uwp/Filesystem/Drives.cs @@ -4,7 +4,7 @@ using Files.Shared; using Files.Shared.Enums; using Files.Uwp.DataModels.NavigationControlItems; -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using System; using System.Collections.Generic; using System.Collections.Specialized; diff --git a/src/Files.Uwp/Filesystem/FilesystemOperations/FilesystemOperations.cs b/src/Files.Uwp/Filesystem/FilesystemOperations/FilesystemOperations.cs index 468f9bf67660..266ff46a7b7a 100644 --- a/src/Files.Uwp/Filesystem/FilesystemOperations/FilesystemOperations.cs +++ b/src/Files.Uwp/Filesystem/FilesystemOperations/FilesystemOperations.cs @@ -5,7 +5,7 @@ using Files.Uwp.Filesystem.FilesystemHistory; using Files.Uwp.Filesystem.StorageItems; using Files.Uwp.Helpers; -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/src/Files.Uwp/Filesystem/FilesystemOperations/Helpers/FilesystemHelpers.cs b/src/Files.Uwp/Filesystem/FilesystemOperations/Helpers/FilesystemHelpers.cs index 052d9b556c93..6936074e0fc0 100644 --- a/src/Files.Uwp/Filesystem/FilesystemOperations/Helpers/FilesystemHelpers.cs +++ b/src/Files.Uwp/Filesystem/FilesystemOperations/Helpers/FilesystemHelpers.cs @@ -8,7 +8,7 @@ using Files.Uwp.Filesystem.FilesystemHistory; using Files.Uwp.Helpers; using Files.Uwp.Interacts; -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/src/Files.Uwp/Filesystem/FilesystemOperations/ShellFilesystemOperations.cs b/src/Files.Uwp/Filesystem/FilesystemOperations/ShellFilesystemOperations.cs index dd4ef742cebe..743376b6529f 100644 --- a/src/Files.Uwp/Filesystem/FilesystemOperations/ShellFilesystemOperations.cs +++ b/src/Files.Uwp/Filesystem/FilesystemOperations/ShellFilesystemOperations.cs @@ -17,7 +17,7 @@ using Files.Backend.ViewModels.Dialogs; using CommunityToolkit.Mvvm.DependencyInjection; using Files.Backend.Services; -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using Files.Uwp.Filesystem.StorageItems; using Files.Backend.ViewModels.Dialogs.FileSystemDialog; diff --git a/src/Files.Uwp/Filesystem/LibraryManager.cs b/src/Files.Uwp/Filesystem/LibraryManager.cs index e9ebd2001676..9c0fc0d40389 100644 --- a/src/Files.Uwp/Filesystem/LibraryManager.cs +++ b/src/Files.Uwp/Filesystem/LibraryManager.cs @@ -1,6 +1,6 @@ using Files.Shared; using Files.Uwp.Helpers; -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using System; using System.Collections.Generic; using System.Collections.Specialized; diff --git a/src/Files.Uwp/Filesystem/ListedItem.cs b/src/Files.Uwp/Filesystem/ListedItem.cs index 08e7eb288a0a..63e52176b986 100644 --- a/src/Files.Uwp/Filesystem/ListedItem.cs +++ b/src/Files.Uwp/Filesystem/ListedItem.cs @@ -10,7 +10,7 @@ using Files.Uwp.Helpers; using Files.Uwp.ViewModels.Properties; using FluentFTP; -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using System; using System.Collections.Generic; using System.Collections.ObjectModel; diff --git a/src/Files.Uwp/Filesystem/NetworkDrivesManager.cs b/src/Files.Uwp/Filesystem/NetworkDrivesManager.cs index d2ac5137c5d3..655a88e902c0 100644 --- a/src/Files.Uwp/Filesystem/NetworkDrivesManager.cs +++ b/src/Files.Uwp/Filesystem/NetworkDrivesManager.cs @@ -1,7 +1,7 @@ using Files.Shared; using Files.Uwp.DataModels.NavigationControlItems; using Files.Uwp.Helpers; -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using Newtonsoft.Json; using System; using System.Collections.Generic; diff --git a/src/Files.Uwp/Filesystem/Permissions/FileSystemAccessRuleForUI.cs b/src/Files.Uwp/Filesystem/Permissions/FileSystemAccessRuleForUI.cs index a151f2a80f50..49194987283a 100644 --- a/src/Files.Uwp/Filesystem/Permissions/FileSystemAccessRuleForUI.cs +++ b/src/Files.Uwp/Filesystem/Permissions/FileSystemAccessRuleForUI.cs @@ -1,6 +1,6 @@ using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.Input; -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using System; using System.Collections.Generic; using System.ComponentModel; diff --git a/src/Files.Uwp/Filesystem/Permissions/UserGroup.cs b/src/Files.Uwp/Filesystem/Permissions/UserGroup.cs index 56fbef9cfff2..c960dd9e51f4 100644 --- a/src/Files.Uwp/Filesystem/Permissions/UserGroup.cs +++ b/src/Files.Uwp/Filesystem/Permissions/UserGroup.cs @@ -1,5 +1,5 @@ using CommunityToolkit.Mvvm.ComponentModel; -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using System; using System.Collections.Generic; using System.Runtime.InteropServices; diff --git a/src/Files.Uwp/Filesystem/RecentItemsManager.cs b/src/Files.Uwp/Filesystem/RecentItemsManager.cs index dba09b0483a3..8e1860715763 100644 --- a/src/Files.Uwp/Filesystem/RecentItemsManager.cs +++ b/src/Files.Uwp/Filesystem/RecentItemsManager.cs @@ -2,7 +2,7 @@ using Files.Shared; using Files.Shared.Enums; using Files.Uwp.Helpers; -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using Newtonsoft.Json; using System; using System.Collections.Generic; diff --git a/src/Files.Uwp/Filesystem/Search/FolderSearch.cs b/src/Files.Uwp/Filesystem/Search/FolderSearch.cs index d8fc28c500b4..1f2ab33f3a83 100644 --- a/src/Files.Uwp/Filesystem/Search/FolderSearch.cs +++ b/src/Files.Uwp/Filesystem/Search/FolderSearch.cs @@ -4,7 +4,7 @@ using Files.Uwp.Extensions; using Files.Uwp.Filesystem.StorageItems; using Files.Uwp.Helpers; -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using System; using System.Collections.Generic; using System.Collections.ObjectModel; diff --git a/src/Files.Uwp/Filesystem/StorageEnumerators/Win32StorageEnumerator.cs b/src/Files.Uwp/Filesystem/StorageEnumerators/Win32StorageEnumerator.cs index 0904e9c8ce85..7ce04afcbfbb 100644 --- a/src/Files.Uwp/Filesystem/StorageEnumerators/Win32StorageEnumerator.cs +++ b/src/Files.Uwp/Filesystem/StorageEnumerators/Win32StorageEnumerator.cs @@ -7,7 +7,7 @@ using Files.Uwp.Filesystem.StorageItems; using Files.Uwp.Helpers; using Files.Uwp.Helpers.FileListCache; -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using Newtonsoft.Json; using System; using System.Collections.Generic; diff --git a/src/Files.Uwp/Filesystem/StorageItems/FtpStorageFile.cs b/src/Files.Uwp/Filesystem/StorageItems/FtpStorageFile.cs index 3f39714ce624..c534431f3c7b 100644 --- a/src/Files.Uwp/Filesystem/StorageItems/FtpStorageFile.cs +++ b/src/Files.Uwp/Filesystem/StorageItems/FtpStorageFile.cs @@ -1,7 +1,7 @@ using Files.Shared.Extensions; using Files.Uwp.Helpers; using FluentFTP; -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using System; using System.IO; using System.Runtime.InteropServices.WindowsRuntime; @@ -102,13 +102,13 @@ public override IAsyncOperation OpenAsync(FileAccessMode ac if (accessMode is FileAccessMode.Read) { - var inStream = await ftpClient.OpenReadAsync(FtpPath, cancellationToken); + var inStream = await ftpClient.OpenReadAsync(FtpPath, token: cancellationToken); return new NonSeekableRandomAccessStreamForRead(inStream, (ulong)inStream.Length) { DisposeCallback = ftpClient.Dispose }; } - return new NonSeekableRandomAccessStreamForWrite(await ftpClient.OpenWriteAsync(FtpPath, cancellationToken)) + return new NonSeekableRandomAccessStreamForWrite(await ftpClient.OpenWriteAsync(FtpPath, token: cancellationToken)) { DisposeCallback = ftpClient.Dispose }; @@ -126,7 +126,7 @@ public override IAsyncOperation OpenReadAsyn return null; } - var inStream = await ftpClient.OpenReadAsync(FtpPath, cancellationToken); + var inStream = await ftpClient.OpenReadAsync(FtpPath, token: cancellationToken); var nsStream = new NonSeekableRandomAccessStreamForRead(inStream, (ulong)inStream.Length) { DisposeCallback = ftpClient.Dispose }; return new StreamWithContentType(nsStream); }); @@ -141,7 +141,7 @@ public override IAsyncOperation OpenSequentialReadAsync() return null; } - var inStream = await ftpClient.OpenReadAsync(FtpPath, cancellationToken); + var inStream = await ftpClient.OpenReadAsync(FtpPath, token: cancellationToken); return new InputStreamWithDisposeCallback(inStream) { DisposeCallback = () => ftpClient.Dispose() }; }); } @@ -167,7 +167,7 @@ public override IAsyncOperation CopyAsync(IStorageFolder destin if (destFolder is ICreateFileWithStream cwsf) { - using var inStream = await ftpClient.OpenReadAsync(FtpPath, cancellationToken); + using var inStream = await ftpClient.OpenReadAsync(FtpPath, token: cancellationToken); return await cwsf.CreateFileAsync(inStream, desiredNewName, option.Convert()); } else diff --git a/src/Files.Uwp/Filesystem/StorageItems/FtpStorageFolder.cs b/src/Files.Uwp/Filesystem/StorageItems/FtpStorageFolder.cs index 659e64f5f7a8..441516068546 100644 --- a/src/Files.Uwp/Filesystem/StorageItems/FtpStorageFolder.cs +++ b/src/Files.Uwp/Filesystem/StorageItems/FtpStorageFolder.cs @@ -1,7 +1,7 @@ using Files.Shared.Extensions; using Files.Uwp.Helpers; using FluentFTP; -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using System; using System.Collections.Generic; using System.IO; diff --git a/src/Files.Uwp/Filesystem/StorageItems/NativeStorageFile.cs b/src/Files.Uwp/Filesystem/StorageItems/NativeStorageFile.cs index 876733850cc8..bb75087c0ab3 100644 --- a/src/Files.Uwp/Filesystem/StorageItems/NativeStorageFile.cs +++ b/src/Files.Uwp/Filesystem/StorageItems/NativeStorageFile.cs @@ -1,5 +1,5 @@ using Files.Uwp.Helpers; -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using System; using System.ComponentModel; using System.IO; diff --git a/src/Files.Uwp/Filesystem/StorageItems/ZipStorageFile.cs b/src/Files.Uwp/Filesystem/StorageItems/ZipStorageFile.cs index 375d3150d9a8..adee8e862367 100644 --- a/src/Files.Uwp/Filesystem/StorageItems/ZipStorageFile.cs +++ b/src/Files.Uwp/Filesystem/StorageItems/ZipStorageFile.cs @@ -1,5 +1,5 @@ using Files.Uwp.Helpers; -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using SevenZip; using System; using System.Collections.Generic; diff --git a/src/Files.Uwp/Filesystem/StorageItems/ZipStorageFolder.cs b/src/Files.Uwp/Filesystem/StorageItems/ZipStorageFolder.cs index 2003f064b85a..4cec4fc6ac9d 100644 --- a/src/Files.Uwp/Filesystem/StorageItems/ZipStorageFolder.cs +++ b/src/Files.Uwp/Filesystem/StorageItems/ZipStorageFolder.cs @@ -1,7 +1,7 @@ using Files.Uwp.Extensions; using Files.Uwp.Helpers; using Files.Shared.Extensions; -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using SevenZip; using System; using System.Collections.Generic; diff --git a/src/Files.Uwp/Helpers/AppUpdater.cs b/src/Files.Uwp/Helpers/AppUpdater.cs index 007661aa5d18..942dcd20073a 100644 --- a/src/Files.Uwp/Helpers/AppUpdater.cs +++ b/src/Files.Uwp/Helpers/AppUpdater.cs @@ -1,4 +1,4 @@ -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using System; using System.Collections.Generic; using System.Linq; @@ -70,14 +70,16 @@ private async Task DownloadUpdatesConsent() } return false; } - private ContentDialog SetContentDialogRoot(ContentDialog contentDialog) - { - if (Windows.Foundation.Metadata.ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 8)) - { - contentDialog.XamlRoot = this.Content.XamlRoot; - } - return contentDialog; - } + + // WINUI3 + private ContentDialog SetContentDialogRoot(ContentDialog contentDialog) + { + if (Windows.Foundation.Metadata.ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 8)) + { + contentDialog.XamlRoot = App.Window.Content.XamlRoot; + } + return contentDialog; + } private async Task DownloadUpdates(IReadOnlyList updateList) { diff --git a/src/Files.Uwp/Helpers/CommonPaths.cs b/src/Files.Uwp/Helpers/CommonPaths.cs index 7ce70ed075d7..2e615bdd24d3 100644 --- a/src/Files.Uwp/Helpers/CommonPaths.cs +++ b/src/Files.Uwp/Helpers/CommonPaths.cs @@ -1,6 +1,6 @@ using Files.Shared; using Files.Shared.Extensions; -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using System; using System.Collections.Generic; using Windows.Storage; diff --git a/src/Files.Uwp/Helpers/ContextFlyoutItemHelper.cs b/src/Files.Uwp/Helpers/ContextFlyoutItemHelper.cs index 9abd9b071c09..fb53fc8cc640 100644 --- a/src/Files.Uwp/Helpers/ContextFlyoutItemHelper.cs +++ b/src/Files.Uwp/Helpers/ContextFlyoutItemHelper.cs @@ -7,7 +7,7 @@ using Files.Uwp.Filesystem; using Files.Uwp.Interacts; using Files.Uwp.ViewModels; -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using System; using System.Collections.Generic; using System.IO; diff --git a/src/Files.Uwp/Helpers/DriveHelpers.cs b/src/Files.Uwp/Helpers/DriveHelpers.cs index 442a766b057d..3b3a0335d36c 100644 --- a/src/Files.Uwp/Helpers/DriveHelpers.cs +++ b/src/Files.Uwp/Helpers/DriveHelpers.cs @@ -1,9 +1,9 @@ using Files.Uwp.Interacts; -using Microsoft.Toolkit.Uwp; -using Microsoft.Toolkit.Uwp.Notifications; +using CommunityToolkit.WinUI; using System.Diagnostics; using System.Threading.Tasks; using Windows.UI.Notifications; +using CommunityToolkit.WinUI.Notifications; namespace Files.Uwp.Helpers { diff --git a/src/Files.Uwp/Helpers/DynamicDialogFactory.cs b/src/Files.Uwp/Helpers/DynamicDialogFactory.cs index 8d69a6d0aeb4..67580af6b9a7 100644 --- a/src/Files.Uwp/Helpers/DynamicDialogFactory.cs +++ b/src/Files.Uwp/Helpers/DynamicDialogFactory.cs @@ -3,7 +3,7 @@ using Files.Shared.Extensions; using Files.Uwp.Filesystem; using Files.Uwp.ViewModels.Dialogs; -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using System; using Windows.System; using Microsoft.UI.Xaml.Controls; diff --git a/src/Files.Uwp/Helpers/ExternalResourcesHelper.cs b/src/Files.Uwp/Helpers/ExternalResourcesHelper.cs index c5fa8fc08e8c..12c93dc73b04 100644 --- a/src/Files.Uwp/Helpers/ExternalResourcesHelper.cs +++ b/src/Files.Uwp/Helpers/ExternalResourcesHelper.cs @@ -1,4 +1,4 @@ -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/src/Files.Uwp/Helpers/FilePropertiesHelpers.cs b/src/Files.Uwp/Helpers/FilePropertiesHelpers.cs index 2cd07ca99006..a961d9accfdb 100644 --- a/src/Files.Uwp/Helpers/FilePropertiesHelpers.cs +++ b/src/Files.Uwp/Helpers/FilePropertiesHelpers.cs @@ -1,6 +1,6 @@ using Files.Uwp.Dialogs; using Files.Uwp.Views; -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using System; using System.Linq; using System.Threading.Tasks; diff --git a/src/Files.Uwp/Helpers/ItemListDisplayHelpers/GroupedCollection.cs b/src/Files.Uwp/Helpers/ItemListDisplayHelpers/GroupedCollection.cs index d24eaaadccf6..0734d64ca0ea 100644 --- a/src/Files.Uwp/Helpers/ItemListDisplayHelpers/GroupedCollection.cs +++ b/src/Files.Uwp/Helpers/ItemListDisplayHelpers/GroupedCollection.cs @@ -1,5 +1,5 @@ using CommunityToolkit.Mvvm.ComponentModel; -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using System; using System.Collections.Generic; using System.ComponentModel; diff --git a/src/Files.Uwp/Helpers/ItemListDisplayHelpers/GroupingHelper.cs b/src/Files.Uwp/Helpers/ItemListDisplayHelpers/GroupingHelper.cs index 265db7fa4f40..9527930849a1 100644 --- a/src/Files.Uwp/Helpers/ItemListDisplayHelpers/GroupingHelper.cs +++ b/src/Files.Uwp/Helpers/ItemListDisplayHelpers/GroupingHelper.cs @@ -3,7 +3,7 @@ using Files.Shared.Services.DateTimeFormatter; using Files.Uwp.Extensions; using Files.Uwp.Filesystem; -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using System; using System.Linq; using Windows.Storage; diff --git a/src/Files.Uwp/Helpers/LibraryHelper.cs b/src/Files.Uwp/Helpers/LibraryHelper.cs index 71d74c7f30c2..8a89ce8c125d 100644 --- a/src/Files.Uwp/Helpers/LibraryHelper.cs +++ b/src/Files.Uwp/Helpers/LibraryHelper.cs @@ -3,7 +3,7 @@ using Files.Uwp.Dialogs; using Files.Uwp.Filesystem; using Files.Uwp.ViewModels.Dialogs; -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using Newtonsoft.Json; using System; using System.Collections.Generic; diff --git a/src/Files.Uwp/Helpers/LocalizedEnumHelper.cs b/src/Files.Uwp/Helpers/LocalizedEnumHelper.cs index 65885ea04bb3..0013aa498ed7 100644 --- a/src/Files.Uwp/Helpers/LocalizedEnumHelper.cs +++ b/src/Files.Uwp/Helpers/LocalizedEnumHelper.cs @@ -1,4 +1,4 @@ -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using System; namespace Files.Uwp.Helpers diff --git a/src/Files.Uwp/Helpers/MultitaskingTabsHelpers.cs b/src/Files.Uwp/Helpers/MultitaskingTabsHelpers.cs index 16e14306be87..4d92b1f388f1 100644 --- a/src/Files.Uwp/Helpers/MultitaskingTabsHelpers.cs +++ b/src/Files.Uwp/Helpers/MultitaskingTabsHelpers.cs @@ -1,6 +1,6 @@ using Files.Uwp.UserControls.MultitaskingControl; using Files.Uwp.ViewModels; -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using Microsoft.UI.Xaml.Controls; using System; using System.Linq; diff --git a/src/Files.Uwp/Helpers/NavigationHelpers.cs b/src/Files.Uwp/Helpers/NavigationHelpers.cs index 2d947a68a286..d03e11777599 100644 --- a/src/Files.Uwp/Helpers/NavigationHelpers.cs +++ b/src/Files.Uwp/Helpers/NavigationHelpers.cs @@ -7,7 +7,7 @@ using Files.Uwp.Filesystem.StorageItems; using Files.Uwp.ViewModels; using Files.Uwp.Views; -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using Newtonsoft.Json; using System; using System.Collections.Generic; @@ -417,7 +417,7 @@ private static async Task OpenFile(string path, IShellPage ass if (openViaApplicationPicker) { - LauncherOptions options = this.InitializeWithWindow(new LauncherOptions + LauncherOptions options = InitializeWithWindow(new LauncherOptions { DisplayApplicationPicker = true }); @@ -500,7 +500,7 @@ await connection.SendMessageAsync(new ValueSet() break; } - var options = this.InitializeWithWindow(new LauncherOptions()); + var options = InitializeWithWindow(new LauncherOptions()); if (currentFolder.AreQueryOptionsSupported(queryOptions)) { fileQueryResult = currentFolder.CreateFileQueryWithOptions(queryOptions); @@ -524,10 +524,12 @@ await connection.SendMessageAsync(new ValueSet() } return opened; } - private LauncherOptions InitializeWithWindow(LauncherOptions obj) - { - WinRT.Interop.InitializeWithWindow.Initialize(obj, App.WindowHandle); - return obj; - } + + // WINUI3 + private static LauncherOptions InitializeWithWindow(LauncherOptions obj) + { + WinRT.Interop.InitializeWithWindow.Initialize(obj, App.WindowHandle); + return obj; + } } } \ No newline at end of file diff --git a/src/Files.Uwp/Helpers/PostBannerHelpers.cs b/src/Files.Uwp/Helpers/PostBannerHelpers.cs index 57702a5102b5..42a3a5dcb202 100644 --- a/src/Files.Uwp/Helpers/PostBannerHelpers.cs +++ b/src/Files.Uwp/Helpers/PostBannerHelpers.cs @@ -1,7 +1,7 @@ using Files.Shared.Enums; using Files.Uwp.Filesystem; using Files.Uwp.ViewModels; -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using System.Collections.Generic; using System.Linq; using System.Threading; diff --git a/src/Files.Uwp/Helpers/RecycleBinHelpers.cs b/src/Files.Uwp/Helpers/RecycleBinHelpers.cs index d08487fe6bf6..3b4c71b256ad 100644 --- a/src/Files.Uwp/Helpers/RecycleBinHelpers.cs +++ b/src/Files.Uwp/Helpers/RecycleBinHelpers.cs @@ -1,6 +1,6 @@ using Files.Shared; using Files.Shared.Extensions; -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using Newtonsoft.Json; using System; using System.Collections.Generic; @@ -103,14 +103,16 @@ public async Task EmptyRecycleBin() } } } - private ContentDialog SetContentDialogRoot(ContentDialog contentDialog) - { - if (Windows.Foundation.Metadata.ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 8)) - { - contentDialog.XamlRoot = this.Content.XamlRoot; - } - return contentDialog; - } + + //WINUI3 + private ContentDialog SetContentDialogRoot(ContentDialog contentDialog) + { + if (Windows.Foundation.Metadata.ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 8)) + { + contentDialog.XamlRoot = App.Window.Content.XamlRoot; + } + return contentDialog; + } public async Task HasRecycleBin(string path) { diff --git a/src/Files.Uwp/Helpers/ShellContextMenuHelper.cs b/src/Files.Uwp/Helpers/ShellContextMenuHelper.cs index d17e3e9d185b..9507bfb37e1b 100644 --- a/src/Files.Uwp/Helpers/ShellContextMenuHelper.cs +++ b/src/Files.Uwp/Helpers/ShellContextMenuHelper.cs @@ -2,7 +2,7 @@ using Files.Uwp.Filesystem; using Files.Uwp.ViewModels; using CommunityToolkit.Mvvm.Input; -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using Newtonsoft.Json; using System; using System.Collections.Generic; diff --git a/src/Files.Uwp/Helpers/UIFilesystemHelpers.cs b/src/Files.Uwp/Helpers/UIFilesystemHelpers.cs index c9a958b297ba..a5584077f5e6 100644 --- a/src/Files.Uwp/Helpers/UIFilesystemHelpers.cs +++ b/src/Files.Uwp/Helpers/UIFilesystemHelpers.cs @@ -6,7 +6,7 @@ using Files.Uwp.Filesystem.StorageItems; using Files.Uwp.Interacts; using Files.Uwp.ViewModels; -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using System; using System.Collections.Concurrent; using System.IO; diff --git a/src/Files.Uwp/Interacts/BaseLayoutCommandImplementationModel.cs b/src/Files.Uwp/Interacts/BaseLayoutCommandImplementationModel.cs index ad92f81c50e5..f9ad408a5465 100644 --- a/src/Files.Uwp/Interacts/BaseLayoutCommandImplementationModel.cs +++ b/src/Files.Uwp/Interacts/BaseLayoutCommandImplementationModel.cs @@ -8,7 +8,7 @@ using Files.Uwp.ViewModels; using Files.Uwp.ViewModels.Dialogs; using Files.Uwp.Views; -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/src/Files.Uwp/ServicesImplementation/DateTimeFormatter/AbstractDateTimeFormatter.cs b/src/Files.Uwp/ServicesImplementation/DateTimeFormatter/AbstractDateTimeFormatter.cs index 764e435ce9a3..2cc9183232bf 100644 --- a/src/Files.Uwp/ServicesImplementation/DateTimeFormatter/AbstractDateTimeFormatter.cs +++ b/src/Files.Uwp/ServicesImplementation/DateTimeFormatter/AbstractDateTimeFormatter.cs @@ -1,5 +1,5 @@ using Files.Shared.Services.DateTimeFormatter; -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using System; using System.Globalization; diff --git a/src/Files.Uwp/ServicesImplementation/DateTimeFormatter/ApplicationDateTimeFormatter.cs b/src/Files.Uwp/ServicesImplementation/DateTimeFormatter/ApplicationDateTimeFormatter.cs index 4e6506ebe037..87e4df1daeb2 100644 --- a/src/Files.Uwp/ServicesImplementation/DateTimeFormatter/ApplicationDateTimeFormatter.cs +++ b/src/Files.Uwp/ServicesImplementation/DateTimeFormatter/ApplicationDateTimeFormatter.cs @@ -1,4 +1,4 @@ -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using System; namespace Files.Uwp.ServicesImplementation.DateTimeFormatter diff --git a/src/Files.Uwp/ServicesImplementation/DateTimeFormatter/SystemDateTimeFormatter.cs b/src/Files.Uwp/ServicesImplementation/DateTimeFormatter/SystemDateTimeFormatter.cs index 8b3378ec23ff..5140ea12c36e 100644 --- a/src/Files.Uwp/ServicesImplementation/DateTimeFormatter/SystemDateTimeFormatter.cs +++ b/src/Files.Uwp/ServicesImplementation/DateTimeFormatter/SystemDateTimeFormatter.cs @@ -1,4 +1,4 @@ -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using System; namespace Files.Uwp.ServicesImplementation.DateTimeFormatter diff --git a/src/Files.Uwp/ServicesImplementation/DateTimeFormatter/UniversalDateTimeFormatter.cs b/src/Files.Uwp/ServicesImplementation/DateTimeFormatter/UniversalDateTimeFormatter.cs index 802b88b6ca11..ee668114c090 100644 --- a/src/Files.Uwp/ServicesImplementation/DateTimeFormatter/UniversalDateTimeFormatter.cs +++ b/src/Files.Uwp/ServicesImplementation/DateTimeFormatter/UniversalDateTimeFormatter.cs @@ -1,4 +1,4 @@ -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using System; namespace Files.Uwp.ServicesImplementation.DateTimeFormatter diff --git a/src/Files.Uwp/ServicesImplementation/LocalizationService.cs b/src/Files.Uwp/ServicesImplementation/LocalizationService.cs index 0e6d2db3f385..4fe191685e9e 100644 --- a/src/Files.Uwp/ServicesImplementation/LocalizationService.cs +++ b/src/Files.Uwp/ServicesImplementation/LocalizationService.cs @@ -1,5 +1,5 @@ using Files.Backend.Services; -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; namespace Files.Uwp.ServicesImplementation { diff --git a/src/Files.Uwp/ServicesImplementation/Settings/FileTagsSettingsService.cs b/src/Files.Uwp/ServicesImplementation/Settings/FileTagsSettingsService.cs index 329fcb0c8804..8a63f2d862a5 100644 --- a/src/Files.Uwp/ServicesImplementation/Settings/FileTagsSettingsService.cs +++ b/src/Files.Uwp/ServicesImplementation/Settings/FileTagsSettingsService.cs @@ -2,7 +2,7 @@ using Files.Backend.ViewModels.FileTags; using Files.Uwp.Serialization; using Files.Uwp.Serialization.Implementation; -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using System; using System.Collections.Generic; using System.IO; diff --git a/src/Files.Uwp/ServicesImplementation/ThreadingService.cs b/src/Files.Uwp/ServicesImplementation/ThreadingService.cs index db486715884f..fcd8b441f353 100644 --- a/src/Files.Uwp/ServicesImplementation/ThreadingService.cs +++ b/src/Files.Uwp/ServicesImplementation/ThreadingService.cs @@ -1,8 +1,8 @@ using System; using System.Threading.Tasks; using Files.Backend.Services; -using Microsoft.Toolkit.Uwp; -using Windows.System; +using CommunityToolkit.WinUI; +using Microsoft.UI.Dispatching; namespace Files.Uwp.ServicesImplementation { diff --git a/src/Files.Uwp/ServicesImplementation/UpdateService.cs b/src/Files.Uwp/ServicesImplementation/UpdateService.cs index ede6c20d4418..2f1438380334 100644 --- a/src/Files.Uwp/ServicesImplementation/UpdateService.cs +++ b/src/Files.Uwp/ServicesImplementation/UpdateService.cs @@ -7,7 +7,7 @@ using Microsoft.UI.Xaml.Controls; using CommunityToolkit.Mvvm.ComponentModel; using Files.Backend.Services; -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; namespace Files.Uwp.ServicesImplementation { @@ -50,7 +50,7 @@ public UpdateService() _updatePackages = new List(); } - public void ReportToAppCenter() {} + public void ReportToAppCenter() { } public async Task DownloadUpdates() { @@ -134,23 +134,25 @@ private static async Task ShowDialogAsync() //TODO: Use IDialogService in future. ContentDialog dialog = new() { - Title = "ConsentDialogTitle".GetLocalized(), - Content = "ConsentDialogContent".GetLocalized(), - CloseButtonText = "Close".GetLocalized(), + Title = "ConsentDialogTitle".GetLocalized(), + Content = "ConsentDialogContent".GetLocalized(), + CloseButtonText = "Close".GetLocalized(), PrimaryButtonText = "ConsentDialogPrimaryButtonText".GetLocalized() }; - ContentDialogResult result = await this.SetContentDialogRoot(dialog).ShowAsync(); + ContentDialogResult result = await SetContentDialogRoot(dialog).ShowAsync(); return result == ContentDialogResult.Primary; } - private ContentDialog SetContentDialogRoot(ContentDialog contentDialog) - { - if (Windows.Foundation.Metadata.ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 8)) - { - contentDialog.XamlRoot = this.Content.XamlRoot; - } - return contentDialog; - } + + // WINUI3 + private static ContentDialog SetContentDialogRoot(ContentDialog contentDialog) + { + if (Windows.Foundation.Metadata.ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 8)) + { + contentDialog.XamlRoot = App.Window.Content.XamlRoot; + } + return contentDialog; + } private bool HasUpdates() { diff --git a/src/Files.Uwp/UserControls/FolderEmptyIndicator.xaml.cs b/src/Files.Uwp/UserControls/FolderEmptyIndicator.xaml.cs index 02611a97c969..5047bcb3ecc9 100644 --- a/src/Files.Uwp/UserControls/FolderEmptyIndicator.xaml.cs +++ b/src/Files.Uwp/UserControls/FolderEmptyIndicator.xaml.cs @@ -1,4 +1,4 @@ -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; diff --git a/src/Files.Uwp/UserControls/MultitaskingControl/HorizontalMultitaskingControl.xaml.cs b/src/Files.Uwp/UserControls/MultitaskingControl/HorizontalMultitaskingControl.xaml.cs index 10370346924f..c67475631783 100644 --- a/src/Files.Uwp/UserControls/MultitaskingControl/HorizontalMultitaskingControl.xaml.cs +++ b/src/Files.Uwp/UserControls/MultitaskingControl/HorizontalMultitaskingControl.xaml.cs @@ -1,6 +1,6 @@ using Files.Uwp.Helpers; using Files.Uwp.ViewModels; -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using Microsoft.UI.Xaml.Controls; using System; using System.Linq; diff --git a/src/Files.Uwp/UserControls/MultitaskingControl/VerticalTabViewControl.xaml.cs b/src/Files.Uwp/UserControls/MultitaskingControl/VerticalTabViewControl.xaml.cs index 665daf5eaf78..03f609e9a61f 100644 --- a/src/Files.Uwp/UserControls/MultitaskingControl/VerticalTabViewControl.xaml.cs +++ b/src/Files.Uwp/UserControls/MultitaskingControl/VerticalTabViewControl.xaml.cs @@ -1,6 +1,6 @@ using Files.Uwp.Helpers; using Files.Uwp.ViewModels; -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using Microsoft.UI.Xaml.Controls; using System; using Windows.ApplicationModel.DataTransfer; diff --git a/src/Files.Uwp/UserControls/Pane/PreviewPane.xaml.cs b/src/Files.Uwp/UserControls/Pane/PreviewPane.xaml.cs index 66d0a6de0f14..434d6e6e1736 100644 --- a/src/Files.Uwp/UserControls/Pane/PreviewPane.xaml.cs +++ b/src/Files.Uwp/UserControls/Pane/PreviewPane.xaml.cs @@ -2,7 +2,7 @@ using Files.Uwp.ViewModels; using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.DependencyInjection; -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Input; diff --git a/src/Files.Uwp/UserControls/SidebarControl.xaml.cs b/src/Files.Uwp/UserControls/SidebarControl.xaml.cs index 8fabb5e44a62..bb1f474bf0a6 100644 --- a/src/Files.Uwp/UserControls/SidebarControl.xaml.cs +++ b/src/Files.Uwp/UserControls/SidebarControl.xaml.cs @@ -9,8 +9,7 @@ using Files.Uwp.Helpers; using Files.Uwp.Helpers.ContextFlyouts; using Files.Uwp.ViewModels; -using Microsoft.Toolkit.Uwp; -using Microsoft.Toolkit.Uwp.UI; +using CommunityToolkit.WinUI; using System; using System.Collections.Generic; using System.ComponentModel; @@ -26,6 +25,7 @@ using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Controls.Primitives; using Microsoft.UI.Xaml.Input; +using DispatcherQueueTimer = Microsoft.UI.Dispatching.DispatcherQueueTimer; namespace Files.Uwp.UserControls { @@ -140,8 +140,8 @@ public SidebarControl() this.InitializeComponent(); this.Loaded += SidebarNavView_Loaded; - dragOverSectionTimer = DispatcherQueue.GetForCurrentThread().CreateTimer(); - dragOverItemTimer = DispatcherQueue.GetForCurrentThread().CreateTimer(); + dragOverSectionTimer = DispatcherQueue.CreateTimer(); + dragOverItemTimer = DispatcherQueue.CreateTimer(); HideSectionCommand = new RelayCommand(HideSection); UnpinItemCommand = new RelayCommand(UnpinItem); diff --git a/src/Files.Uwp/UserControls/Widgets/BundlesWidget.xaml.cs b/src/Files.Uwp/UserControls/Widgets/BundlesWidget.xaml.cs index 743b7f85bfbb..1c0c8fea2793 100644 --- a/src/Files.Uwp/UserControls/Widgets/BundlesWidget.xaml.cs +++ b/src/Files.Uwp/UserControls/Widgets/BundlesWidget.xaml.cs @@ -2,7 +2,7 @@ using Files.Uwp.ViewModels.Widgets; using Files.Uwp.ViewModels.Widgets.Bundles; using CommunityToolkit.Mvvm.DependencyInjection; -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using System; using Microsoft.UI.Xaml.Controls; using System.Threading.Tasks; diff --git a/src/Files.Uwp/UserControls/Widgets/DrivesWidget.xaml.cs b/src/Files.Uwp/UserControls/Widgets/DrivesWidget.xaml.cs index 71956ed3021c..95d8ae3deca0 100644 --- a/src/Files.Uwp/UserControls/Widgets/DrivesWidget.xaml.cs +++ b/src/Files.Uwp/UserControls/Widgets/DrivesWidget.xaml.cs @@ -3,7 +3,7 @@ using Files.Backend.Services.Settings; using Files.Uwp.ViewModels.Widgets; using CommunityToolkit.Mvvm.DependencyInjection; -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using System; using System.Collections.ObjectModel; using System.ComponentModel; diff --git a/src/Files.Uwp/UserControls/Widgets/FolderWidget.xaml.cs b/src/Files.Uwp/UserControls/Widgets/FolderWidget.xaml.cs index fc7eccb1394d..241ac7c470a3 100644 --- a/src/Files.Uwp/UserControls/Widgets/FolderWidget.xaml.cs +++ b/src/Files.Uwp/UserControls/Widgets/FolderWidget.xaml.cs @@ -5,7 +5,7 @@ using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.DependencyInjection; using CommunityToolkit.Mvvm.Input; -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using System; using System.ComponentModel; using System.Linq; diff --git a/src/Files.Uwp/UserControls/Widgets/RecentFilesWidget.xaml.cs b/src/Files.Uwp/UserControls/Widgets/RecentFilesWidget.xaml.cs index 97dc9309968d..5a001a915217 100644 --- a/src/Files.Uwp/UserControls/Widgets/RecentFilesWidget.xaml.cs +++ b/src/Files.Uwp/UserControls/Widgets/RecentFilesWidget.xaml.cs @@ -5,7 +5,7 @@ using Files.Uwp.ViewModels; using Files.Uwp.ViewModels.Widgets; using CommunityToolkit.Mvvm.DependencyInjection; -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using System; using System.Collections.ObjectModel; using System.ComponentModel; diff --git a/src/Files.Uwp/ViewModels/ItemViewModel.cs b/src/Files.Uwp/ViewModels/ItemViewModel.cs index 24dfb8ef3d57..4ed672064678 100644 --- a/src/Files.Uwp/ViewModels/ItemViewModel.cs +++ b/src/Files.Uwp/ViewModels/ItemViewModel.cs @@ -20,7 +20,7 @@ using Files.Uwp.UserControls; using Files.Uwp.ViewModels.Previews; using FluentFTP; -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using Newtonsoft.Json; using System; using System.Collections.Concurrent; @@ -47,6 +47,7 @@ using static Files.Backend.Helpers.NativeFindStorageItemHelper; using static Files.Uwp.Helpers.NativeDirectoryChangesHelper; using FileAttributes = System.IO.FileAttributes; +using DispatcherQueue = Microsoft.UI.Dispatching.DispatcherQueue; namespace Files.Uwp.ViewModels { @@ -437,7 +438,7 @@ await dispatcherQueue.EnqueueAsync(() => matchingItem.FileSize = e.NewSize.ToSizeString(); } DirectoryInfoUpdated?.Invoke(this, EventArgs.Empty); - }, DispatcherQueuePriority.Low); + }, Microsoft.UI.Dispatching.DispatcherQueuePriority.Low); } } finally @@ -879,7 +880,7 @@ await Task.Run(async () => await dispatcherQueue.EnqueueAsync(() => { gp.Model.ImageSource = img; - }, DispatcherQueuePriority.Low); + }, Microsoft.UI.Dispatching.DispatcherQueuePriority.Low); } }); } @@ -955,7 +956,7 @@ await dispatcherQueue.EnqueueAsync(async () => { DefaultIcons.AddIfNotPresent(item.FileExtension.ToLowerInvariant(), item.FileImage); } - }, DispatcherQueuePriority.Normal); + }, Microsoft.UI.Dispatching.DispatcherQueuePriority.Normal); wasIconLoaded = true; } @@ -965,7 +966,7 @@ await dispatcherQueue.EnqueueAsync(async () => await dispatcherQueue.EnqueueAsync(async () => { item.IconOverlay = await overlayInfo.ToBitmapAsync(); - }, DispatcherQueuePriority.Low); + }, Microsoft.UI.Dispatching.DispatcherQueuePriority.Low); } } } @@ -984,7 +985,7 @@ await dispatcherQueue.EnqueueAsync(async () => { DefaultIcons.AddIfNotPresent(item.FileExtension.ToLowerInvariant(), item.FileImage); } - }, DispatcherQueuePriority.Low); + }, Microsoft.UI.Dispatching.DispatcherQueuePriority.Low); } if (iconInfo.OverlayData != null) @@ -992,7 +993,7 @@ await dispatcherQueue.EnqueueAsync(async () => await dispatcherQueue.EnqueueAsync(async () => { item.IconOverlay = await iconInfo.OverlayData.ToBitmapAsync(); - }, DispatcherQueuePriority.Low); + }, Microsoft.UI.Dispatching.DispatcherQueuePriority.Low); } } } @@ -1014,7 +1015,7 @@ await dispatcherQueue.EnqueueAsync(async () => item.FileImage.DecodePixelType = DecodePixelType.Logical; item.FileImage.DecodePixelWidth = (int)thumbnailSize; await item.FileImage.SetSourceAsync(Thumbnail); - }, DispatcherQueuePriority.Normal); + }, Microsoft.UI.Dispatching.DispatcherQueuePriority.Normal); wasIconLoaded = true; } @@ -1024,7 +1025,7 @@ await dispatcherQueue.EnqueueAsync(async () => await dispatcherQueue.EnqueueAsync(async () => { item.IconOverlay = await overlayInfo.ToBitmapAsync(); - }, DispatcherQueuePriority.Low); + }, Microsoft.UI.Dispatching.DispatcherQueuePriority.Low); } } } @@ -1037,7 +1038,7 @@ await dispatcherQueue.EnqueueAsync(async () => await dispatcherQueue.EnqueueAsync(async () => { item.FileImage = await iconInfo.IconData.ToBitmapAsync(); - }, DispatcherQueuePriority.Low); + }, Microsoft.UI.Dispatching.DispatcherQueuePriority.Low); } if (iconInfo.OverlayData != null) @@ -1045,7 +1046,7 @@ await dispatcherQueue.EnqueueAsync(async () => await dispatcherQueue.EnqueueAsync(async () => { item.IconOverlay = await iconInfo.OverlayData.ToBitmapAsync(); - }, DispatcherQueuePriority.Low); + }, Microsoft.UI.Dispatching.DispatcherQueuePriority.Low); } } } @@ -1111,7 +1112,7 @@ await dispatcherQueue.EnqueueAsync(() => item.SyncStatusUI = CloudDriveSyncStatusUI.FromCloudDriveSyncStatus(syncStatus); item.FileFRN = fileFRN; item.FileTags = fileTag; - }, DispatcherQueuePriority.Low); + }, Microsoft.UI.Dispatching.DispatcherQueuePriority.Low); FileTagsHelper.DbInstance.SetTags(item.ItemPath, item.FileFRN, item.FileTags); wasSyncStatusLoaded = true; } @@ -1158,7 +1159,7 @@ await dispatcherQueue.EnqueueAsync(() => item.SyncStatusUI = CloudDriveSyncStatusUI.FromCloudDriveSyncStatus(syncStatus); item.FileFRN = fileFRN; item.FileTags = fileTag; - }, DispatcherQueuePriority.Low); + }, Microsoft.UI.Dispatching.DispatcherQueuePriority.Low); FileTagsHelper.DbInstance.SetTags(item.ItemPath, item.FileFRN, item.FileTags); wasSyncStatusLoaded = true; } @@ -1191,7 +1192,7 @@ await dispatcherQueue.EnqueueAsync(() => { item.SyncStatusUI = new CloudDriveSyncStatusUI(); // Reset cloud sync status icon item.FileTags = fileTag; - }, DispatcherQueuePriority.Low); + }, Microsoft.UI.Dispatching.DispatcherQueuePriority.Low); FileTagsHelper.DbInstance.SetTags(item.ItemPath, item.FileFRN, item.FileTags); }); } @@ -1228,7 +1229,7 @@ private async Task GetItemTypeGroupIcon(ListedItem item, BaseStorag if (headerIconInfo != null && !item.IsShortcutItem) { - groupImage = await dispatcherQueue.EnqueueAsync(() => headerIconInfo.ToBitmapAsync(), DispatcherQueuePriority.Low); + groupImage = await dispatcherQueue.EnqueueAsync(() => headerIconInfo.ToBitmapAsync(), Microsoft.UI.Dispatching.DispatcherQueuePriority.Low); } if (!item.IsShortcutItem && !item.IsHiddenItem && !FtpHelpers.IsFtpPath(item.ItemPath)) { @@ -1259,7 +1260,7 @@ await dispatcherQueue.EnqueueAsync(async () => { RasterizePixelHeight = 128, RasterizePixelWidth = 128, - }, DispatcherQueuePriority.Low); + }, Microsoft.UI.Dispatching.DispatcherQueuePriority.Low); } return groupImage; @@ -2278,7 +2279,7 @@ await dispatcherQueue.EnqueueAsync(() => } } } - }, DispatcherQueuePriority.Low); + }, Microsoft.UI.Dispatching.DispatcherQueuePriority.Low); } finally { diff --git a/src/Files.Uwp/ViewModels/MainPageViewModel.cs b/src/Files.Uwp/ViewModels/MainPageViewModel.cs index 30575a328644..113738e1643e 100644 --- a/src/Files.Uwp/ViewModels/MainPageViewModel.cs +++ b/src/Files.Uwp/ViewModels/MainPageViewModel.cs @@ -8,7 +8,7 @@ using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.DependencyInjection; using CommunityToolkit.Mvvm.Input; -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using System; using System.Collections.Generic; using System.Collections.ObjectModel; diff --git a/src/Files.Uwp/ViewModels/Previews/ArchivePreviewViewModel.cs b/src/Files.Uwp/ViewModels/Previews/ArchivePreviewViewModel.cs index 716b726e35a6..e95a3f1c12b5 100644 --- a/src/Files.Uwp/ViewModels/Previews/ArchivePreviewViewModel.cs +++ b/src/Files.Uwp/ViewModels/Previews/ArchivePreviewViewModel.cs @@ -2,7 +2,7 @@ using Files.Uwp.Filesystem; using Files.Uwp.ViewModels.Properties; using SevenZip; -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using System.Collections.Generic; using System.IO; using System.Threading.Tasks; diff --git a/src/Files.Uwp/ViewModels/Previews/BasePreviewModel.cs b/src/Files.Uwp/ViewModels/Previews/BasePreviewModel.cs index 4783ba1ca99e..fd0ce361b482 100644 --- a/src/Files.Uwp/ViewModels/Previews/BasePreviewModel.cs +++ b/src/Files.Uwp/ViewModels/Previews/BasePreviewModel.cs @@ -5,7 +5,7 @@ using Files.Uwp.Filesystem.StorageItems; using Files.Uwp.Helpers; using Files.Uwp.ViewModels.Properties; -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using System; using System.Collections.Generic; using System.Linq; diff --git a/src/Files.Uwp/ViewModels/Previews/ImagePreviewViewModel.cs b/src/Files.Uwp/ViewModels/Previews/ImagePreviewViewModel.cs index e0410354a9d4..ff005834062d 100644 --- a/src/Files.Uwp/ViewModels/Previews/ImagePreviewViewModel.cs +++ b/src/Files.Uwp/ViewModels/Previews/ImagePreviewViewModel.cs @@ -1,6 +1,6 @@ using Files.Uwp.Filesystem; using Files.Uwp.ViewModels.Properties; -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using System; using System.Collections.Generic; using System.Threading.Tasks; diff --git a/src/Files.Uwp/ViewModels/Previews/PDFPreviewViewModel.cs b/src/Files.Uwp/ViewModels/Previews/PDFPreviewViewModel.cs index 52409eceb210..a4492600e7b6 100644 --- a/src/Files.Uwp/ViewModels/Previews/PDFPreviewViewModel.cs +++ b/src/Files.Uwp/ViewModels/Previews/PDFPreviewViewModel.cs @@ -1,6 +1,6 @@ using Files.Uwp.Filesystem; using Files.Uwp.ViewModels.Properties; -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using System; using System.Collections.Generic; using System.Collections.ObjectModel; diff --git a/src/Files.Uwp/ViewModels/Properties/BaseProperties.cs b/src/Files.Uwp/ViewModels/Properties/BaseProperties.cs index cbe270c5f41b..2cd80b6ed41d 100644 --- a/src/Files.Uwp/ViewModels/Properties/BaseProperties.cs +++ b/src/Files.Uwp/ViewModels/Properties/BaseProperties.cs @@ -2,7 +2,7 @@ using Files.Backend.Extensions; using Files.Shared.Services.DateTimeFormatter; using Files.Uwp.Extensions; -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using System; using System.Collections.Generic; using System.IO; diff --git a/src/Files.Uwp/ViewModels/Properties/CombinedProperties.cs b/src/Files.Uwp/ViewModels/Properties/CombinedProperties.cs index 2eedc4cb26d2..5b0c9e861a93 100644 --- a/src/Files.Uwp/ViewModels/Properties/CombinedProperties.cs +++ b/src/Files.Uwp/ViewModels/Properties/CombinedProperties.cs @@ -1,7 +1,7 @@ using Files.Uwp.Extensions; using Files.Uwp.Filesystem; using Files.Uwp.Helpers; -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using System; using System.Collections.Generic; using System.IO; diff --git a/src/Files.Uwp/ViewModels/Properties/DriveProperties.cs b/src/Files.Uwp/ViewModels/Properties/DriveProperties.cs index 735b3244bd60..dc26382c283f 100644 --- a/src/Files.Uwp/ViewModels/Properties/DriveProperties.cs +++ b/src/Files.Uwp/ViewModels/Properties/DriveProperties.cs @@ -2,7 +2,7 @@ using Files.Uwp.Filesystem; using Files.Uwp.Filesystem.StorageItems; using Files.Uwp.Helpers; -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using System; using Windows.Storage.FileProperties; diff --git a/src/Files.Uwp/ViewModels/Properties/FileProperties.cs b/src/Files.Uwp/ViewModels/Properties/FileProperties.cs index 0c0bc8513478..ab9001be459e 100644 --- a/src/Files.Uwp/ViewModels/Properties/FileProperties.cs +++ b/src/Files.Uwp/ViewModels/Properties/FileProperties.cs @@ -3,7 +3,7 @@ using Files.Uwp.Filesystem.StorageItems; using Files.Uwp.Helpers; using CommunityToolkit.Mvvm.Input; -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; diff --git a/src/Files.Uwp/ViewModels/Properties/FileProperty.cs b/src/Files.Uwp/ViewModels/Properties/FileProperty.cs index 53e91243baf9..352d08b947e2 100644 --- a/src/Files.Uwp/ViewModels/Properties/FileProperty.cs +++ b/src/Files.Uwp/ViewModels/Properties/FileProperty.cs @@ -2,7 +2,7 @@ using Files.Uwp.Filesystem.StorageItems; using Files.Uwp.Helpers; using CommunityToolkit.Mvvm.ComponentModel; -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using Newtonsoft.Json; using System; using System.Collections.Generic; diff --git a/src/Files.Uwp/ViewModels/Properties/FilePropertySection.cs b/src/Files.Uwp/ViewModels/Properties/FilePropertySection.cs index 768ae357379a..e9bb66497dd7 100644 --- a/src/Files.Uwp/ViewModels/Properties/FilePropertySection.cs +++ b/src/Files.Uwp/ViewModels/Properties/FilePropertySection.cs @@ -1,4 +1,4 @@ -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using System.Collections.Generic; using Microsoft.UI.Xaml; diff --git a/src/Files.Uwp/ViewModels/Properties/FolderProperties.cs b/src/Files.Uwp/ViewModels/Properties/FolderProperties.cs index 6cab8d35d644..a89a95ef5621 100644 --- a/src/Files.Uwp/ViewModels/Properties/FolderProperties.cs +++ b/src/Files.Uwp/ViewModels/Properties/FolderProperties.cs @@ -4,7 +4,7 @@ using Files.Uwp.Filesystem; using Files.Uwp.Filesystem.StorageItems; using Files.Uwp.Helpers; -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using System; using System.IO; using System.Threading; diff --git a/src/Files.Uwp/ViewModels/Properties/LibraryProperties.cs b/src/Files.Uwp/ViewModels/Properties/LibraryProperties.cs index 282a5657d13d..a8e54c68d069 100644 --- a/src/Files.Uwp/ViewModels/Properties/LibraryProperties.cs +++ b/src/Files.Uwp/ViewModels/Properties/LibraryProperties.cs @@ -4,7 +4,7 @@ using Files.Uwp.Filesystem; using Files.Uwp.Filesystem.StorageItems; using Files.Uwp.Helpers; -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using System; using System.Collections.Generic; using System.Threading; diff --git a/src/Files.Uwp/ViewModels/Properties/SecurityProperties.cs b/src/Files.Uwp/ViewModels/Properties/SecurityProperties.cs index ee23d059e1da..b651a32fcffe 100644 --- a/src/Files.Uwp/ViewModels/Properties/SecurityProperties.cs +++ b/src/Files.Uwp/ViewModels/Properties/SecurityProperties.cs @@ -5,7 +5,7 @@ using Files.Uwp.Helpers; using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.Input; -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using Newtonsoft.Json; using System; using System.Collections.Generic; diff --git a/src/Files.Uwp/ViewModels/SettingsViewModel.cs b/src/Files.Uwp/ViewModels/SettingsViewModel.cs index d812dea3882b..95b71ff5430c 100644 --- a/src/Files.Uwp/ViewModels/SettingsViewModel.cs +++ b/src/Files.Uwp/ViewModels/SettingsViewModel.cs @@ -4,7 +4,7 @@ using Files.Uwp.Helpers; using Files.Shared.Enums; using Files.Shared.Extensions; -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using System; using System.Collections.ObjectModel; using System.Linq; diff --git a/src/Files.Uwp/ViewModels/SettingsViewModels/AboutViewModel.cs b/src/Files.Uwp/ViewModels/SettingsViewModels/AboutViewModel.cs index 66c5dfdf85d3..0c3db2439ecf 100644 --- a/src/Files.Uwp/ViewModels/SettingsViewModels/AboutViewModel.cs +++ b/src/Files.Uwp/ViewModels/SettingsViewModels/AboutViewModel.cs @@ -6,8 +6,8 @@ using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.DependencyInjection; using CommunityToolkit.Mvvm.Input; -using Microsoft.Toolkit.Uwp; -using Microsoft.Toolkit.Uwp.Helpers; +using CommunityToolkit.WinUI; +using CommunityToolkit.WinUI.Helpers; using System; using System.IO; using System.Threading.Tasks; diff --git a/src/Files.Uwp/ViewModels/SettingsViewModels/AppearanceViewModel.cs b/src/Files.Uwp/ViewModels/SettingsViewModels/AppearanceViewModel.cs index c5158e7358dd..388cb75fa6f8 100644 --- a/src/Files.Uwp/ViewModels/SettingsViewModels/AppearanceViewModel.cs +++ b/src/Files.Uwp/ViewModels/SettingsViewModels/AppearanceViewModel.cs @@ -2,7 +2,7 @@ using CommunityToolkit.Mvvm.DependencyInjection; using Files.Backend.Services.Settings; using Files.Uwp.Helpers; -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using System; using System.Collections.Generic; using System.Threading.Tasks; diff --git a/src/Files.Uwp/ViewModels/SettingsViewModels/PreferencesViewModel.cs b/src/Files.Uwp/ViewModels/SettingsViewModels/PreferencesViewModel.cs index 5dae9a685239..8cd6a5aa61ed 100644 --- a/src/Files.Uwp/ViewModels/SettingsViewModels/PreferencesViewModel.cs +++ b/src/Files.Uwp/ViewModels/SettingsViewModels/PreferencesViewModel.cs @@ -9,7 +9,7 @@ using Files.Uwp.DataModels; using Files.Uwp.Filesystem; using Files.Uwp.Helpers; -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using System; using System.Collections.Generic; using System.Collections.ObjectModel; @@ -23,6 +23,7 @@ using Windows.Storage.AccessCache; using Windows.Storage.Pickers; using Windows.System; +using DispatcherQueue = Microsoft.UI.Dispatching.DispatcherQueue; using static Files.Uwp.Helpers.MenuFlyoutHelper; namespace Files.Uwp.ViewModels.SettingsViewModels diff --git a/src/Files.Uwp/ViewModels/SidebarViewModel.cs b/src/Files.Uwp/ViewModels/SidebarViewModel.cs index b59054a62af9..64e6a9c244f1 100644 --- a/src/Files.Uwp/ViewModels/SidebarViewModel.cs +++ b/src/Files.Uwp/ViewModels/SidebarViewModel.cs @@ -8,7 +8,7 @@ using Files.Uwp.Filesystem; using Files.Uwp.Helpers; using Files.Uwp.UserControls; -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using Microsoft.UI.Xaml.Controls; using System; using System.Collections.Generic; @@ -17,9 +17,9 @@ using System.Linq; using System.Threading.Tasks; using System.Windows.Input; -using Windows.System; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Media.Imaging; +using Microsoft.UI.Dispatching; namespace Files.Uwp.ViewModels { diff --git a/src/Files.Uwp/ViewModels/StatusCenterViewModel.cs b/src/Files.Uwp/ViewModels/StatusCenterViewModel.cs index f59ccf4ff56b..6d97d02ccb9c 100644 --- a/src/Files.Uwp/ViewModels/StatusCenterViewModel.cs +++ b/src/Files.Uwp/ViewModels/StatusCenterViewModel.cs @@ -3,7 +3,7 @@ using Files.Uwp.Interacts; using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.Input; -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using System; using System.Collections.ObjectModel; using System.Diagnostics; diff --git a/src/Files.Uwp/ViewModels/ToolbarViewModel.cs b/src/Files.Uwp/ViewModels/ToolbarViewModel.cs index 2cb412d13b7b..b7303177e550 100644 --- a/src/Files.Uwp/ViewModels/ToolbarViewModel.cs +++ b/src/Files.Uwp/ViewModels/ToolbarViewModel.cs @@ -11,8 +11,8 @@ using Files.Shared.Extensions; using Files.Uwp.UserControls; using Files.Uwp.Views; -using Microsoft.Toolkit.Uwp; -using Microsoft.Toolkit.Uwp.UI; +using CommunityToolkit.WinUI; +using CommunityToolkit.WinUI.UI; using System; using System.Collections.Generic; using System.Collections.ObjectModel; @@ -23,7 +23,6 @@ using Windows.ApplicationModel.DataTransfer; using Windows.Foundation.Collections; using Windows.Storage; -using Windows.System; using Windows.UI.Text; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; @@ -32,6 +31,7 @@ using static Files.Uwp.UserControls.IAddressToolbar; using SearchBox = Files.Uwp.UserControls.SearchBox; using SortDirection = Files.Shared.Enums.SortDirection; +using Microsoft.UI.Dispatching; namespace Files.Uwp.ViewModels { @@ -696,9 +696,9 @@ public void VisiblePath_QuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuer public void PathBoxItem_PointerPressed(object sender, PointerRoutedEventArgs e) { - if (e.Pointer.PointerDeviceType == Windows.Devices.Input.PointerDeviceType.Mouse) + if (e.Pointer.PointerDeviceType == Microsoft.UI.Input.PointerDeviceType.Mouse) { - Windows.UI.Input.PointerPoint ptrPt = e.GetCurrentPoint(AddressToolbar); + var ptrPt = e.GetCurrentPoint(AddressToolbar); if (ptrPt.Properties.IsMiddleButtonPressed) { pointerRoutedEventArgs = e; @@ -1067,7 +1067,7 @@ public async Task CheckPathInput(string currentInput, string currentSelectedPath try { - if (!await Launcher.LaunchUriAsync(new Uri(currentInput))) + if (!await Windows.System.Launcher.LaunchUriAsync(new Uri(currentInput))) { await DialogDisplayHelper.ShowDialogAsync("InvalidItemDialogTitle".GetLocalized(), string.Format("InvalidItemDialogContent".GetLocalized(), Environment.NewLine, resFolder.ErrorCode.ToString())); diff --git a/src/Files.Uwp/ViewModels/Widgets/Bundles/BundleContainerViewModel.cs b/src/Files.Uwp/ViewModels/Widgets/Bundles/BundleContainerViewModel.cs index e689ccd97051..9d56b9c12268 100644 --- a/src/Files.Uwp/ViewModels/Widgets/Bundles/BundleContainerViewModel.cs +++ b/src/Files.Uwp/ViewModels/Widgets/Bundles/BundleContainerViewModel.cs @@ -7,7 +7,7 @@ using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.DependencyInjection; using CommunityToolkit.Mvvm.Input; -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using System; using System.Collections.Generic; using System.Collections.ObjectModel; diff --git a/src/Files.Uwp/ViewModels/Widgets/Bundles/BundlesViewModel.cs b/src/Files.Uwp/ViewModels/Widgets/Bundles/BundlesViewModel.cs index 57615e1d70bf..3e66b24aedfb 100644 --- a/src/Files.Uwp/ViewModels/Widgets/Bundles/BundlesViewModel.cs +++ b/src/Files.Uwp/ViewModels/Widgets/Bundles/BundlesViewModel.cs @@ -8,7 +8,7 @@ using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.DependencyInjection; using CommunityToolkit.Mvvm.Input; -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using System; using System.Collections.Generic; using System.Collections.ObjectModel; diff --git a/src/Files.Uwp/Views/ColumnShellPage.xaml.cs b/src/Files.Uwp/Views/ColumnShellPage.xaml.cs index 5008209435cf..534d9eb02595 100644 --- a/src/Files.Uwp/Views/ColumnShellPage.xaml.cs +++ b/src/Files.Uwp/Views/ColumnShellPage.xaml.cs @@ -13,8 +13,7 @@ using Files.Uwp.Views.LayoutModes; using CommunityToolkit.Mvvm.DependencyInjection; using CommunityToolkit.Mvvm.Input; -using Microsoft.Toolkit.Uwp; -using Microsoft.Toolkit.Uwp.UI; +using CommunityToolkit.WinUI; using System; using System.Collections.Generic; using System.ComponentModel; @@ -37,6 +36,7 @@ using Files.Backend.Enums; using Files.Backend.Services; using Files.Backend.ViewModels.Dialogs.AddItemDialog; +using CommunityToolkit.WinUI.UI; // The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238 diff --git a/src/Files.Uwp/Views/CustomFolderIcons.xaml.cs b/src/Files.Uwp/Views/CustomFolderIcons.xaml.cs index 3b48d5b7a5f2..1483eb402fef 100644 --- a/src/Files.Uwp/Views/CustomFolderIcons.xaml.cs +++ b/src/Files.Uwp/Views/CustomFolderIcons.xaml.cs @@ -1,7 +1,7 @@ using Files.Shared; using Files.Uwp.Helpers; using CommunityToolkit.Mvvm.Input; -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using Newtonsoft.Json; using System; using System.Collections.Generic; diff --git a/src/Files.Uwp/Views/MainPage.xaml.cs b/src/Files.Uwp/Views/MainPage.xaml.cs index 156f891ae33b..ed427f1a0a57 100644 --- a/src/Files.Uwp/Views/MainPage.xaml.cs +++ b/src/Files.Uwp/Views/MainPage.xaml.cs @@ -11,9 +11,8 @@ using Files.Uwp.UserControls; using Files.Uwp.UserControls.MultitaskingControl; using Files.Uwp.ViewModels; -using Microsoft.Toolkit.Uwp; -using Microsoft.Toolkit.Uwp.Helpers; -using Microsoft.Toolkit.Uwp.UI.Controls; +using CommunityToolkit.WinUI; +using CommunityToolkit.WinUI.UI.Controls; using System; using System.ComponentModel; using System.Runtime.CompilerServices; @@ -28,6 +27,7 @@ using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Input; using Microsoft.UI.Xaml.Navigation; +using CommunityToolkit.WinUI.Helpers; namespace Files.Uwp.Views { diff --git a/src/Files.Uwp/Views/ModernShellPage.xaml.cs b/src/Files.Uwp/Views/ModernShellPage.xaml.cs index 441d79639849..504da5674bd6 100644 --- a/src/Files.Uwp/Views/ModernShellPage.xaml.cs +++ b/src/Files.Uwp/Views/ModernShellPage.xaml.cs @@ -13,7 +13,7 @@ using Files.Uwp.Views.LayoutModes; using CommunityToolkit.Mvvm.DependencyInjection; using CommunityToolkit.Mvvm.Input; -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using System; using System.Collections.Generic; using System.ComponentModel; diff --git a/src/Files.Uwp/Views/Pages/Properties.xaml.cs b/src/Files.Uwp/Views/Pages/Properties.xaml.cs index 95a12ab33d11..61710a0da06f 100644 --- a/src/Files.Uwp/Views/Pages/Properties.xaml.cs +++ b/src/Files.Uwp/Views/Pages/Properties.xaml.cs @@ -4,7 +4,7 @@ using Files.Uwp.Helpers.XamlHelpers; using Files.Uwp.ViewModels; using Files.Uwp.ViewModels.Properties; -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using System; using System.Threading; using Windows.ApplicationModel.Core; diff --git a/src/Files.Uwp/Views/Pages/PropertiesGeneral.xaml.cs b/src/Files.Uwp/Views/Pages/PropertiesGeneral.xaml.cs index d95f208fc61c..8158ffcba39f 100644 --- a/src/Files.Uwp/Views/Pages/PropertiesGeneral.xaml.cs +++ b/src/Files.Uwp/Views/Pages/PropertiesGeneral.xaml.cs @@ -3,7 +3,7 @@ using Files.Uwp.Helpers; using Files.Shared.Enums; using Files.Uwp.ViewModels.Properties; -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using System.IO; using System.Threading.Tasks; using Windows.ApplicationModel.Core; diff --git a/src/Files.Uwp/Views/Pages/PropertiesSecurity.xaml.cs b/src/Files.Uwp/Views/Pages/PropertiesSecurity.xaml.cs index 32fb4d5b1953..c3f3b0b0daee 100644 --- a/src/Files.Uwp/Views/Pages/PropertiesSecurity.xaml.cs +++ b/src/Files.Uwp/Views/Pages/PropertiesSecurity.xaml.cs @@ -2,7 +2,7 @@ using Files.Uwp.Filesystem; using Files.Uwp.ViewModels.Properties; using CommunityToolkit.Mvvm.Input; -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using System; using System.Threading.Tasks; using Windows.ApplicationModel.Core; diff --git a/src/Files.Uwp/Views/Pages/PropertiesSecurityAdvanced.xaml.cs b/src/Files.Uwp/Views/Pages/PropertiesSecurityAdvanced.xaml.cs index ceef6efc442d..6bcd7a623bf5 100644 --- a/src/Files.Uwp/Views/Pages/PropertiesSecurityAdvanced.xaml.cs +++ b/src/Files.Uwp/Views/Pages/PropertiesSecurityAdvanced.xaml.cs @@ -3,7 +3,7 @@ using Files.Uwp.Filesystem.Permissions; using Files.Uwp.Helpers; using Files.Uwp.ViewModels.Properties; -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using System; using System.Linq; using Windows.ApplicationModel.Core; diff --git a/src/Files.Uwp/Views/PaneHolderPage.xaml.cs b/src/Files.Uwp/Views/PaneHolderPage.xaml.cs index f1462496afe0..645ed373f341 100644 --- a/src/Files.Uwp/Views/PaneHolderPage.xaml.cs +++ b/src/Files.Uwp/Views/PaneHolderPage.xaml.cs @@ -3,7 +3,7 @@ using Files.Uwp.UserControls.MultitaskingControl; using Files.Uwp.Views.LayoutModes; using CommunityToolkit.Mvvm.DependencyInjection; -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using System; using System.ComponentModel; using System.Runtime.CompilerServices; diff --git a/src/Files.Uwp/Views/WidgetsPage.xaml.cs b/src/Files.Uwp/Views/WidgetsPage.xaml.cs index d9673988d6d0..4072815cfd37 100644 --- a/src/Files.Uwp/Views/WidgetsPage.xaml.cs +++ b/src/Files.Uwp/Views/WidgetsPage.xaml.cs @@ -7,7 +7,7 @@ using Files.Uwp.ViewModels; using Files.Uwp.ViewModels.Pages; using CommunityToolkit.Mvvm.DependencyInjection; -using Microsoft.Toolkit.Uwp; +using CommunityToolkit.WinUI; using System; using System.IO; using System.Linq; From 368123e2961391216a29f2114b5d1cbd2d9ab953 Mon Sep 17 00:00:00 2001 From: Marco Gavelli Date: Mon, 15 Aug 2022 04:53:17 +0200 Subject: [PATCH 06/99] Microsoft.Toolkit.Uwp.UI -> CommunityToolkit.WinUI.UI --- .../Behaviors/StickyHeaderBehavior.cs | 4 ++-- .../Converters/IntToSortDirection.cs | 2 +- src/Files.Uwp/Dialogs/CredentialDialog.xaml | 2 +- .../Dialogs/FilesystemOperationDialog.xaml | 2 +- .../Dialogs/FilesystemOperationDialog.xaml.cs | 22 ++++++++++--------- .../DefaultGridSplitterStyle.xaml | 2 +- .../UserControls/AddressToolbar.xaml | 11 +++++----- src/Files.Uwp/UserControls/ColoredIcon.xaml | 2 +- .../UserControls/ColoredIcon.xaml.cs | 2 +- .../UserControls/DataGridHeader.xaml | 2 +- .../FilePreviews/MarkdownPreview.xaml | 2 +- .../FilePreviews/TextPreview.xaml | 2 +- .../UserControls/FolderEmptyIndicator.xaml | 2 +- .../UserControls/InnerNavigationToolbar.xaml | 2 +- .../UserControls/OngoingTasksFlyout.xaml | 2 +- .../UserControls/Pane/PreviewPane.xaml | 2 +- .../UserControls/RestartControl.xaml | 2 +- .../Selection/RectangleSelection.cs | 2 +- .../RectangleSelection_ListViewBase.cs | 6 +++-- .../UserControls/SidebarControl.xaml | 2 +- .../UserControls/StatusBarControl.xaml | 2 +- .../UserControls/Widgets/BundlesWidget.xaml | 2 +- src/Files.Uwp/Views/ColumnShellPage.xaml | 4 ++-- src/Files.Uwp/Views/CustomFolderIcons.xaml | 2 +- .../Views/LayoutModes/ColumnViewBase.xaml | 10 ++++----- .../Views/LayoutModes/ColumnViewBase.xaml.cs | 5 +++-- .../Views/LayoutModes/ColumnViewBrowser.xaml | 4 ++-- .../LayoutModes/ColumnViewBrowser.xaml.cs | 4 ++-- .../LayoutModes/DetailsLayoutBrowser.xaml | 12 +++++----- .../LayoutModes/DetailsLayoutBrowser.xaml.cs | 4 ++-- .../Views/LayoutModes/GridViewBrowser.xaml | 8 +++---- .../Views/LayoutModes/GridViewBrowser.xaml.cs | 2 +- src/Files.Uwp/Views/MainPage.xaml | 4 ++-- src/Files.Uwp/Views/ModernShellPage.xaml | 2 +- .../Views/Pages/PropertiesGeneral.xaml | 2 +- .../Views/Pages/PropertiesLibrary.xaml | 2 +- .../Views/Pages/PropertiesSecurity.xaml | 2 +- .../Pages/PropertiesSecurityAdvanced.xaml | 4 ++-- src/Files.Uwp/Views/PaneHolderPage.xaml | 6 ++--- src/Files.Uwp/Views/SettingsPages/About.xaml | 2 +- .../Views/SettingsPages/Appearance.xaml | 2 +- .../Views/SettingsPages/Appearance.xaml.cs | 2 +- 42 files changed, 84 insertions(+), 78 deletions(-) diff --git a/src/Files.Uwp/Behaviors/StickyHeaderBehavior.cs b/src/Files.Uwp/Behaviors/StickyHeaderBehavior.cs index 342e564875eb..4a8bf4c12658 100644 --- a/src/Files.Uwp/Behaviors/StickyHeaderBehavior.cs +++ b/src/Files.Uwp/Behaviors/StickyHeaderBehavior.cs @@ -2,9 +2,9 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using Microsoft.Toolkit.Uwp.UI; +using CommunityToolkit.WinUI.UI; using CommunityToolkit.WinUI.UI.Animations.Expressions; -using Microsoft.Toolkit.Uwp.UI.Behaviors; +using CommunityToolkit.WinUI.UI.Behaviors; using System.Linq; using Windows.Foundation; using Windows.Foundation.Metadata; diff --git a/src/Files.Uwp/Converters/IntToSortDirection.cs b/src/Files.Uwp/Converters/IntToSortDirection.cs index ed36829fc3db..25b4ce40c05c 100644 --- a/src/Files.Uwp/Converters/IntToSortDirection.cs +++ b/src/Files.Uwp/Converters/IntToSortDirection.cs @@ -1,4 +1,4 @@ -using Microsoft.Toolkit.Uwp.UI; +using CommunityToolkit.WinUI.UI; using System; using Microsoft.UI.Xaml.Data; diff --git a/src/Files.Uwp/Dialogs/CredentialDialog.xaml b/src/Files.Uwp/Dialogs/CredentialDialog.xaml index 191f4f98c08a..487c61a74df8 100644 --- a/src/Files.Uwp/Dialogs/CredentialDialog.xaml +++ b/src/Files.Uwp/Dialogs/CredentialDialog.xaml @@ -5,7 +5,7 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:helpers="using:Files.Uwp.Helpers" - xmlns:converters="using:Microsoft.Toolkit.Uwp.UI.Converters" + xmlns:converters="using:CommunityToolkit.WinUI.UI.Converters" x:Name="AskCredentialDialog" Title="{helpers:ResourceString Name=AskCredentialDialog/Title}" Grid.RowSpan="4" diff --git a/src/Files.Uwp/Dialogs/FilesystemOperationDialog.xaml b/src/Files.Uwp/Dialogs/FilesystemOperationDialog.xaml index e40660fdb0eb..942e080a0fed 100644 --- a/src/Files.Uwp/Dialogs/FilesystemOperationDialog.xaml +++ b/src/Files.Uwp/Dialogs/FilesystemOperationDialog.xaml @@ -9,7 +9,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:muxc="using:Microsoft.UI.Xaml.Controls" xmlns:ts="using:Files.Uwp.TemplateSelectors" - xmlns:tvc="using:Microsoft.Toolkit.Uwp.UI.Converters" + xmlns:tvc="using:CommunityToolkit.WinUI.UI.Converters" xmlns:vc="using:Files.Uwp.ValueConverters" xmlns:vc2="using:Files.Uwp.ValueConverters.EnumConverters" xmlns:vc3="using:Files.Uwp.Converters" diff --git a/src/Files.Uwp/Dialogs/FilesystemOperationDialog.xaml.cs b/src/Files.Uwp/Dialogs/FilesystemOperationDialog.xaml.cs index da8d7a75d1a2..79bc2d76a494 100644 --- a/src/Files.Uwp/Dialogs/FilesystemOperationDialog.xaml.cs +++ b/src/Files.Uwp/Dialogs/FilesystemOperationDialog.xaml.cs @@ -1,7 +1,7 @@ using Files.Backend.ViewModels.Dialogs; using Files.Backend.ViewModels.Dialogs.FileSystemDialog; using Files.Shared.Enums; -using Microsoft.Toolkit.Uwp.UI; +using CommunityToolkit.WinUI.UI; using System; using System.Linq; using System.Threading.Tasks; @@ -40,15 +40,17 @@ public FilesystemOperationDialog() App.Window.SizeChanged += Current_SizeChanged; } - public new async Task ShowAsync() => (DialogResult)await this.SetContentDialogRoot(base).ShowAsync(); - private ContentDialog SetContentDialogRoot(ContentDialog contentDialog) - { - if (Windows.Foundation.Metadata.ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 8)) - { - contentDialog.XamlRoot = this.Content.XamlRoot; - } - return contentDialog; - } + public new async Task ShowAsync() => (DialogResult)await this.SetContentDialogRoot(this).ShowAsync(); + + // WINUI3 + private ContentDialog SetContentDialogRoot(ContentDialog contentDialog) + { + if (Windows.Foundation.Metadata.ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 8)) + { + contentDialog.XamlRoot = App.Window.Content.XamlRoot; + } + return contentDialog; + } private void Current_SizeChanged(object sender, WindowSizeChangedEventArgs e) { diff --git a/src/Files.Uwp/ResourceDictionaries/DefaultGridSplitterStyle.xaml b/src/Files.Uwp/ResourceDictionaries/DefaultGridSplitterStyle.xaml index c52464fa6e01..837dcef167a5 100644 --- a/src/Files.Uwp/ResourceDictionaries/DefaultGridSplitterStyle.xaml +++ b/src/Files.Uwp/ResourceDictionaries/DefaultGridSplitterStyle.xaml @@ -1,7 +1,7 @@  + xmlns:controls="using:CommunityToolkit.WinUI.UI.Controls"> + --> diff --git a/src/Files.Uwp/UserControls/SidebarControl.xaml.cs b/src/Files.Uwp/UserControls/SidebarControl.xaml.cs index e7d2e9909897..7d57fda8f2d7 100644 --- a/src/Files.Uwp/UserControls/SidebarControl.xaml.cs +++ b/src/Files.Uwp/UserControls/SidebarControl.xaml.cs @@ -1014,7 +1014,7 @@ private async void NavigationViewFileTag_Drop(object sender, DragEventArgs e) private void SidebarNavView_Loaded(object sender, RoutedEventArgs e) { - (this.FindDescendant("TabContentBorder") as Border).Child = TabContent; + //(this.FindDescendant("TabContentBorder") as Border).Child = TabContent; //WINUI3 } private void SidebarControl_DisplayModeChanged(Microsoft.UI.Xaml.Controls.NavigationView sender, Microsoft.UI.Xaml.Controls.NavigationViewDisplayModeChangedEventArgs args) From 94b41ac7db68803e223f94ab3454512dabf5987b Mon Sep 17 00:00:00 2001 From: Marco Gavelli Date: Fri, 19 Aug 2022 11:24:30 +0200 Subject: [PATCH 29/99] Revert "Comment out split view style" This reverts commit 829dc74ea0f6e6ab3054643855be8237fa0d0b3f. --- src/Files.Uwp/UserControls/SidebarControl.xaml | 15 +++++++-------- src/Files.Uwp/UserControls/SidebarControl.xaml.cs | 2 +- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/Files.Uwp/UserControls/SidebarControl.xaml b/src/Files.Uwp/UserControls/SidebarControl.xaml index f59b8c8aa569..203eb134358d 100644 --- a/src/Files.Uwp/UserControls/SidebarControl.xaml +++ b/src/Files.Uwp/UserControls/SidebarControl.xaml @@ -149,8 +149,7 @@ - - - // Pane Content Area // + - // This allows the user to resize the pane // + - // This is a special spot just for tabs so that the title bar DragArea can function properly // + - // Content Area // + - --> + diff --git a/src/Files.Uwp/UserControls/SidebarControl.xaml.cs b/src/Files.Uwp/UserControls/SidebarControl.xaml.cs index 7d57fda8f2d7..e7d2e9909897 100644 --- a/src/Files.Uwp/UserControls/SidebarControl.xaml.cs +++ b/src/Files.Uwp/UserControls/SidebarControl.xaml.cs @@ -1014,7 +1014,7 @@ private async void NavigationViewFileTag_Drop(object sender, DragEventArgs e) private void SidebarNavView_Loaded(object sender, RoutedEventArgs e) { - //(this.FindDescendant("TabContentBorder") as Border).Child = TabContent; //WINUI3 + (this.FindDescendant("TabContentBorder") as Border).Child = TabContent; } private void SidebarControl_DisplayModeChanged(Microsoft.UI.Xaml.Controls.NavigationView sender, Microsoft.UI.Xaml.Controls.NavigationViewDisplayModeChangedEventArgs args) From 16a43ef3719686325f1a178c3360d9cb506aa986 Mon Sep 17 00:00:00 2001 From: Marco Gavelli Date: Fri, 19 Aug 2022 12:48:23 +0200 Subject: [PATCH 30/99] Comment out tab content loading --- src/Files.Uwp/UserControls/SidebarControl.xaml.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Files.Uwp/UserControls/SidebarControl.xaml.cs b/src/Files.Uwp/UserControls/SidebarControl.xaml.cs index e7d2e9909897..904ab4b6e939 100644 --- a/src/Files.Uwp/UserControls/SidebarControl.xaml.cs +++ b/src/Files.Uwp/UserControls/SidebarControl.xaml.cs @@ -1014,7 +1014,7 @@ private async void NavigationViewFileTag_Drop(object sender, DragEventArgs e) private void SidebarNavView_Loaded(object sender, RoutedEventArgs e) { - (this.FindDescendant("TabContentBorder") as Border).Child = TabContent; + //(this.FindDescendant("TabContentBorder") as Border).Child = TabContent; } private void SidebarControl_DisplayModeChanged(Microsoft.UI.Xaml.Controls.NavigationView sender, Microsoft.UI.Xaml.Controls.NavigationViewDisplayModeChangedEventArgs args) From ca620c910b49e38555cff29dd4650b966146a0de Mon Sep 17 00:00:00 2001 From: d2dyno006 <53011783+d2dyno006@users.noreply.github.com> Date: Fri, 19 Aug 2022 13:24:49 +0200 Subject: [PATCH 31/99] Remove XamlRoot where possible --- src/Files.Backend/Services/IDialogService.cs | 15 ++++++++++++ src/Files.Uwp/Dialogs/AddItemDialog.xaml.cs | 12 +--------- .../Dialogs/CredentialDialog.xaml.cs | 12 +--------- .../Dialogs/ElevateConfirmDialog.xaml.cs | 12 +--------- src/Files.Uwp/Dialogs/SettingsDialog.xaml.cs | 12 +--------- .../ServicesImplementation/DialogService.cs | 23 ++++++++++--------- 6 files changed, 31 insertions(+), 55 deletions(-) diff --git a/src/Files.Backend/Services/IDialogService.cs b/src/Files.Backend/Services/IDialogService.cs index e9edbe74c966..8284743e87a1 100644 --- a/src/Files.Backend/Services/IDialogService.cs +++ b/src/Files.Backend/Services/IDialogService.cs @@ -5,10 +5,25 @@ namespace Files.Backend.Services { + /// + /// A service to manage dialogs. + /// public interface IDialogService { + /// + /// Gets appropriate dialog with associated . + /// + /// The type of view model. + /// The view model of the dialog. + /// A new instance of with associated . IDialog GetDialog(TViewModel viewModel) where TViewModel : class, INotifyPropertyChanged; + /// + /// Creates and shows appropriate dialog derived from associated . + /// + /// The type of view model. + /// The view model of the dialog. + /// A that represents the asynchronous operation. Returns based on the selected option. Task ShowDialogAsync(TViewModel viewModel) where TViewModel : class, INotifyPropertyChanged; } } diff --git a/src/Files.Uwp/Dialogs/AddItemDialog.xaml.cs b/src/Files.Uwp/Dialogs/AddItemDialog.xaml.cs index 3a8f830d7391..cf7183e7bf05 100644 --- a/src/Files.Uwp/Dialogs/AddItemDialog.xaml.cs +++ b/src/Files.Uwp/Dialogs/AddItemDialog.xaml.cs @@ -25,17 +25,7 @@ public AddItemDialog() InitializeComponent(); } - public new async Task ShowAsync() => (DialogResult)await this.SetContentDialogRoot(this).ShowAsync(); - - // WINUI3 - private ContentDialog SetContentDialogRoot(ContentDialog contentDialog) - { - if (Windows.Foundation.Metadata.ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 8)) - { - contentDialog.XamlRoot = App.Window.Content.XamlRoot; - } - return contentDialog; - } + public new async Task ShowAsync() => (DialogResult)await base.ShowAsync(); private void ListView_ItemClick(object sender, ItemClickEventArgs e) { diff --git a/src/Files.Uwp/Dialogs/CredentialDialog.xaml.cs b/src/Files.Uwp/Dialogs/CredentialDialog.xaml.cs index a10f869cd4b7..1e0523308595 100644 --- a/src/Files.Uwp/Dialogs/CredentialDialog.xaml.cs +++ b/src/Files.Uwp/Dialogs/CredentialDialog.xaml.cs @@ -23,17 +23,7 @@ public CredentialDialog() this.InitializeComponent(); } - public new async Task ShowAsync() => (DialogResult)await this.SetContentDialogRoot(this).ShowAsync(); - - // WINUI3 - private ContentDialog SetContentDialogRoot(ContentDialog contentDialog) - { - if (Windows.Foundation.Metadata.ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 8)) - { - contentDialog.XamlRoot = App.Window.Content.XamlRoot; - } - return contentDialog; - } + public new async Task ShowAsync() => (DialogResult)await base.ShowAsync(); private void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args) { diff --git a/src/Files.Uwp/Dialogs/ElevateConfirmDialog.xaml.cs b/src/Files.Uwp/Dialogs/ElevateConfirmDialog.xaml.cs index 812d024b1115..39a536d3584b 100644 --- a/src/Files.Uwp/Dialogs/ElevateConfirmDialog.xaml.cs +++ b/src/Files.Uwp/Dialogs/ElevateConfirmDialog.xaml.cs @@ -21,16 +21,6 @@ public ElevateConfirmDialog() this.InitializeComponent(); } - public new async Task ShowAsync() => (DialogResult)await this.SetContentDialogRoot(this).ShowAsync(); - - // WINUI3 - private ContentDialog SetContentDialogRoot(ContentDialog contentDialog) - { - if (Windows.Foundation.Metadata.ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 8)) - { - contentDialog.XamlRoot = App.Window.Content.XamlRoot; - } - return contentDialog; - } + public new async Task ShowAsync() => (DialogResult)await base.ShowAsync(); } } \ No newline at end of file diff --git a/src/Files.Uwp/Dialogs/SettingsDialog.xaml.cs b/src/Files.Uwp/Dialogs/SettingsDialog.xaml.cs index b159feed7283..0c30a2000a62 100644 --- a/src/Files.Uwp/Dialogs/SettingsDialog.xaml.cs +++ b/src/Files.Uwp/Dialogs/SettingsDialog.xaml.cs @@ -29,17 +29,7 @@ public SettingsDialog() } - public new async Task ShowAsync() => (DialogResult)await this.SetContentDialogRoot(this).ShowAsync(); - - // WINUI3 - private ContentDialog SetContentDialogRoot(ContentDialog contentDialog) - { - if (Windows.Foundation.Metadata.ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 8)) - { - contentDialog.XamlRoot = App.Window.Content.XamlRoot; - } - return contentDialog; - } + public new async Task ShowAsync() => (DialogResult)await base.ShowAsync(); private void Current_SizeChanged(object sender, WindowSizeChangedEventArgs e) { diff --git a/src/Files.Uwp/ServicesImplementation/DialogService.cs b/src/Files.Uwp/ServicesImplementation/DialogService.cs index 5090ea42079c..780e69bc14df 100644 --- a/src/Files.Uwp/ServicesImplementation/DialogService.cs +++ b/src/Files.Uwp/ServicesImplementation/DialogService.cs @@ -10,16 +10,18 @@ using Files.Uwp.Dialogs; using Files.Backend.ViewModels.Dialogs.AddItemDialog; using Files.Backend.ViewModels.Dialogs.FileSystemDialog; +using Windows.Foundation.Metadata; namespace Files.Uwp.ServicesImplementation { + /// internal sealed class DialogService : IDialogService { - private readonly Dictionary> _dialogs; + private readonly IReadOnlyDictionary> _dialogs; public DialogService() { - this._dialogs = new() + _dialogs = new Dictionary>() { { typeof(AddItemDialogViewModel), () => new AddItemDialog() }, { typeof(CredentialDialogViewModel), () => new CredentialDialog() }, @@ -30,28 +32,26 @@ public DialogService() }; } + /// public IDialog GetDialog(TViewModel viewModel) where TViewModel : class, INotifyPropertyChanged { - _ = viewModel ?? throw new ArgumentNullException(nameof(viewModel)); - if (!_dialogs.TryGetValue(typeof(TViewModel), out var initializer)) - { - throw new ArgumentException($"{typeof(TViewModel)} does not have a dialog associated with it."); - } + throw new ArgumentException($"{typeof(TViewModel)} does not have an appropriate dialog associated with it."); var contentDialog = initializer(); - if (contentDialog is not IDialog dialog) - { throw new NotSupportedException($"The dialog does not implement {typeof(IDialog)}."); - } dialog.ViewModel = viewModel; + if (ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 8)) + contentDialog.XamlRoot = App.Window.Content.XamlRoot; + return dialog; } + /// public async Task ShowDialogAsync(TViewModel viewModel) where TViewModel : class, INotifyPropertyChanged { @@ -59,8 +59,9 @@ public async Task ShowDialogAsync(TViewModel viewModel { return await GetDialog(viewModel).ShowAsync(); } - catch (Exception) + catch (Exception ex) { + _ = ex; } return DialogResult.None; From 772873a40d0c303ab07e3e42db44841a7390d1ab Mon Sep 17 00:00:00 2001 From: d2dyno006 <53011783+d2dyno006@users.noreply.github.com> Date: Fri, 19 Aug 2022 13:40:32 +0200 Subject: [PATCH 32/99] Better titlebar handling and mica --- src/Files.Uwp/App.xaml | 4 ++++ src/Files.Uwp/Files.Uwp.csproj | 5 ++-- src/Files.Uwp/MainWindow.xaml | 35 ++++++++++++++++------------ src/Files.Uwp/MainWindow.xaml.cs | 4 ++-- src/Files.Uwp/Views/MainPage.xaml.cs | 21 ++++++++++++++++- 5 files changed, 49 insertions(+), 20 deletions(-) diff --git a/src/Files.Uwp/App.xaml b/src/Files.Uwp/App.xaml index ede4642170cf..cf8c9fc22f12 100644 --- a/src/Files.Uwp/App.xaml +++ b/src/Files.Uwp/App.xaml @@ -15,6 +15,10 @@ 32 + + + + diff --git a/src/Files.Uwp/Files.Uwp.csproj b/src/Files.Uwp/Files.Uwp.csproj index 2f8a8d1962dc..f6fb38d8d1c6 100644 --- a/src/Files.Uwp/Files.Uwp.csproj +++ b/src/Files.Uwp/Files.Uwp.csproj @@ -182,14 +182,15 @@ 2.1.0 - - + + all + diff --git a/src/Files.Uwp/MainWindow.xaml b/src/Files.Uwp/MainWindow.xaml index 44389687bb58..6317ec84ed10 100644 --- a/src/Files.Uwp/MainWindow.xaml +++ b/src/Files.Uwp/MainWindow.xaml @@ -1,21 +1,26 @@ - + + + + + - + - + - \ No newline at end of file + \ No newline at end of file diff --git a/src/Files.Uwp/MainWindow.xaml.cs b/src/Files.Uwp/MainWindow.xaml.cs index 360dd6f4d0fa..8a36bb77daa9 100644 --- a/src/Files.Uwp/MainWindow.xaml.cs +++ b/src/Files.Uwp/MainWindow.xaml.cs @@ -1,6 +1,5 @@ using Files.Uwp.ViewModels; using Files.Uwp.Views; -using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Media.Animation; using Microsoft.UI.Xaml.Navigation; @@ -8,6 +7,7 @@ using System; using System.Threading.Tasks; using Windows.ApplicationModel.Activation; +using WinUIEx; // To learn more about WinUI, the WinUI project structure, // and more about our project templates, see: http://aka.ms/winui-project-info. @@ -17,7 +17,7 @@ namespace Files.Uwp /// /// An empty window that can be used on its own or navigated to within a Frame. /// - public sealed partial class MainWindow : Window + public sealed partial class MainWindow : WindowEx { public MainWindow() { diff --git a/src/Files.Uwp/Views/MainPage.xaml.cs b/src/Files.Uwp/Views/MainPage.xaml.cs index 55e555069127..67fbf5b19b2e 100644 --- a/src/Files.Uwp/Views/MainPage.xaml.cs +++ b/src/Files.Uwp/Views/MainPage.xaml.cs @@ -30,6 +30,7 @@ using Windows.ApplicationModel.Core; using Microsoft.UI.Windowing; using Windows.Graphics; +using Microsoft.UI; namespace Files.Uwp.Views { @@ -164,7 +165,25 @@ private void VerticalTabStripInvokeButton_Loaded(object sender, RoutedEventArgs private void DragArea_Loaded(object sender, RoutedEventArgs e) { - App.Window.SetTitleBar(sender as Grid); + var mainWindow = App.Window; + + // Set title + mainWindow.AppWindow.Title = "Files"; + + if (AppWindowTitleBar.IsCustomizationSupported()) + { + // Extend title bar + mainWindow.AppWindow.TitleBar.ExtendsContentIntoTitleBar = true; + + // Set window buttons background to transparent + mainWindow.AppWindow.TitleBar.ButtonBackgroundColor = Colors.Transparent; + mainWindow.AppWindow.TitleBar.ButtonInactiveBackgroundColor = Colors.Transparent; + } + else + { + mainWindow.ExtendsContentIntoTitleBar = true; + mainWindow.SetTitleBar(sender as Grid); + } } private void TitleBar_LayoutMetricsChanged(CoreApplicationViewTitleBar sender, object args) From bbdb762bd4444b7a8a463900ad21c59c4a2bcdfe Mon Sep 17 00:00:00 2001 From: d2dyno006 <53011783+d2dyno006@users.noreply.github.com> Date: Fri, 19 Aug 2022 13:55:07 +0200 Subject: [PATCH 33/99] Moved titlebar initialization from App.xaml --- src/Files.Uwp/App.xaml.cs | 10 ---------- src/Files.Uwp/MainWindow.xaml.cs | 30 +++++++++++++++++++++++++++- src/Files.Uwp/Views/MainPage.xaml.cs | 21 ++----------------- 3 files changed, 31 insertions(+), 30 deletions(-) diff --git a/src/Files.Uwp/App.xaml.cs b/src/Files.Uwp/App.xaml.cs index 0ccc0249a6d3..e988c33fff6f 100644 --- a/src/Files.Uwp/App.xaml.cs +++ b/src/Files.Uwp/App.xaml.cs @@ -264,16 +264,6 @@ private void EnsureWindowIsInitialized() Window = new MainWindow(); Window.Activated += Window_Activated; Window.Activate(); - var appWindow = GetAppWindow(Window); - if (AppWindowTitleBar.IsCustomizationSupported()) - { - appWindow.TitleBar.ExtendsContentIntoTitleBar = true; - appWindow.TitleBar.IconShowOptions = IconShowOptions.HideIconAndSystemMenu; - } - else - { - Window.ExtendsContentIntoTitleBar = true; - } WindowHandle = WinRT.Interop.WindowNative.GetWindowHandle(Window); } diff --git a/src/Files.Uwp/MainWindow.xaml.cs b/src/Files.Uwp/MainWindow.xaml.cs index 8a36bb77daa9..6008deb81a6d 100644 --- a/src/Files.Uwp/MainWindow.xaml.cs +++ b/src/Files.Uwp/MainWindow.xaml.cs @@ -7,6 +7,8 @@ using System; using System.Threading.Tasks; using Windows.ApplicationModel.Activation; +using Microsoft.UI; +using Microsoft.UI.Windowing; using WinUIEx; // To learn more about WinUI, the WinUI project structure, @@ -19,9 +21,35 @@ namespace Files.Uwp /// public sealed partial class MainWindow : WindowEx { + #nullable disable + public static MainWindow Instance { get; private set; } + #nullable restore + public MainWindow() { - this.InitializeComponent(); + Instance = this; + InitializeComponent(); + + EnsureEarlyWindow(); + } + + private void EnsureEarlyWindow() + { + // Set title + AppWindow.Title = "Files"; + + if (AppWindowTitleBar.IsCustomizationSupported()) + { + // Extend title bar + AppWindow.TitleBar.ExtendsContentIntoTitleBar = true; + + // Set window buttons background to transparent + AppWindow.TitleBar.ButtonBackgroundColor = Colors.Transparent; + AppWindow.TitleBar.ButtonInactiveBackgroundColor = Colors.Transparent; + } + + // Set min size + // TODO: Set min size // WINUI3 } public async Task InitializeApplication(AppActivationArguments activatedEventArgs) diff --git a/src/Files.Uwp/Views/MainPage.xaml.cs b/src/Files.Uwp/Views/MainPage.xaml.cs index 67fbf5b19b2e..18b0a49233c0 100644 --- a/src/Files.Uwp/Views/MainPage.xaml.cs +++ b/src/Files.Uwp/Views/MainPage.xaml.cs @@ -165,25 +165,8 @@ private void VerticalTabStripInvokeButton_Loaded(object sender, RoutedEventArgs private void DragArea_Loaded(object sender, RoutedEventArgs e) { - var mainWindow = App.Window; - - // Set title - mainWindow.AppWindow.Title = "Files"; - - if (AppWindowTitleBar.IsCustomizationSupported()) - { - // Extend title bar - mainWindow.AppWindow.TitleBar.ExtendsContentIntoTitleBar = true; - - // Set window buttons background to transparent - mainWindow.AppWindow.TitleBar.ButtonBackgroundColor = Colors.Transparent; - mainWindow.AppWindow.TitleBar.ButtonInactiveBackgroundColor = Colors.Transparent; - } - else - { - mainWindow.ExtendsContentIntoTitleBar = true; - mainWindow.SetTitleBar(sender as Grid); - } + MainWindow.Instance.ExtendsContentIntoTitleBar = true; + MainWindow.Instance.SetTitleBar(sender as Grid); } private void TitleBar_LayoutMetricsChanged(CoreApplicationViewTitleBar sender, object args) From 9391355a1e7eafb0530f4df30587d56348dc7ed1 Mon Sep 17 00:00:00 2001 From: Marco Gavelli Date: Fri, 19 Aug 2022 14:23:49 +0200 Subject: [PATCH 34/99] Restore tabs --- src/Files.Uwp/UserControls/SidebarControl.xaml.cs | 2 +- src/Files.Uwp/Views/MainPage.xaml.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Files.Uwp/UserControls/SidebarControl.xaml.cs b/src/Files.Uwp/UserControls/SidebarControl.xaml.cs index 904ab4b6e939..e7d2e9909897 100644 --- a/src/Files.Uwp/UserControls/SidebarControl.xaml.cs +++ b/src/Files.Uwp/UserControls/SidebarControl.xaml.cs @@ -1014,7 +1014,7 @@ private async void NavigationViewFileTag_Drop(object sender, DragEventArgs e) private void SidebarNavView_Loaded(object sender, RoutedEventArgs e) { - //(this.FindDescendant("TabContentBorder") as Border).Child = TabContent; + (this.FindDescendant("TabContentBorder") as Border).Child = TabContent; } private void SidebarControl_DisplayModeChanged(Microsoft.UI.Xaml.Controls.NavigationView sender, Microsoft.UI.Xaml.Controls.NavigationViewDisplayModeChangedEventArgs args) diff --git a/src/Files.Uwp/Views/MainPage.xaml.cs b/src/Files.Uwp/Views/MainPage.xaml.cs index 18b0a49233c0..079b68c27f78 100644 --- a/src/Files.Uwp/Views/MainPage.xaml.cs +++ b/src/Files.Uwp/Views/MainPage.xaml.cs @@ -383,7 +383,7 @@ private void Page_Loaded(object sender, RoutedEventArgs e) FindName(nameof(StatusBarControl)); FindName(nameof(InnerNavigationToolbar)); FindName(nameof(horizontalMultitaskingControl)); - FindName(nameof(NavToolbar)); + //FindName(nameof(NavToolbar)); // the adaptive triggers do not evaluate on app startup, manually checking and calling GoToState here fixes https://github.com/files-community/Files/issues/5801 if (App.Window.Bounds.Width < CollapseSearchBoxAdaptiveTrigger.MinWindowWidth) From fa8629c023dd590a5a08c3df2ef32da410cd0388 Mon Sep 17 00:00:00 2001 From: Marco Gavelli Date: Fri, 19 Aug 2022 14:42:49 +0200 Subject: [PATCH 35/99] Comment out state triggers in AdrressBar --- .../UserControls/AddressToolbar.xaml | 30 +++++++++++-------- src/Files.Uwp/Views/MainPage.xaml.cs | 2 +- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/src/Files.Uwp/UserControls/AddressToolbar.xaml b/src/Files.Uwp/UserControls/AddressToolbar.xaml index 1008b57cb51c..a6fe4e6ce440 100644 --- a/src/Files.Uwp/UserControls/AddressToolbar.xaml +++ b/src/Files.Uwp/UserControls/AddressToolbar.xaml @@ -620,25 +620,28 @@ - + + - + + - + + - + + - + + - + + diff --git a/src/Files.Uwp/Views/MainPage.xaml.cs b/src/Files.Uwp/Views/MainPage.xaml.cs index 079b68c27f78..18b0a49233c0 100644 --- a/src/Files.Uwp/Views/MainPage.xaml.cs +++ b/src/Files.Uwp/Views/MainPage.xaml.cs @@ -383,7 +383,7 @@ private void Page_Loaded(object sender, RoutedEventArgs e) FindName(nameof(StatusBarControl)); FindName(nameof(InnerNavigationToolbar)); FindName(nameof(horizontalMultitaskingControl)); - //FindName(nameof(NavToolbar)); + FindName(nameof(NavToolbar)); // the adaptive triggers do not evaluate on app startup, manually checking and calling GoToState here fixes https://github.com/files-community/Files/issues/5801 if (App.Window.Bounds.Width < CollapseSearchBoxAdaptiveTrigger.MinWindowWidth) From 7f89ca765d6cda3437d1f711e1eed4e87519d3e0 Mon Sep 17 00:00:00 2001 From: Marco Gavelli Date: Fri, 19 Aug 2022 14:48:02 +0200 Subject: [PATCH 36/99] Avoid titlebar flashing --- src/Files.Uwp/MainWindow.xaml.cs | 9 ++++----- src/Files.Uwp/Views/MainPage.xaml.cs | 3 +-- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/Files.Uwp/MainWindow.xaml.cs b/src/Files.Uwp/MainWindow.xaml.cs index 6008deb81a6d..0e9be5225d2b 100644 --- a/src/Files.Uwp/MainWindow.xaml.cs +++ b/src/Files.Uwp/MainWindow.xaml.cs @@ -21,13 +21,8 @@ namespace Files.Uwp /// public sealed partial class MainWindow : WindowEx { - #nullable disable - public static MainWindow Instance { get; private set; } - #nullable restore - public MainWindow() { - Instance = this; InitializeComponent(); EnsureEarlyWindow(); @@ -47,6 +42,10 @@ private void EnsureEarlyWindow() AppWindow.TitleBar.ButtonBackgroundColor = Colors.Transparent; AppWindow.TitleBar.ButtonInactiveBackgroundColor = Colors.Transparent; } + else + { + this.ExtendsContentIntoTitleBar = true; + } // Set min size // TODO: Set min size // WINUI3 diff --git a/src/Files.Uwp/Views/MainPage.xaml.cs b/src/Files.Uwp/Views/MainPage.xaml.cs index 18b0a49233c0..c05f128b69b0 100644 --- a/src/Files.Uwp/Views/MainPage.xaml.cs +++ b/src/Files.Uwp/Views/MainPage.xaml.cs @@ -165,8 +165,7 @@ private void VerticalTabStripInvokeButton_Loaded(object sender, RoutedEventArgs private void DragArea_Loaded(object sender, RoutedEventArgs e) { - MainWindow.Instance.ExtendsContentIntoTitleBar = true; - MainWindow.Instance.SetTitleBar(sender as Grid); + App.Window.SetTitleBar(sender as Grid); } private void TitleBar_LayoutMetricsChanged(CoreApplicationViewTitleBar sender, object args) From 6292f495760874007ea8b31fe92c2484e19c9009 Mon Sep 17 00:00:00 2001 From: d2dyno006 <53011783+d2dyno006@users.noreply.github.com> Date: Fri, 19 Aug 2022 14:51:40 +0200 Subject: [PATCH 37/99] Fixed settings dialog --- src/Files.Uwp/Dialogs/SettingsDialog.xaml | 40 +++++++++++------------ src/Files.Uwp/MainWindow.xaml.cs | 4 +++ src/Files.Uwp/Views/MainPage.xaml.cs | 1 - 3 files changed, 23 insertions(+), 22 deletions(-) diff --git a/src/Files.Uwp/Dialogs/SettingsDialog.xaml b/src/Files.Uwp/Dialogs/SettingsDialog.xaml index d18041299d03..7558381e91d2 100644 --- a/src/Files.Uwp/Dialogs/SettingsDialog.xaml +++ b/src/Files.Uwp/Dialogs/SettingsDialog.xaml @@ -1,13 +1,12 @@  @@ -23,12 +22,12 @@ - - - + - - + - - + - - + - - + - + - - - + + + - + - diff --git a/src/Files.Uwp/UserControls/Widgets/DrivesWidget.xaml b/src/Files.Uwp/UserControls/Widgets/DrivesWidget.xaml index 9f4306b672e9..38199a36cc81 100644 --- a/src/Files.Uwp/UserControls/Widgets/DrivesWidget.xaml +++ b/src/Files.Uwp/UserControls/Widgets/DrivesWidget.xaml @@ -6,7 +6,6 @@ xmlns:helpers="using:Files.Uwp.Helpers" xmlns:local="using:Files.Uwp.UserControls.Widgets" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:muxc="using:Microsoft.UI.Xaml.Controls" Background="{ThemeResource SolidBackgroundFillColorBaseBrush}" mc:Ignorable="d"> @@ -49,21 +48,21 @@ - - - + - - + + - - + + diff --git a/src/Files.Uwp/UserControls/Widgets/FolderWidget.xaml b/src/Files.Uwp/UserControls/Widgets/FolderWidget.xaml index 6b2058b9c591..186711fd6a52 100644 --- a/src/Files.Uwp/UserControls/Widgets/FolderWidget.xaml +++ b/src/Files.Uwp/UserControls/Widgets/FolderWidget.xaml @@ -6,17 +6,16 @@ xmlns:helpers="using:Files.Uwp.Helpers" xmlns:local="using:Files.Uwp.UserControls.Widgets" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:muxc="using:Microsoft.UI.Xaml.Controls" Background="{ThemeResource SolidBackgroundFillColorBaseBrush}" mc:Ignorable="d"> - - - + - - + + - - + + \ No newline at end of file diff --git a/src/Files.Uwp/Views/LayoutModes/ColumnViewBase.xaml b/src/Files.Uwp/Views/LayoutModes/ColumnViewBase.xaml index 8a58c85c90fd..50beb34b88d5 100644 --- a/src/Files.Uwp/Views/LayoutModes/ColumnViewBase.xaml +++ b/src/Files.Uwp/Views/LayoutModes/ColumnViewBase.xaml @@ -15,7 +15,6 @@ xmlns:local2="using:Files.Uwp.Filesystem" xmlns:local3="using:Files.Uwp.Filesystem.Cloud" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:muxc="using:Microsoft.UI.Xaml.Controls" xmlns:tui="using:CommunityToolkit.WinUI.UI" xmlns:uc="using:Files.Uwp.UserControls" xmlns:vc="using:Files.Uwp.ValueConverters" @@ -140,7 +139,7 @@ Canvas.ZIndex="0" EmptyTextType="{x:Bind ParentShellPageInstance.FilesystemViewModel.EmptyTextType, Mode=OneWay}" /> - + Glyph="" /> diff --git a/src/Files.Uwp/Views/LayoutModes/DetailsLayoutBrowser.xaml b/src/Files.Uwp/Views/LayoutModes/DetailsLayoutBrowser.xaml index 7b8f08ca185e..bf00bf58debb 100644 --- a/src/Files.Uwp/Views/LayoutModes/DetailsLayoutBrowser.xaml +++ b/src/Files.Uwp/Views/LayoutModes/DetailsLayoutBrowser.xaml @@ -15,7 +15,6 @@ xmlns:local="using:Files.Uwp" xmlns:local2="using:Files.Uwp.Filesystem" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:muxc="using:Microsoft.UI.Xaml.Controls" xmlns:triggers="using:CommunityToolkit.WinUI.UI.Triggers" xmlns:tui="using:CommunityToolkit.WinUI.UI" xmlns:uc="using:Files.Uwp.UserControls" @@ -200,7 +199,7 @@ Canvas.ZIndex="0" EmptyTextType="{x:Bind ParentShellPageInstance.FilesystemViewModel.EmptyTextType, Mode=OneWay}" /> - @@ -493,7 +492,7 @@ Canvas.ZIndex="0" EmptyTextType="{x:Bind ParentShellPageInstance.FilesystemViewModel.EmptyTextType, Mode=OneWay}" /> - - + - - - + + + @@ -374,13 +373,19 @@ - + - + diff --git a/src/Files.Uwp/Views/Pages/Properties.xaml b/src/Files.Uwp/Views/Pages/Properties.xaml index b1825aa6c130..c3eab44d6c2f 100644 --- a/src/Files.Uwp/Views/Pages/Properties.xaml +++ b/src/Files.Uwp/Views/Pages/Properties.xaml @@ -1,11 +1,10 @@  - - - + @@ -41,21 +38,21 @@ - - - - + + + - - + - + - - - + + - + - - - + + - + - - - + + - + - - - + + - + - - - + + - + - - - + + - + - - - - + + + + diff --git a/src/Files.Uwp/Views/Pages/PropertiesDetails.xaml b/src/Files.Uwp/Views/Pages/PropertiesDetails.xaml index ad4e7132fa18..61af2bb37dc5 100644 --- a/src/Files.Uwp/Views/Pages/PropertiesDetails.xaml +++ b/src/Files.Uwp/Views/Pages/PropertiesDetails.xaml @@ -1,13 +1,12 @@  - - + @@ -95,9 +94,7 @@ -