From cfd9a664b3783d36b139da21910bf99249ad8400 Mon Sep 17 00:00:00 2001 From: Yair <39923744+yaira2@users.noreply.github.com> Date: Thu, 24 Jul 2025 17:14:57 -0400 Subject: [PATCH 1/3] CheckPathInputAsync --- .../NavigationToolbarViewModel.cs | 111 ------------------ 1 file changed, 111 deletions(-) diff --git a/src/Files.App/ViewModels/UserControls/NavigationToolbarViewModel.cs b/src/Files.App/ViewModels/UserControls/NavigationToolbarViewModel.cs index e3b7b968c59f..2f8671b15e47 100644 --- a/src/Files.App/ViewModels/UserControls/NavigationToolbarViewModel.cs +++ b/src/Files.App/ViewModels/UserControls/NavigationToolbarViewModel.cs @@ -697,117 +697,6 @@ private static string NormalizePathInput(string currentInput, bool isFtp) return currentInput; } - [Obsolete("Superseded by Omnibar.")] - public async Task CheckPathInputAsync(string currentInput, string currentSelectedPath, IShellPage shellPage) - { - if (currentInput.StartsWith('>')) - { - var code = currentInput.Substring(1).Trim(); - var command = Commands[code]; - - if (command == Commands.None) - await DialogDisplayHelper.ShowDialogAsync(Strings.InvalidCommand.GetLocalizedResource(), - string.Format(Strings.InvalidCommandContent.GetLocalizedResource(), code)); - else if (!command.IsExecutable) - await DialogDisplayHelper.ShowDialogAsync(Strings.CommandNotExecutable.GetLocalizedResource(), - string.Format(Strings.CommandNotExecutableContent.GetLocalizedResource(), command.Code)); - else - await command.ExecuteAsync(); - - return; - } - - var isFtp = FtpHelpers.IsFtpPath(currentInput); - - var normalizedInput = NormalizePathInput(currentInput, isFtp); - - if (currentSelectedPath == normalizedInput || string.IsNullOrWhiteSpace(normalizedInput)) - return; - - if (normalizedInput != shellPage.ShellViewModel.WorkingDirectory || shellPage.CurrentPageType == typeof(HomePage)) - { - if (normalizedInput.Equals("Home", StringComparison.OrdinalIgnoreCase) || normalizedInput.Equals(Strings.Home.GetLocalizedResource(), StringComparison.OrdinalIgnoreCase)) - { - SavePathToHistory("Home"); - shellPage.NavigateHome(); - } - else if (normalizedInput.Equals("ReleaseNotes", StringComparison.OrdinalIgnoreCase) || normalizedInput.Equals(Strings.ReleaseNotes.GetLocalizedResource(), StringComparison.OrdinalIgnoreCase)) - { - SavePathToHistory("ReleaseNotes"); - shellPage.NavigateToReleaseNotes(); - } - // TODO add settings page - //else if (normalizedInput.Equals("Settings", StringComparison.OrdinalIgnoreCase) || normalizedInput.Equals(Strings.Settings.GetLocalizedResource(), StringComparison.OrdinalIgnoreCase)) - //{ - // SavePathToHistory("Settings"); - // shellPage.NavigateToReleaseNotes(); - //} - else - { - normalizedInput = StorageFileExtensions.GetResolvedPath(normalizedInput, isFtp); - if (currentSelectedPath == normalizedInput) - return; - - var item = await FilesystemTasks.Wrap(() => DriveHelpers.GetRootFromPathAsync(normalizedInput)); - - var resFolder = await FilesystemTasks.Wrap(() => StorageFileExtensions.DangerousGetFolderWithPathFromPathAsync(normalizedInput, item)); - if (resFolder || FolderHelpers.CheckFolderAccessWithWin32(normalizedInput)) - { - var matchingDrive = drivesViewModel.Drives.Cast().FirstOrDefault(x => PathNormalization.NormalizePath(normalizedInput).StartsWith(PathNormalization.NormalizePath(x.Path), StringComparison.Ordinal)); - if (matchingDrive is not null && matchingDrive.Type == Data.Items.DriveType.CDRom && matchingDrive.MaxSpace == ByteSizeLib.ByteSize.FromBytes(0)) - { - bool ejectButton = await DialogDisplayHelper.ShowDialogAsync(Strings.InsertDiscDialog_Title.GetLocalizedResource(), string.Format(Strings.InsertDiscDialog_Text.GetLocalizedResource(), matchingDrive.Path), Strings.InsertDiscDialog_OpenDriveButton.GetLocalizedResource(), Strings.Close.GetLocalizedResource()); - if (ejectButton) - DriveHelpers.EjectDeviceAsync(matchingDrive.Path); - return; - } - var pathToNavigate = resFolder.Result?.Path ?? normalizedInput; - SavePathToHistory(pathToNavigate); - shellPage.NavigateToPath(pathToNavigate); - } - else if (isFtp) - { - SavePathToHistory(normalizedInput); - shellPage.NavigateToPath(normalizedInput); - } - else // Not a folder or inaccessible - { - var resFile = await FilesystemTasks.Wrap(() => StorageFileExtensions.DangerousGetFileWithPathFromPathAsync(normalizedInput, item)); - if (resFile) - { - var pathToInvoke = resFile.Result.Path; - await Win32Helper.InvokeWin32ComponentAsync(pathToInvoke, shellPage); - } - else // Not a file or not accessible - { - var workingDir = - string.IsNullOrEmpty(shellPage.ShellViewModel.WorkingDirectory) || - shellPage.CurrentPageType == typeof(HomePage) ? - Constants.UserEnvironmentPaths.HomePath : - shellPage.ShellViewModel.WorkingDirectory; - - if (await LaunchApplicationFromPath(currentInput, workingDir)) - return; - - try - { - if (!await Windows.System.Launcher.LaunchUriAsync(new Uri(currentInput))) - await DialogDisplayHelper.ShowDialogAsync(Strings.InvalidItemDialogTitle.GetLocalizedResource(), - string.Format(Strings.InvalidItemDialogContent.GetLocalizedResource(), Environment.NewLine, resFolder.ErrorCode.ToString())); - } - catch (Exception ex) when (ex is UriFormatException || ex is ArgumentException) - { - await DialogDisplayHelper.ShowDialogAsync(Strings.InvalidItemDialogTitle.GetLocalizedResource(), - string.Format(Strings.InvalidItemDialogContent.GetLocalizedResource(), Environment.NewLine, resFolder.ErrorCode.ToString())); - } - } - } - } - - PathControlDisplayText = shellPage.ShellViewModel.WorkingDirectory; - } - } - private void SavePathToHistory(string path) { var pathHistoryList = UserSettingsService.GeneralSettingsService.PathHistoryList?.ToList() ?? []; From f00c2f0575b2058ea0792584801c8fc5a5716674 Mon Sep 17 00:00:00 2001 From: Yair <39923744+yaira2@users.noreply.github.com> Date: Thu, 24 Jul 2025 17:17:25 -0400 Subject: [PATCH 2/3] Code cleanup --- .../AdaptiveGridView.Properties.cs | 5 - .../AdaptiveGridView/AdaptiveGridView.cs | 5 - .../AdaptiveHeightValueConverter.cs | 5 - .../BladeView/BladeItem.Events.cs | 6 - .../BladeView/BladeItem.Properties.cs | 7 +- .../BladeView/BladeItemAutomationPeer.cs | 7 +- src/Files.App.Controls/BladeView/BladeMode.cs | 6 - .../BladeView/BladeView.Events.cs | 6 - .../BladeView/BladeView.Properties.cs | 5 - src/Files.App.Controls/BladeView/BladeView.cs | 5 - .../BladeView/BladeViewAutomationPeer.cs | 7 +- .../BreadcrumbBar/BreadcrumbBarLayout.cs | 2 +- .../GridSplitter/GripperHoverWrapper.cs | 1 - .../SamplePanel/SamplePanel.Properties.cs | 2 - .../SamplePanel/SamplePanel.cs | 4 - .../Sidebar/ISidebarViewModel.cs | 1 - .../Sidebar/SidebarItem.Properties.cs | 4 +- .../Storage/RingShape/RingShape.Properties.cs | 1 - .../Storage/StorageBar/StorageBar.cs | 2 +- .../ThemedIcon/ThemedIcon.Consts.cs | 5 +- .../ThemedIcon/ThemedIcon.Owner.cs | 3 - .../ThemedIcon/ThemedIcon.Properties.cs | 1 - .../ThemedIcon/ThemedIcon.cs | 32 +-- .../ThemedIconLayer/ThemedIconLayer.Consts.cs | 2 - .../ThemedIconLayer/ThemedIconLayer.cs | 6 +- .../Toolbar/Primitives/ToolbarLayout.cs | 18 +- .../Toolbar/Toolbar.Constants.cs | 26 +- .../Toolbar/Toolbar.Properties.cs | 62 ++--- src/Files.App.Controls/Toolbar/Toolbar.cs | 248 +++++++++--------- .../ToolbarButton/ToolbarButton.Constants.cs | 36 +-- .../ToolbarButton/ToolbarButton.Properties.cs | 38 +-- .../Toolbar/ToolbarButton/ToolbarButton.cs | 34 +-- .../ToolbarFlyoutButton.cs | 2 +- .../ToolbarItem/ToolbarItem.Properties.cs | 129 +++++---- .../Toolbar/ToolbarItem/ToolbarItem.cs | 37 ++- .../ToolbarRadioButton/ToolbarRadioButton.cs | 2 +- .../ToolbarSeparator/ToolbarSeparator.cs | 2 +- .../ToolbarToggleButton.Constants.cs | 80 +++--- .../ToolbarToggleButton.Properties.cs | 38 +-- .../ToolbarToggleButton.cs | 30 +-- src/Files.App.CsWin32/ComHeapPtr`1.cs | 2 - src/Files.App.CsWin32/ComPtr`1.cs | 2 - .../IStorageProviderQuotaUI.cs | 2 - .../IStorageProviderStatusUI.cs | 2 - .../IStorageProviderStatusUISource.cs | 2 - .../IStorageProviderStatusUISourceFactory.cs | 2 - src/Files.App.Storage/GlobalUsings.cs | 2 +- .../Storables/FtpStorage/FtpStorable.cs | 2 +- .../WindowsStorage/IFolderSettings.cs | 8 +- .../WindowsStorage/JumpListDestinationType.cs | 8 +- .../WindowsStorage/JumpListManager.cs | 7 - .../Storables/WindowsStorage/WindowsFile.cs | 1 - .../WindowsStorableHelpers.PowerShell.cs | 2 +- .../WindowsStorableHelpers.Process.cs | 1 - .../Decompress/BaseDecompressArchiveAction.cs | 1 - .../SetAsLockscreenBackgroundAction.cs | 2 - .../SetAsSlideshowBackgroundAction.cs | 2 - .../SetAsWallpaperBackgroundAction.cs | 2 - .../Content/Install/InstallInfDriverAction.cs | 2 +- .../Content/Tags/OpenAllTaggedActions.cs | 12 +- src/Files.App/Actions/Display/LayoutAction.cs | 4 +- .../Actions/FileSystem/OpenItemAction.cs | 2 +- .../Transfer/BaseTransferItemAction.cs | 1 - src/Files.App/Actions/Git/GitFetchAction.cs | 2 +- src/Files.App/Actions/Git/GitInitAction.cs | 6 +- .../Actions/Navigation/CloseTabBaseAction.cs | 4 +- .../Navigation/ReopenClosedTabAction.cs | 2 - .../Actions/Open/OpenPropertiesAction.cs | 6 +- .../Actions/Open/OpenRepoInIDEAction.cs | 2 +- .../Actions/Open/OpenSettingsAction.cs | 2 +- .../Actions/Show/ToggleShelfPaneAction.cs | 2 +- src/Files.App/Constants.cs | 4 +- .../StatusCenterStateToBrushConverter.cs | 2 +- .../StatusCenterStateToStateIconConverter.cs | 20 +- .../Data/AppModels/SingleFileDatabaseModel.cs | 6 +- .../Data/Behaviors/StickyHeaderBehavior.cs | 3 - src/Files.App/Data/Commands/ActionCommand.cs | 1 - src/Files.App/Data/Commands/HotKey/HotKey.cs | 1 - .../Data/Commands/Manager/CommandManager.cs | 2 +- .../Data/Commands/Manager/ICommandManager.cs | 2 +- .../ContentPage/ContentPageContext.cs | 3 +- .../Data/Contexts/HomePage/HomePageContext.cs | 1 - .../Multitasking/IMultitaskingContext.cs | 3 - .../Multitasking/MultitaskingContext.cs | 1 - .../Data/Contexts/Tags/ITagsContext.cs | 6 +- .../Data/Contexts/Tags/TagsContext.cs | 2 +- .../Contracts/IAppearanceSettingsService.cs | 4 +- .../Contracts/IApplicationSettingsService.cs | 2 +- .../Data/Contracts/ICompressArchiveModel.cs | 2 +- .../Contracts/IDevToolsSettingsService.cs | 2 +- .../Data/Contracts/IDialogService.cs | 3 - .../Contracts/IInfoPaneSettingsService.cs | 2 - .../Data/Contracts/IResourcesService.cs | 2 +- src/Files.App/Data/Contracts/IShellPage.cs | 2 +- .../Data/Contracts/IStartMenuService.cs | 4 +- .../Data/Contracts/IStorageArchiveService.cs | 2 +- .../Data/Contracts/ImagingService.cs | 2 - .../EventArguments/EventArrivedEventArgs.cs | 1 - .../PathBoxItemDroppedEventArgs.cs | 2 - .../EventArguments/PathNavigationEventArgs.cs | 4 - .../SearchBoxQuerySubmittedEventArgs.cs | 4 - .../SearchBoxTextChangedEventArgs.cs | 2 - .../SelectedTagChangedEventArgs.cs | 2 +- .../EventArguments/SettingChangedEventArgs.cs | 2 - .../ToolbarQuerySubmittedEventArgs.cs | 4 - ...ecurityAdvancedAccessControlItemFactory.cs | 4 - .../Factories/ShellContextFlyoutHelper.cs | 8 +- .../Data/Items/AccessControlPrincipal.cs | 3 +- .../Data/Items/ActionWithParameterItem.cs | 2 - src/Files.App/Data/Items/EncodingItem.cs | 56 ++-- src/Files.App/Data/Items/WindowEx.cs | 1 - .../FileSystemDialogOptionChangedMessage.cs | 1 - .../Data/Models/AddItemDialogResultModel.cs | 2 - .../Data/Models/CompressArchiveModel.cs | 2 +- .../Data/Models/CurrentInstanceViewModel.cs | 4 +- .../Models/DirectoryPropertiesViewModel.cs | 10 +- src/Files.App/Data/Models/DisposableArray.cs | 2 - src/Files.App/Data/Models/DrivesViewModel.cs | 1 - src/Files.App/Data/Models/GitItemModel.cs | 2 +- .../Data/Models/PinnedFoldersManager.cs | 1 - .../SelectedItemsPropertiesViewModel.cs | 2 +- src/Files.App/Data/Models/TagViewModel.cs | 2 - src/Files.App/Data/Parameters/ColumnParam.cs | 2 - .../Data/Parameters/TabBarItemParameter.cs | 2 - .../FileSystemDialogItemSelector.cs | 1 - src/Files.App/Dialogs/AddBranchDialog.xaml.cs | 1 - src/Files.App/Dialogs/AddItemDialog.xaml.cs | 2 - src/Files.App/Dialogs/CloneRepoDialog.xaml.cs | 1 - .../Dialogs/CreateShortcutDialog.xaml.cs | 2 - .../Dialogs/DecompressArchiveDialog.xaml.cs | 1 - src/Files.App/Dialogs/DynamicDialog.xaml.cs | 1 - .../Dialogs/ElevateConfirmDialog.xaml.cs | 3 - .../Dialogs/ReorderSidebarItemsDialog.xaml.cs | 8 +- src/Files.App/Dialogs/SettingsDialog.xaml.cs | 2 +- src/Files.App/Extensions/EnumExtensions.cs | 1 - .../Extensions/ImageSourceExtensions.cs | 3 - .../Extensions/LocalizationExtensions.cs | 2 - .../Extensions/MessageFormatExtensions.cs | 2 +- .../Extensions/ShellNewEntryExtensions.cs | 8 - .../Extensions/Win32FindDataExtensions.cs | 2 - .../Application/AppToastNotificationHelper.cs | 5 - src/Files.App/Helpers/CollectionDebugView.cs | 4 - src/Files.App/Helpers/CredentialsHelpers.cs | 3 +- .../Helpers/Dialog/DynamicDialogFactory.cs | 2 +- .../Helpers/Environment/PackageHelper.cs | 3 - src/Files.App/Helpers/IntervalSampler.cs | 2 - .../Helpers/Layout/AdaptiveLayoutHelpers.cs | 2 +- .../LayoutPreferencesDatabaseManager.cs | 2 - .../Helpers/NaturalStringComparer.cs | 128 ++++----- .../Navigation/MultitaskingTabsHelpers.cs | 7 +- .../Helpers/Navigation/NavigationHelpers.cs | 5 +- .../NavigationInteractionTracker.cs | 2 +- src/Files.App/Helpers/PathNormalization.cs | 1 - src/Files.App/Helpers/RegexHelpers.cs | 12 +- src/Files.App/Helpers/ShareItemHelpers.cs | 5 - src/Files.App/Helpers/StringsHelper.cs | 8 +- src/Files.App/Helpers/TypesConverter.cs | 4 - src/Files.App/Helpers/UI/AppSystemBackdrop.cs | 2 +- .../Helpers/UI/AppThemeResourcesHelper.cs | 3 - src/Files.App/Helpers/UI/DragZoneHelper.cs | 2 +- .../Helpers/WMI/ManagementEventWatcher.cs | 2 - .../Helpers/Win32/Win32Helper.Process.cs | 4 - .../Helpers/Win32/Win32Helper.Storage.cs | 2 - .../Win32/Win32Helper.WindowManagement.cs | 3 - .../Helpers/Xaml/DependencyObjectHelpers.cs | 2 - src/Files.App/MainWindow.xaml.cs | 2 +- .../Services/App/AppDialogService.cs | 7 +- .../Services/App/AppResourcesService.cs | 6 +- .../Services/App/AppUpdateStoreService.cs | 1 - .../AbstractDateTimeFormatter.cs | 1 - .../DateTimeFormatterFactory.cs | 2 - .../SystemDateTimeFormatter.cs | 3 - .../UniversalDateTimeFormatter.cs | 3 - .../PreviewPopupService.cs | 2 - .../PreviewPopupProviders/SeerProProvider.cs | 2 +- .../Settings/ApplicationSettingsService.cs | 7 +- .../Settings/FileTagsSettingsService.cs | 6 - .../Services/Settings/UserSettingsService.cs | 5 - .../SizeProvider/CachedSizeProvider.cs | 5 - .../SizeProvider/DrivesSizeProvider.cs | 4 - .../Services/SizeProvider/ISizeProvider.cs | 4 - .../Services/SizeProvider/NoSizeProvider.cs | 4 - .../SizeProvider/SizeChangedEventArgs.cs | 2 - .../Services/Storage/StorageDevicesService.cs | 2 +- .../Services/Storage/StorageNetworkService.cs | 10 +- .../Windows/WindowsJumpListService.cs | 1 - .../Windows/WindowsQuickAccessService.cs | 4 - .../Windows/WindowsRecentItemsService.cs | 6 +- .../Windows/WindowsStartMenuService.cs | 3 +- .../Windows/WindowsWallpaperService.cs | 1 - .../UserControls/ComboBoxEx/ComboBoxEx.cs | 1 - src/Files.App/UserControls/FileIcon.xaml.cs | 3 - .../FilePreviews/CodePreview.xaml.cs | 1 - .../FilePreviews/MarkdownPreview.xaml.cs | 1 - .../FilePreviews/MediaPreview.xaml.cs | 4 +- .../KeyboardShortcut.Properties.cs | 1 - .../KeyboardShortcut/KeyboardShortcut.cs | 2 +- .../KeyboardShortcutItem.Properties.cs | 1 - .../MenuFlyoutItemWithThemedIcon.xaml.cs | 2 +- ...ToggleMenuFlyoutItemWithThemedIcon.xaml.cs | 2 +- .../UserControls/NavigationToolbar.xaml.cs | 1 - .../UserControls/Pane/InfoPane.xaml.cs | 2 +- .../UserControls/Pane/ShelfPane.xaml.cs | 4 +- .../ExtendPreviousItemSelectionStrategy.cs | 1 - .../IgnorePreviousItemSelectionStrategy.cs | 1 - .../InvertPreviousItemSelectionStrategy.cs | 1 - .../Selection/ItemSelectionStrategy.cs | 2 - .../Selection/RectangleSelection.cs | 1 - .../RectangleSelection_ListViewBase.cs | 3 - src/Files.App/UserControls/StatusBar.xaml.cs | 1 - .../UserControls/StatusCenter/SpeedGraph.cs | 6 +- .../UserControls/TabBar/BaseTabBar.cs | 2 +- src/Files.App/UserControls/Toolbar.xaml.cs | 2 +- .../Utils/Cloud/CloudDriveSyncStatusUI.cs | 1 - .../Cloud/Detector/AbstractCloudDetector.cs | 4 - .../Utils/Cloud/Detector/BoxCloudDetector.cs | 1 - .../Utils/Cloud/Detector/CloudDetector.cs | 2 - .../Cloud/Detector/DropBoxCloudDetector.cs | 2 - .../Cloud/Detector/GenericCloudDetector.cs | 2 - .../Detector/GoogleDriveCloudDetector.cs | 10 +- .../Cloud/Detector/OXDriveCloudDetector.cs | 5 +- .../Detector/SynologyDriveCloudDetector.cs | 1 - .../Utils/Global/QuickAccessManager.cs | 1 - .../Global/WindowsStorageDeviceWatcher.cs | 8 +- src/Files.App/Utils/Library/LibraryManager.cs | 1 - .../Utils/Serialization/BaseJsonSettings.cs | 1 - .../BaseObservableJsonSettings.cs | 1 - .../DefaultJsonSettingsDatabase.cs | 1 - .../DefaultJsonSettingsSerializer.cs | 2 - src/Files.App/Utils/Shell/ContextMenu.cs | 4 +- .../Utils/Shell/ShellFolderExtensions.cs | 1 - src/Files.App/Utils/Shell/ShellHelpers.cs | 3 - .../Utils/Shell/ShellNewMenuHelper.cs | 3 +- .../Utils/StatusCenter/StatusCenterItem.cs | 2 +- .../Collection/ConcurrentCollection.cs | 2 +- .../Storage/Collection/GroupedCollection.cs | 2 +- .../Enumerators/UniversalStorageEnumerator.cs | 4 +- .../Enumerators/Win32StorageEnumerator.cs | 1 - .../Utils/Storage/Helpers/DriveHelpers.cs | 4 +- .../Storage/Helpers/FilePropertiesHelpers.cs | 3 +- .../Utils/Storage/Helpers/FilesystemResult.cs | 4 +- .../Utils/Storage/Helpers/FolderHelpers.cs | 1 - .../Storage/Helpers/StorageFileExtensions.cs | 2 +- .../Utils/Storage/Helpers/SyncRootHelpers.cs | 2 - .../Storage/Operations/FileSizeCalculator.cs | 1 - .../Storage/Operations/FilesystemHelpers.cs | 3 - .../StorageBaseItems/BaseStorageFolder.cs | 2 +- .../StorageBaseItems/IBaseStorageFolder.cs | 1 - .../IPasswordProtectedItem.cs | 3 - .../Storage/StorageItems/FtpStorageFile.cs | 1 - .../Storage/StorageItems/FtpStorageFolder.cs | 1 - .../Storage/StorageItems/ShellStorageFile.cs | 1 - .../StorageItems/VirtualStorageItem.cs | 1 - .../AddItemDialog/AddItemDialogViewModel.cs | 1 - .../Dialogs/BulkRenameDialogViewModel.cs | 3 +- .../Dialogs/CreateItemDialogViewModel.cs | 4 +- .../Dialogs/CreateShortcutDialogViewModel.cs | 6 +- .../DecompressArchiveDialogViewModel.cs | 7 +- .../FileSystemDialogConflictItemViewModel.cs | 1 - .../FileSystemDialogViewModel.cs | 4 - .../IFileSystemDialogConflictItemViewModel.cs | 2 - .../Dialogs/FileTooLargeDialogViewModel.cs | 6 +- src/Files.App/ViewModels/Dialogs/IDialog.cs | 2 - .../ReorderSidebarItemsDialogViewModel.cs | 2 +- src/Files.App/ViewModels/HomeViewModel.cs | 1 - .../Properties/Items/BaseProperties.cs | 1 - .../Properties/Items/CombinedProperties.cs | 8 - .../Properties/Items/DriveProperties.cs | 7 - .../Properties/Items/FilePropertySection.cs | 2 - .../Properties/Items/FolderProperties.cs | 4 +- .../Properties/Items/LibraryProperties.cs | 2 +- .../Properties/MainPropertiesViewModel.cs | 12 +- .../Properties/SecurityAdvancedViewModel.cs | 7 +- .../Properties/SecurityViewModel.cs | 3 +- .../ViewModels/Settings/AdvancedViewModel.cs | 5 +- .../ViewModels/Settings/LayoutViewModel.cs | 4 +- .../NavigationToolbarViewModel.cs | 1 - .../UserControls/Previews/BasePreviewModel.cs | 3 +- .../Previews/CodePreviewViewModel.cs | 2 +- .../Previews/FolderPreviewViewModel.cs | 4 +- .../Previews/ImagePreviewViewModel.cs | 1 - .../Previews/PDFPreviewViewModel.cs | 1 - .../ViewModels/UserControls/ShelfViewModel.cs | 96 +++---- .../UserControls/SidebarViewModel.cs | 1 - .../NetworkLocationsWidgetViewModel.cs | 3 +- .../Views/Layouts/BaseGroupableLayoutPage.cs | 2 +- src/Files.App/Views/Layouts/BaseLayoutPage.cs | 6 +- .../Views/Layouts/ColumnsLayoutPage.xaml.cs | 1 - .../Views/Layouts/GridLayoutPage.xaml.cs | 2 +- .../Properties/CompatibilityPage.xaml.cs | 1 - .../Properties/CustomizationPage.xaml.cs | 1 - .../Views/Properties/GeneralPage.xaml.cs | 1 - .../Properties/SecurityAdvancedPage.xaml.cs | 3 - .../Views/Properties/SecurityPage.xaml.cs | 3 - src/Files.App/Views/ReleaseNotesPage.xaml.cs | 2 +- src/Files.App/Views/Settings/TagsPage.xaml.cs | 2 +- src/Files.App/Views/ShellPanesPage.xaml.cs | 1 - src/Files.App/Views/Shells/BaseShellPage.cs | 1 - .../Views/Shells/ColumnShellPage.xaml.cs | 6 +- .../GlobalUsings.cs | 2 +- .../Parser/ReswParser.cs | 6 +- .../Extensions/StorageExtensions.File.cs | 2 +- src/Files.Core.Storage/GlobalUsings.cs | 22 +- .../Storables/DirectStorage/IDirectCopy.cs | 12 +- .../Storables/DirectStorage/IDirectMove.cs | 12 +- .../Files.App.UITests/Views/MainPage.xaml.cs | 1 - .../Views/OmnibarPage.xaml.cs | 1 - .../Views/StorageControlsPage.xaml.cs | 1 - .../Views/ThemedIconPage.xaml.cs | 1 - .../Views/ToolbarPage.xaml.cs | 1 - .../Tests/SettingsTests.cs | 2 - 311 files changed, 771 insertions(+), 1239 deletions(-) diff --git a/src/Files.App.Controls/AdaptiveGridView/AdaptiveGridView.Properties.cs b/src/Files.App.Controls/AdaptiveGridView/AdaptiveGridView.Properties.cs index 9fb91746991e..1021ebc24824 100644 --- a/src/Files.App.Controls/AdaptiveGridView/AdaptiveGridView.Properties.cs +++ b/src/Files.App.Controls/AdaptiveGridView/AdaptiveGridView.Properties.cs @@ -1,11 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using System.Windows.Input; namespace Files.App.Controls diff --git a/src/Files.App.Controls/AdaptiveGridView/AdaptiveGridView.cs b/src/Files.App.Controls/AdaptiveGridView/AdaptiveGridView.cs index 5d17a8ba78da..e348fbd682bd 100644 --- a/src/Files.App.Controls/AdaptiveGridView/AdaptiveGridView.cs +++ b/src/Files.App.Controls/AdaptiveGridView/AdaptiveGridView.cs @@ -2,11 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. using Microsoft.UI.Xaml.Data; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using Windows.Foundation.Collections; namespace Files.App.Controls diff --git a/src/Files.App.Controls/AdaptiveGridView/AdaptiveHeightValueConverter.cs b/src/Files.App.Controls/AdaptiveGridView/AdaptiveHeightValueConverter.cs index b636700e395a..4d9fd74339c6 100644 --- a/src/Files.App.Controls/AdaptiveGridView/AdaptiveHeightValueConverter.cs +++ b/src/Files.App.Controls/AdaptiveGridView/AdaptiveHeightValueConverter.cs @@ -2,11 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. using Microsoft.UI.Xaml.Data; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Files.App.Controls { diff --git a/src/Files.App.Controls/BladeView/BladeItem.Events.cs b/src/Files.App.Controls/BladeView/BladeItem.Events.cs index c4dbac9304d0..4b0706c2a16e 100644 --- a/src/Files.App.Controls/BladeView/BladeItem.Events.cs +++ b/src/Files.App.Controls/BladeView/BladeItem.Events.cs @@ -1,12 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - namespace Files.App.Controls { /// diff --git a/src/Files.App.Controls/BladeView/BladeItem.Properties.cs b/src/Files.App.Controls/BladeView/BladeItem.Properties.cs index 5678d63a1c2a..327a0d59fa2d 100644 --- a/src/Files.App.Controls/BladeView/BladeItem.Properties.cs +++ b/src/Files.App.Controls/BladeView/BladeItem.Properties.cs @@ -1,13 +1,8 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using Microsoft.UI.Xaml.Media; using Microsoft.UI; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using Microsoft.UI.Xaml.Media; namespace Files.App.Controls { diff --git a/src/Files.App.Controls/BladeView/BladeItemAutomationPeer.cs b/src/Files.App.Controls/BladeView/BladeItemAutomationPeer.cs index 0666e56460ae..7c6ec7f7764a 100644 --- a/src/Files.App.Controls/BladeView/BladeItemAutomationPeer.cs +++ b/src/Files.App.Controls/BladeView/BladeItemAutomationPeer.cs @@ -2,13 +2,8 @@ // The .NET Foundation licenses this file to you under the MIT license. using CommunityToolkit.WinUI; -using Microsoft.UI.Xaml.Automation.Peers; using Microsoft.UI.Xaml.Automation; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using Microsoft.UI.Xaml.Automation.Peers; namespace Files.App.Controls { diff --git a/src/Files.App.Controls/BladeView/BladeMode.cs b/src/Files.App.Controls/BladeView/BladeMode.cs index 123d36a2d8d5..7e5250700ee2 100644 --- a/src/Files.App.Controls/BladeView/BladeMode.cs +++ b/src/Files.App.Controls/BladeView/BladeMode.cs @@ -1,12 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - namespace Files.App.Controls { /// diff --git a/src/Files.App.Controls/BladeView/BladeView.Events.cs b/src/Files.App.Controls/BladeView/BladeView.Events.cs index c60e719c876e..69984d8a7281 100644 --- a/src/Files.App.Controls/BladeView/BladeView.Events.cs +++ b/src/Files.App.Controls/BladeView/BladeView.Events.cs @@ -1,12 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - namespace Files.App.Controls { /// diff --git a/src/Files.App.Controls/BladeView/BladeView.Properties.cs b/src/Files.App.Controls/BladeView/BladeView.Properties.cs index c953163127e3..6956c1117bc0 100644 --- a/src/Files.App.Controls/BladeView/BladeView.Properties.cs +++ b/src/Files.App.Controls/BladeView/BladeView.Properties.cs @@ -1,11 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using Windows.Foundation; namespace Files.App.Controls diff --git a/src/Files.App.Controls/BladeView/BladeView.cs b/src/Files.App.Controls/BladeView/BladeView.cs index 48456f58261f..ba3535f73677 100644 --- a/src/Files.App.Controls/BladeView/BladeView.cs +++ b/src/Files.App.Controls/BladeView/BladeView.cs @@ -3,11 +3,6 @@ using CommunityToolkit.WinUI; using Microsoft.UI.Xaml.Automation.Peers; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using Windows.Foundation; using Windows.Foundation.Collections; diff --git a/src/Files.App.Controls/BladeView/BladeViewAutomationPeer.cs b/src/Files.App.Controls/BladeView/BladeViewAutomationPeer.cs index 085dfc6c699d..ffa0424349bb 100644 --- a/src/Files.App.Controls/BladeView/BladeViewAutomationPeer.cs +++ b/src/Files.App.Controls/BladeView/BladeViewAutomationPeer.cs @@ -1,13 +1,8 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using Microsoft.UI.Xaml.Automation.Peers; using Microsoft.UI.Xaml.Automation; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using Microsoft.UI.Xaml.Automation.Peers; namespace Files.App.Controls { diff --git a/src/Files.App.Controls/BreadcrumbBar/BreadcrumbBarLayout.cs b/src/Files.App.Controls/BreadcrumbBar/BreadcrumbBarLayout.cs index f1a0d2efcc25..42f107a96712 100644 --- a/src/Files.App.Controls/BreadcrumbBar/BreadcrumbBarLayout.cs +++ b/src/Files.App.Controls/BreadcrumbBar/BreadcrumbBarLayout.cs @@ -41,7 +41,7 @@ protected override Size MeasureOverride(NonVirtualizingLayoutContext context, Si if (context.Children[index] is BreadcrumbBarItem breadcrumbItem) { breadcrumbItem.Measure(availableSize); - accumulatedSize.Width += index < indexAfterEllipsis ? 0: breadcrumbItem.DesiredSize.Width; + accumulatedSize.Width += index < indexAfterEllipsis ? 0 : breadcrumbItem.DesiredSize.Width; accumulatedSize.Height = Math.Max(accumulatedSize.Height, breadcrumbItem.DesiredSize.Height); } } diff --git a/src/Files.App.Controls/GridSplitter/GripperHoverWrapper.cs b/src/Files.App.Controls/GridSplitter/GripperHoverWrapper.cs index 353e46c3b035..99e8579595e9 100644 --- a/src/Files.App.Controls/GridSplitter/GripperHoverWrapper.cs +++ b/src/Files.App.Controls/GridSplitter/GripperHoverWrapper.cs @@ -2,7 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. using Microsoft.UI.Input; -using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Input; namespace Files.App.Controls diff --git a/src/Files.App.Controls/SamplePanel/SamplePanel.Properties.cs b/src/Files.App.Controls/SamplePanel/SamplePanel.Properties.cs index 99ff6328a8c0..c187fbf1111b 100644 --- a/src/Files.App.Controls/SamplePanel/SamplePanel.Properties.cs +++ b/src/Files.App.Controls/SamplePanel/SamplePanel.Properties.cs @@ -2,8 +2,6 @@ // Licensed under the MIT License. using CommunityToolkit.WinUI; -using Microsoft.UI.Xaml; -using Microsoft.UI.Xaml.Controls; namespace Files.App.Controls { diff --git a/src/Files.App.Controls/SamplePanel/SamplePanel.cs b/src/Files.App.Controls/SamplePanel/SamplePanel.cs index 9b727cb2a0bf..8d2dbc1ff2e0 100644 --- a/src/Files.App.Controls/SamplePanel/SamplePanel.cs +++ b/src/Files.App.Controls/SamplePanel/SamplePanel.cs @@ -1,10 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using Microsoft.UI.Xaml; -using Microsoft.UI.Xaml.Controls; -using Microsoft.UI.Xaml.Markup; - namespace Files.App.Controls { // Visual states diff --git a/src/Files.App.Controls/Sidebar/ISidebarViewModel.cs b/src/Files.App.Controls/Sidebar/ISidebarViewModel.cs index eb35d2ece37e..a3673e6d6105 100644 --- a/src/Files.App.Controls/Sidebar/ISidebarViewModel.cs +++ b/src/Files.App.Controls/Sidebar/ISidebarViewModel.cs @@ -2,7 +2,6 @@ // Licensed under the MIT License. using Microsoft.UI.Input; -using Microsoft.UI.Xaml; using Windows.ApplicationModel.DataTransfer; using Windows.Foundation; diff --git a/src/Files.App.Controls/Sidebar/SidebarItem.Properties.cs b/src/Files.App.Controls/Sidebar/SidebarItem.Properties.cs index 68b1d440c126..79a336758fca 100644 --- a/src/Files.App.Controls/Sidebar/SidebarItem.Properties.cs +++ b/src/Files.App.Controls/Sidebar/SidebarItem.Properties.cs @@ -44,7 +44,7 @@ public double ChildrenPresenterHeight } // Using 30 as a default in case something goes wrong public static readonly DependencyProperty ChildrenPresenterHeightProperty = - DependencyProperty.Register(nameof(ChildrenPresenterHeight), typeof(double), typeof(SidebarItem), new PropertyMetadata(30d)); + DependencyProperty.Register(nameof(ChildrenPresenterHeight), typeof(double), typeof(SidebarItem), new PropertyMetadata(30d)); public ISidebarItemModel? Item { @@ -112,7 +112,7 @@ public static void OnPropertyChanged(DependencyObject sender, DependencyProperty { item.UpdateExpansionState(); } - else if(e.Property == ItemProperty) + else if (e.Property == ItemProperty) { item.HandleItemChange(); } diff --git a/src/Files.App.Controls/Storage/RingShape/RingShape.Properties.cs b/src/Files.App.Controls/Storage/RingShape/RingShape.Properties.cs index d85ff577f316..2d6680a3115b 100644 --- a/src/Files.App.Controls/Storage/RingShape/RingShape.Properties.cs +++ b/src/Files.App.Controls/Storage/RingShape/RingShape.Properties.cs @@ -2,7 +2,6 @@ // Licensed under the MIT License. using CommunityToolkit.WinUI; -using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Media; using Microsoft.UI.Xaml.Shapes; using Windows.Foundation; diff --git a/src/Files.App.Controls/Storage/StorageBar/StorageBar.cs b/src/Files.App.Controls/Storage/StorageBar/StorageBar.cs index 236f74f080b8..d570cc88d1fa 100644 --- a/src/Files.App.Controls/Storage/StorageBar/StorageBar.cs +++ b/src/Files.App.Controls/Storage/StorageBar/StorageBar.cs @@ -217,7 +217,7 @@ private void UpdateColumnWidths() true); var interpolatedGapWidth = valueLarger - ? StorageControlsHelpers.CalculateInterpolatedValue( + ? StorageControlsHelpers.CalculateInterpolatedValue( minPercent, Percent, minPercent + 2.0, diff --git a/src/Files.App.Controls/ThemedIcon/ThemedIcon.Consts.cs b/src/Files.App.Controls/ThemedIcon/ThemedIcon.Consts.cs index 5cc349e20ef9..3de66bb5294c 100644 --- a/src/Files.App.Controls/ThemedIcon/ThemedIcon.Consts.cs +++ b/src/Files.App.Controls/ThemedIcon/ThemedIcon.Consts.cs @@ -1,9 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using Microsoft.UI.Xaml; -using Microsoft.UI.Xaml.Controls; - namespace Files.App.Controls { // Template Parts @@ -12,7 +9,7 @@ namespace Files.App.Controls [TemplatePart(Name = LayeredPathIconViewBox, Type = typeof(Viewbox))] [TemplatePart(Name = LayeredPathCanvas, Type = typeof(Canvas))] // Icon Type Visual States - [TemplateVisualState(Name = OutlineTypeStateName, GroupName = IconTypeStateGroupName)] + [TemplateVisualState(Name = OutlineTypeStateName, GroupName = IconTypeStateGroupName)] [TemplateVisualState(Name = LayeredTypeStateName, GroupName = IconTypeStateGroupName)] [TemplateVisualState(Name = FilledTypeStateName, GroupName = IconTypeStateGroupName)] // Icon Color Visual States diff --git a/src/Files.App.Controls/ThemedIcon/ThemedIcon.Owner.cs b/src/Files.App.Controls/ThemedIcon/ThemedIcon.Owner.cs index 3a87ce1efc43..52572e76381f 100644 --- a/src/Files.App.Controls/ThemedIcon/ThemedIcon.Owner.cs +++ b/src/Files.App.Controls/ThemedIcon/ThemedIcon.Owner.cs @@ -2,9 +2,6 @@ // Licensed under the MIT License. using CommunityToolkit.WinUI; -using Microsoft.UI.Xaml; -using Microsoft.UI.Xaml.Controls; -using Microsoft.UI.Xaml.Controls.Primitives; namespace Files.App.Controls { diff --git a/src/Files.App.Controls/ThemedIcon/ThemedIcon.Properties.cs b/src/Files.App.Controls/ThemedIcon/ThemedIcon.Properties.cs index f72caa7a414e..c385aab30c6c 100644 --- a/src/Files.App.Controls/ThemedIcon/ThemedIcon.Properties.cs +++ b/src/Files.App.Controls/ThemedIcon/ThemedIcon.Properties.cs @@ -2,7 +2,6 @@ // Licensed under the MIT License. using CommunityToolkit.WinUI; -using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Media; namespace Files.App.Controls diff --git a/src/Files.App.Controls/ThemedIcon/ThemedIcon.cs b/src/Files.App.Controls/ThemedIcon/ThemedIcon.cs index a42168104c90..c7cfdde8932f 100644 --- a/src/Files.App.Controls/ThemedIcon/ThemedIcon.cs +++ b/src/Files.App.Controls/ThemedIcon/ThemedIcon.cs @@ -1,13 +1,9 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using Microsoft.UI.Xaml; -using Microsoft.UI.Xaml.Controls; -using Microsoft.UI.Xaml.Media; using Microsoft.UI.Xaml.Markup; +using Microsoft.UI.Xaml.Media; using Microsoft.UI.Xaml.Shapes; -using System.Linq; -using System.Collections.Generic; namespace Files.App.Controls { @@ -15,11 +11,11 @@ namespace Files.App.Controls /// A control for a State and Color aware Icon /// public partial class ThemedIcon : Control - { - private Viewbox? _filledViewBox; - private Viewbox? _outlineViewBox; - private Viewbox? _layeredViewBox; - private Canvas? _layeredCanvas; + { + private Viewbox? _filledViewBox; + private Viewbox? _outlineViewBox; + private Viewbox? _layeredViewBox; + private Canvas? _layeredCanvas; public ThemedIcon() { @@ -49,11 +45,11 @@ protected override void OnApplyTemplate() private void GetTemplateParts() { // Gets the template parts and sets the private fields - _outlineViewBox = GetTemplateChild( OutlinePathIconViewBox ) as Viewbox; - _filledViewBox = GetTemplateChild( FilledPathIconViewBox ) as Viewbox; - _layeredViewBox = GetTemplateChild( LayeredPathIconViewBox ) as Viewbox; + _outlineViewBox = GetTemplateChild(OutlinePathIconViewBox) as Viewbox; + _filledViewBox = GetTemplateChild(FilledPathIconViewBox) as Viewbox; + _layeredViewBox = GetTemplateChild(LayeredPathIconViewBox) as Viewbox; - _layeredCanvas = GetTemplateChild( LayeredPathCanvas ) as Canvas; + _layeredCanvas = GetTemplateChild(LayeredPathCanvas) as Canvas; } // Updates paths and layers @@ -64,7 +60,7 @@ private void OnFilledIconChanged() if (_filledViewBox == null) return; - SetPathData(FilledIconPath, FilledIconData ?? string.Empty, _filledViewBox ); + SetPathData(FilledIconPath, FilledIconData ?? string.Empty, _filledViewBox); } private void OnOutlineIconChanged() @@ -73,16 +69,16 @@ private void OnOutlineIconChanged() if (_outlineViewBox == null) return; - SetPathData(OutlineIconPath, OutlineIconData ?? string.Empty, _outlineViewBox ); + SetPathData(OutlineIconPath, OutlineIconData ?? string.Empty, _outlineViewBox); } private void OnLayeredIconChanged() { // Updates Layered Icon from it's Layers - if ( _layeredViewBox == null || + if (_layeredViewBox == null || _layeredCanvas == null || Layers is not ICollection layers) - return; + return; _layeredCanvas.Children.Clear(); diff --git a/src/Files.App.Controls/ThemedIcon/ThemedIconLayer/ThemedIconLayer.Consts.cs b/src/Files.App.Controls/ThemedIcon/ThemedIconLayer/ThemedIconLayer.Consts.cs index 99abf1cdd354..137eed61a5ed 100644 --- a/src/Files.App.Controls/ThemedIcon/ThemedIconLayer/ThemedIconLayer.Consts.cs +++ b/src/Files.App.Controls/ThemedIcon/ThemedIconLayer/ThemedIconLayer.Consts.cs @@ -1,8 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using Microsoft.UI.Xaml; -using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Shapes; namespace Files.App.Controls diff --git a/src/Files.App.Controls/ThemedIcon/ThemedIconLayer/ThemedIconLayer.cs b/src/Files.App.Controls/ThemedIcon/ThemedIconLayer/ThemedIconLayer.cs index 5a8c73be4869..5e1b52444b33 100644 --- a/src/Files.App.Controls/ThemedIcon/ThemedIconLayer/ThemedIconLayer.cs +++ b/src/Files.App.Controls/ThemedIcon/ThemedIconLayer/ThemedIconLayer.cs @@ -1,8 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using Microsoft.UI.Xaml; -using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Markup; using Microsoft.UI.Xaml.Media; using Microsoft.UI.Xaml.Shapes; @@ -68,8 +66,8 @@ private void UpdateIconLayerState() IconColorType switch { ThemedIconColorType.Critical => CriticalStateName, - ThemedIconColorType.Caution => CautionStateName, - ThemedIconColorType.Success => SuccessStateName, + ThemedIconColorType.Caution => CautionStateName, + ThemedIconColorType.Success => SuccessStateName, ThemedIconColorType.Neutral => NeutralStateName, ThemedIconColorType.Custom => CustomColorStateName, _ => AccentStateName, diff --git a/src/Files.App.Controls/Toolbar/Primitives/ToolbarLayout.cs b/src/Files.App.Controls/Toolbar/Primitives/ToolbarLayout.cs index d6bac7137dec..cf91d1a0bbda 100644 --- a/src/Files.App.Controls/Toolbar/Primitives/ToolbarLayout.cs +++ b/src/Files.App.Controls/Toolbar/Primitives/ToolbarLayout.cs @@ -1,8 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using Microsoft.UI.Xaml; -using Microsoft.UI.Xaml.Controls; using Windows.Foundation; namespace Files.App.Controls.Primitives @@ -21,14 +19,14 @@ private int GetItemCount(NonVirtualizingLayoutContext context) return context.Children.Count; } - private UIElement GetElementAt(NonVirtualizingLayoutContext context , int index) + private UIElement GetElementAt(NonVirtualizingLayoutContext context, int index) { return context.Children[index]; } // Measuring is performed in a single step, every element is measured, including the overflow button // item, but the total amount of space needed is only composed of the Toolbar Items - protected override Size MeasureOverride(NonVirtualizingLayoutContext context , Size availableSize) + protected override Size MeasureOverride(NonVirtualizingLayoutContext context, Size availableSize) { m_availableSize = availableSize; @@ -39,32 +37,32 @@ protected override Size MeasureOverride(NonVirtualizingLayoutContext context , S //var toolbarItem = (ToolbarItem)GetElementAt(context, i); //toolbarItem.Measure( availableSize ); - if ( i != 0 ) + if (i != 0) { //accumulatedItemsSize.Width += toolbarItem.DesiredSize.Width; //accumulatedItemsSize.Height = Math.Max( accumulatedItemsSize.Height , toolbarItem.DesiredSize.Height ); } } - if ( accumulatedItemsSize.Width > availableSize.Width ) + if (accumulatedItemsSize.Width > availableSize.Width) { - + } else { - + } return accumulatedItemsSize; } - private void ArrangeItem(UIElement breadcrumbItem , ref float accumulatedWidths , float maxElementHeight) + private void ArrangeItem(UIElement breadcrumbItem, ref float accumulatedWidths, float maxElementHeight) { } // Arranging is performed in a single step, as many elements are tried to be drawn going from the last element // towards the first one, if there's not enough space, then the ellipsis button is drawn - protected override Size ArrangeOverride(NonVirtualizingLayoutContext context , Size finalSize) + protected override Size ArrangeOverride(NonVirtualizingLayoutContext context, Size finalSize) { return finalSize; } diff --git a/src/Files.App.Controls/Toolbar/Toolbar.Constants.cs b/src/Files.App.Controls/Toolbar/Toolbar.Constants.cs index bb1c2cab030f..044eeaa6d083 100644 --- a/src/Files.App.Controls/Toolbar/Toolbar.Constants.cs +++ b/src/Files.App.Controls/Toolbar/Toolbar.Constants.cs @@ -4,30 +4,30 @@ namespace Files.App.Controls { // TemplateParts - [TemplatePart( Name = ToolbarItemsRepeaterPartName , Type = typeof( ItemsRepeater ) )] + [TemplatePart(Name = ToolbarItemsRepeaterPartName, Type = typeof(ItemsRepeater))] // VisualStates - [TemplateVisualState( Name = OverflowOnStateName , GroupName = CommonStatesGroupName )] - [TemplateVisualState( Name = OverflowOffStateName , GroupName = CommonStatesGroupName )] + [TemplateVisualState(Name = OverflowOnStateName, GroupName = CommonStatesGroupName)] + [TemplateVisualState(Name = OverflowOffStateName, GroupName = CommonStatesGroupName)] public partial class Toolbar : Control { // TemplatePart Names - internal const string ToolbarItemsRepeaterPartName = "PART_ItemsRepeater"; + internal const string ToolbarItemsRepeaterPartName = "PART_ItemsRepeater"; // VisualState Group Names - internal const string CommonStatesGroupName = "OverflowStates"; + internal const string CommonStatesGroupName = "OverflowStates"; // VisualState Names - internal const string OverflowOnStateName = "OverflowOn"; - internal const string OverflowOffStateName = "OverflowOff"; + internal const string OverflowOnStateName = "OverflowOn"; + internal const string OverflowOffStateName = "OverflowOff"; // ResourceDictionary Keys - internal const string SmallMinWidthResourceKey = "ToolbarButtonSmallMinWidth"; - internal const string SmallMinHeightResourceKey = "ToolbarButtonSmallMinHeight"; + internal const string SmallMinWidthResourceKey = "ToolbarButtonSmallMinWidth"; + internal const string SmallMinHeightResourceKey = "ToolbarButtonSmallMinHeight"; - internal const string MediumMinWidthResourceKey = "ToolbarButtonMediumMinWidth"; - internal const string MediumMinHeightResourceKey = "ToolbarButtonMediumMinHeight"; + internal const string MediumMinWidthResourceKey = "ToolbarButtonMediumMinWidth"; + internal const string MediumMinHeightResourceKey = "ToolbarButtonMediumMinHeight"; - internal const string LargeMinWidthResourceKey = "ToolbarButtonLargeMinWidth"; - internal const string LargeMinHeightResourceKey = "ToolbarButtonLargeMinHeight"; + internal const string LargeMinWidthResourceKey = "ToolbarButtonLargeMinWidth"; + internal const string LargeMinHeightResourceKey = "ToolbarButtonLargeMinHeight"; } } diff --git a/src/Files.App.Controls/Toolbar/Toolbar.Properties.cs b/src/Files.App.Controls/Toolbar/Toolbar.Properties.cs index c2a76e85d066..e58e36f4aff7 100644 --- a/src/Files.App.Controls/Toolbar/Toolbar.Properties.cs +++ b/src/Files.App.Controls/Toolbar/Toolbar.Properties.cs @@ -24,8 +24,8 @@ public partial class Toolbar : Control /// public ToolbarSizes ToolbarSize { - get => (ToolbarSizes)GetValue( ToolbarSizeProperty ); - set => SetValue( ToolbarSizeProperty , value ); + get => (ToolbarSizes)GetValue(ToolbarSizeProperty); + set => SetValue(ToolbarSizeProperty, value); } @@ -34,11 +34,11 @@ public ToolbarSizes ToolbarSize /// /// /// - protected virtual void OnToolbarSizePropertyChanged(ToolbarSizes oldValue , ToolbarSizes newValue) + protected virtual void OnToolbarSizePropertyChanged(ToolbarSizes oldValue, ToolbarSizes newValue) { - if ( newValue != oldValue ) + if (newValue != oldValue) { - ToolbarSizeChanged( newValue ); + ToolbarSizeChanged(newValue); } } @@ -48,26 +48,26 @@ protected virtual void OnToolbarSizePropertyChanged(ToolbarSizes oldValue , Tool public static readonly DependencyProperty ItemsProperty = DependencyProperty.Register( - nameof( Items ), - typeof( IList ), - typeof(Toolbar), - new PropertyMetadata( defaultValue: new List(), (d, e) => ((Toolbar)d).OnItemsPropertyChanged(( IList )e.OldValue, ( IList )e.NewValue))); + nameof(Items), + typeof(IList), + typeof(Toolbar), + new PropertyMetadata(defaultValue: new List(), (d, e) => ((Toolbar)d).OnItemsPropertyChanged((IList)e.OldValue, (IList)e.NewValue))); public IList Items { - get => ( IList )GetValue( ItemsProperty ); - set => SetValue( ItemsProperty , value ); + get => (IList)GetValue(ItemsProperty); + set => SetValue(ItemsProperty, value); } - private void OnItemsPropertyChanged(IList oldItems , IList newItems) + private void OnItemsPropertyChanged(IList oldItems, IList newItems) { - if ( newItems != oldItems ) + if (newItems != oldItems) { - ItemsChanged( newItems ); + ItemsChanged(newItems); } } @@ -92,8 +92,8 @@ private void OnItemsPropertyChanged(IList oldItems , IList public DataTemplate ItemTemplate { - get => (DataTemplate)GetValue( ItemTemplateProperty ); - set => SetValue( ItemTemplateProperty , value ); + get => (DataTemplate)GetValue(ItemTemplateProperty); + set => SetValue(ItemTemplateProperty, value); } @@ -102,11 +102,11 @@ public DataTemplate ItemTemplate /// /// /// - protected virtual void OnItemTemplatePropertyChanged(DataTemplate oldValue , DataTemplate newValue) + protected virtual void OnItemTemplatePropertyChanged(DataTemplate oldValue, DataTemplate newValue) { - if ( newValue != oldValue ) + if (newValue != oldValue) { - ItemTemplateChanged( newValue ); + ItemTemplateChanged(newValue); } } @@ -122,7 +122,7 @@ protected virtual void OnItemTemplatePropertyChanged(DataTemplate oldValue , Dat nameof(ItemList), typeof(ToolbarItemList), typeof(Toolbar), - new PropertyMetadata(new ToolbarItemList(), (d, e) => ((Toolbar)d).OnItemListPropertyChanged(( ToolbarItemList )e.OldValue, ( ToolbarItemList )e.NewValue))); + new PropertyMetadata(new ToolbarItemList(), (d, e) => ((Toolbar)d).OnItemListPropertyChanged((ToolbarItemList)e.OldValue, (ToolbarItemList)e.NewValue))); @@ -131,17 +131,17 @@ protected virtual void OnItemTemplatePropertyChanged(DataTemplate oldValue , Dat /// private ToolbarItemList ItemList { - get { return (ToolbarItemList)GetValue( ItemListProperty ); } - set { SetValue( ItemListProperty , value ); } + get { return (ToolbarItemList)GetValue(ItemListProperty); } + set { SetValue(ItemListProperty, value); } } - private void OnItemListPropertyChanged(ToolbarItemList oldList , ToolbarItemList newList) + private void OnItemListPropertyChanged(ToolbarItemList oldList, ToolbarItemList newList) { - if ( newList != oldList ) + if (newList != oldList) { - PrivateItemListChanged( newList ); + PrivateItemListChanged(newList); } } #endregion @@ -156,7 +156,7 @@ private void OnItemListPropertyChanged(ToolbarItemList oldList , ToolbarItemList nameof(ItemOverflowList), typeof(ToolbarItemOverflowList), typeof(Toolbar), - new PropertyMetadata(new ToolbarItemOverflowList(), (d, e) => ((Toolbar)d).OnItemOverflowListPropertyChanged(( ToolbarItemOverflowList )e.OldValue, ( ToolbarItemOverflowList )e.NewValue))); + new PropertyMetadata(new ToolbarItemOverflowList(), (d, e) => ((Toolbar)d).OnItemOverflowListPropertyChanged((ToolbarItemOverflowList)e.OldValue, (ToolbarItemOverflowList)e.NewValue))); @@ -165,17 +165,17 @@ private void OnItemListPropertyChanged(ToolbarItemList oldList , ToolbarItemList /// private ToolbarItemOverflowList ItemOverflowList { - get { return (ToolbarItemOverflowList)GetValue( ItemOverflowListProperty ); } - set { SetValue( ItemOverflowListProperty , value ); } + get { return (ToolbarItemOverflowList)GetValue(ItemOverflowListProperty); } + set { SetValue(ItemOverflowListProperty, value); } } - private void OnItemOverflowListPropertyChanged(ToolbarItemOverflowList oldList , ToolbarItemOverflowList newList) + private void OnItemOverflowListPropertyChanged(ToolbarItemOverflowList oldList, ToolbarItemOverflowList newList) { - if ( newList != oldList ) + if (newList != oldList) { - PrivateItemOverflowListChanged( newList ); + PrivateItemOverflowListChanged(newList); } } #endregion diff --git a/src/Files.App.Controls/Toolbar/Toolbar.cs b/src/Files.App.Controls/Toolbar/Toolbar.cs index 2d10d6910c18..28b0fb69db02 100644 --- a/src/Files.App.Controls/Toolbar/Toolbar.cs +++ b/src/Files.App.Controls/Toolbar/Toolbar.cs @@ -8,28 +8,28 @@ public partial class Toolbar : Control // A reference to the current available size for ToolbarItems private double _availableSize; - private ItemsRepeater? _itemsRepeater; - private ToolbarItemList? _toolbarItemsList; - private ToolbarItemOverflowList? _toolbarItemsOverflowList; + private ItemsRepeater? _itemsRepeater; + private ToolbarItemList? _toolbarItemsList; + private ToolbarItemOverflowList? _toolbarItemsOverflowList; - private ToolbarItemList _tempToolbarItemsList; - private ToolbarItemOverflowList _tempToolbarItemsOverflowList; + private ToolbarItemList _tempToolbarItemsList; + private ToolbarItemOverflowList _tempToolbarItemsOverflowList; - private double _smallMinWidth = 24; // I have set default values, but we pull from resources - private double _mediumMinWidth = 32; // if they are available. - private double _largeMinWidth = 32; - - private double _smallMinHeight = 24; - private double _mediumMinHeight = 24; - private double _largeMinHeight = 32; + private double _smallMinWidth = 24; // I have set default values, but we pull from resources + private double _mediumMinWidth = 32; // if they are available. + private double _largeMinWidth = 32; - private double _currentMinWidth; - private double _currentMinHeight; + private double _smallMinHeight = 24; + private double _mediumMinHeight = 24; + private double _largeMinHeight = 32; + + private double _currentMinWidth; + private double _currentMinHeight; public Toolbar() { - DefaultStyleKey = typeof( Toolbar ); + DefaultStyleKey = typeof(Toolbar); } protected override void OnApplyTemplate() @@ -38,17 +38,17 @@ protected override void OnApplyTemplate() UpdateMinSizesFromResources(); - if ( Items != null ) + if (Items != null) { _tempToolbarItemsList = new ToolbarItemList(); _tempToolbarItemsOverflowList = new ToolbarItemOverflowList(); - UpdateItems( Items ); + UpdateItems(Items); } - SetItemsRepeater( GetTemplateChild( ToolbarItemsRepeaterPartName ) as ItemsRepeater ); + SetItemsRepeater(GetTemplateChild(ToolbarItemsRepeaterPartName) as ItemsRepeater); - if ( GetItemsRepeater() != null ) + if (GetItemsRepeater() != null) { ItemsRepeater itemsRepeater = GetItemsRepeater(); itemsRepeater.ItemsSource = GetToolbarItemsList(); @@ -201,17 +201,17 @@ private void UpdateItems(IList newItems) /// manage the Buttons and the Menu items /// - foreach ( var item in newItems ) + foreach (var item in newItems) { - SortItemsByOverflowBehavior( item ); - Debug.Write( "-> Sorted " + item.Label + " from Items... ..." + Environment.NewLine ); + SortItemsByOverflowBehavior(item); + Debug.Write("-> Sorted " + item.Label + " from Items... ..." + Environment.NewLine); } - UpdatePrivateItemList( _tempToolbarItemsList ); - Debug.Write( " | tempItemsList " + _tempToolbarItemsList.Count.ToString() + " *" + Environment.NewLine ); + UpdatePrivateItemList(_tempToolbarItemsList); + Debug.Write(" | tempItemsList " + _tempToolbarItemsList.Count.ToString() + " *" + Environment.NewLine); - UpdatePrivateItemOverflowList( _tempToolbarItemsOverflowList ); - Debug.Write( " | tempItemsOverflowList " + _tempToolbarItemsOverflowList.Count.ToString() + " *" + Environment.NewLine ); + UpdatePrivateItemOverflowList(_tempToolbarItemsOverflowList); + Debug.Write(" | tempItemsOverflowList " + _tempToolbarItemsOverflowList.Count.ToString() + " *" + Environment.NewLine); } @@ -225,9 +225,9 @@ private void UpdateItemTemplate(DataTemplate newDataTemplate) - private void UpdateToolbarSize( ToolbarSizes newToolbarSize ) + private void UpdateToolbarSize(ToolbarSizes newToolbarSize) { - UpdateMinSizesFromResources(); + UpdateMinSizesFromResources(); } @@ -239,7 +239,7 @@ private void UpdateAvailableSize() // Do some code to check or respond to size changes for // the Toolbar's Items space (ItemsRepeaterLayout?) - SetAvailableSize( newAvailableSize ); + SetAvailableSize(newAvailableSize); /// We need to check the Item Widths and Heights /// (we know the sizes for buttons, but content will need @@ -256,43 +256,43 @@ private void UpdateAvailableSize() /// private void UpdateMinSizesFromResources() { - double smallMinWidth = (double)Application.Current.Resources[SmallMinWidthResourceKey]; - double smallMinHeight = (double)Application.Current.Resources[SmallMinHeightResourceKey]; + double smallMinWidth = (double)Application.Current.Resources[SmallMinWidthResourceKey]; + double smallMinHeight = (double)Application.Current.Resources[SmallMinHeightResourceKey]; - double mediumMinWidth = (double)Application.Current.Resources[MediumMinWidthResourceKey]; - double mediumMinHeight = (double)Application.Current.Resources[MediumMinHeightResourceKey]; + double mediumMinWidth = (double)Application.Current.Resources[MediumMinWidthResourceKey]; + double mediumMinHeight = (double)Application.Current.Resources[MediumMinHeightResourceKey]; - double largeMinWidth = (double)Application.Current.Resources[LargeMinWidthResourceKey]; - double largeMinHeight = (double)Application.Current.Resources[LargeMinHeightResourceKey]; + double largeMinWidth = (double)Application.Current.Resources[LargeMinWidthResourceKey]; + double largeMinHeight = (double)Application.Current.Resources[LargeMinHeightResourceKey]; - if ( !double.IsNaN( smallMinWidth ) || !double.IsNaN( smallMinHeight ) || - !double.IsNaN( mediumMinWidth ) || !double.IsNaN( mediumMinHeight ) || - !double.IsNaN( largeMinWidth ) || !double.IsNaN( largeMinHeight ) ) + if (!double.IsNaN(smallMinWidth) || !double.IsNaN(smallMinHeight) || + !double.IsNaN(mediumMinWidth) || !double.IsNaN(mediumMinHeight) || + !double.IsNaN(largeMinWidth) || !double.IsNaN(largeMinHeight)) { - SetSmallMinWidth( smallMinWidth ); - SetSmallMinHeight( smallMinHeight ); + SetSmallMinWidth(smallMinWidth); + SetSmallMinHeight(smallMinHeight); - SetMediumMinWidth( mediumMinWidth ); - SetMediumMinHeight( mediumMinHeight ); + SetMediumMinWidth(mediumMinWidth); + SetMediumMinHeight(mediumMinHeight); - SetLargeMinWidth( largeMinWidth ); - SetLargeMinHeight( largeMinHeight ); + SetLargeMinWidth(largeMinWidth); + SetLargeMinHeight(largeMinHeight); } - if ( ToolbarSize == ToolbarSizes.Small ) + if (ToolbarSize == ToolbarSizes.Small) { - SetCurrentMinWidth( GetSmallMinWidth() ); - SetCurrentMinHeight( GetSmallMinHeight() ); + SetCurrentMinWidth(GetSmallMinWidth()); + SetCurrentMinHeight(GetSmallMinHeight()); } - else if ( ToolbarSize == ToolbarSizes.Large ) + else if (ToolbarSize == ToolbarSizes.Large) { - SetCurrentMinWidth( GetLargeMinWidth() ); - SetCurrentMinHeight( GetLargeMinHeight() ); + SetCurrentMinWidth(GetLargeMinWidth()); + SetCurrentMinHeight(GetLargeMinHeight()); } else { - SetCurrentMinWidth( GetMediumMinWidth() ); - SetCurrentMinHeight( GetMediumMinHeight() ); + SetCurrentMinWidth(GetMediumMinWidth()); + SetCurrentMinHeight(GetMediumMinHeight()); } } @@ -304,7 +304,7 @@ private void UpdateMinSizesFromResources() /// private void UpdatePrivateItemList(ToolbarItemList newList) { - SetToolbarItemsList( newList ); + SetToolbarItemsList(newList); } @@ -315,7 +315,7 @@ private void UpdatePrivateItemList(ToolbarItemList newList) /// private void UpdatePrivateItemOverflowList(ToolbarItemOverflowList newOverflowList) { - SetToolbarItemsOverflowList( newOverflowList ); + SetToolbarItemsOverflowList(newOverflowList); } #endregion @@ -328,7 +328,7 @@ private void UpdatePrivateItemOverflowList(ToolbarItemOverflowList newOverflowLi /// private void ItemsChanged(IList newItems) { - UpdateItems( newItems ); + UpdateItems(newItems); } @@ -339,7 +339,7 @@ private void ItemsChanged(IList newItems) /// private void ItemTemplateChanged(DataTemplate newDataTemplate) { - UpdateItemTemplate( newDataTemplate ); + UpdateItemTemplate(newDataTemplate); } @@ -350,7 +350,7 @@ private void ItemTemplateChanged(DataTemplate newDataTemplate) /// private void ToolbarSizeChanged(ToolbarSizes newToolbarSize) { - UpdateToolbarSize( newToolbarSize ); + UpdateToolbarSize(newToolbarSize); } @@ -361,7 +361,7 @@ private void ToolbarSizeChanged(ToolbarSizes newToolbarSize) /// private void PrivateItemListChanged(ToolbarItemList newList) { - UpdatePrivateItemList( newList ); + UpdatePrivateItemList(newList); } @@ -372,7 +372,7 @@ private void PrivateItemListChanged(ToolbarItemList newList) /// private void PrivateItemOverflowListChanged(ToolbarItemOverflowList newOverflowList) { - UpdatePrivateItemOverflowList( newOverflowList ); + UpdatePrivateItemOverflowList(newOverflowList); } #endregion @@ -390,18 +390,18 @@ private void SortItemsByOverflowBehavior(ToolbarItem item) /// Then we pass that item through additional sorting and /// then add the relevant control to the lists. /// - if ( item != null ) + if (item != null) { - if ( item.OverflowBehavior == OverflowBehaviors.Always ) + if (item.OverflowBehavior == OverflowBehaviors.Always) { - AddItemToOverflowList( SortByItemTypeForOverflowItemList( item ) ); + AddItemToOverflowList(SortByItemTypeForOverflowItemList(item)); } else { /// Not sure if we check for space at this point, or /// When we are adding items to the Private ItemList /// - if ( item.OverflowBehavior == OverflowBehaviors.Never ) + if (item.OverflowBehavior == OverflowBehaviors.Never) { /// Not sure if we need to behave differently at /// this stage for the items, but we can do if @@ -414,7 +414,7 @@ private void SortItemsByOverflowBehavior(ToolbarItem item) //AddItemToItemList( SortByItemTypeForItemList( item ) ); } - AddItemToItemList( SortByItemTypeForItemList( item ) ); + AddItemToItemList(SortByItemTypeForItemList(item)); } } } @@ -428,11 +428,11 @@ private void SortItemsByOverflowBehavior(ToolbarItem item) /// private IToolbarItemSet SortByItemTypeForItemList(ToolbarItem item) { - switch ( item.ItemType ) + switch (item.ItemType) { case ToolbarItemTypes.Button: // Add ToolbarButton - return CreateToolbarButton( item.Label , item.ThemedIcon , GetCurrentMinWidth() , GetCurrentMinHeight() , item.IconSize ); + return CreateToolbarButton(item.Label, item.ThemedIcon, GetCurrentMinWidth(), GetCurrentMinHeight(), item.IconSize); case ToolbarItemTypes.FlyoutButton: // Add ToolbarFlyoutButton @@ -448,7 +448,7 @@ private IToolbarItemSet SortByItemTypeForItemList(ToolbarItem item) case ToolbarItemTypes.ToggleButton: // Add ToolbarToggleButton - return CreateToolbarToggleButton( item.Label , item.ThemedIcon , GetCurrentMinWidth() , GetCurrentMinHeight() , item.IconSize , item.IsChecked ); + return CreateToolbarToggleButton(item.Label, item.ThemedIcon, GetCurrentMinWidth(), GetCurrentMinHeight(), item.IconSize, item.IsChecked); case ToolbarItemTypes.Separator: // Add ToolbarToggleButton @@ -472,7 +472,7 @@ private IToolbarItemSet SortByItemTypeForItemList(ToolbarItem item) /// private IToolbarOverflowItemSet SortByItemTypeForOverflowItemList(ToolbarItem item) { - switch ( item.ItemType ) + switch (item.ItemType) { case ToolbarItemTypes.Button: // Add MenuFlyoutItemEx @@ -528,47 +528,51 @@ private void PopulateItemsSourceForItemsRepeater() ItemsRepeater itemsRepeater = GetItemsRepeater(); - foreach ( ToolbarItem item in GetToolbarItemsList() ) + foreach (ToolbarItem item in GetToolbarItemsList()) { /// We can get the AvailableSize /// - double availableSize = GetAvailableSize(); + double availableSize = GetAvailableSize(); ObservableCollection itemsSource = new ObservableCollection(); /// Then we create the ToolbarButton, ToolbarSeparator, ToolbarToggleButton etc /// for each item /// - if ( item.ItemType == ToolbarItemTypes.Button ) + if (item.ItemType == ToolbarItemTypes.Button) { //Add a ToolbarButton to the ItemsSource for the ItemsRepeaterPartName - itemsSource.Add( new ToolbarButton - { - Label = item.Label , - ThemedIcon = item.ThemedIcon , Command = item.Command , - CommandParameter = item.CommandParameter , + itemsSource.Add(new ToolbarButton + { + Label = item.Label, + ThemedIcon = item.ThemedIcon, + Command = item.Command, + CommandParameter = item.CommandParameter, IconSize = item.IconSize, - } ); - }; + }); + } + ; - if ( item.ItemType == ToolbarItemTypes.ToggleButton ) + if (item.ItemType == ToolbarItemTypes.ToggleButton) { //Add a ToolbarToggleButton to the ItemsSource for the ItemsRepeaterPartName - itemsSource.Add( new ToolbarToggleButton + itemsSource.Add(new ToolbarToggleButton { - Label = item.Label , - ThemedIcon = item.ThemedIcon , - Command = item.Command , - CommandParameter = item.CommandParameter , - IconSize = item.IconSize , - } ); - }; - - if ( item.ItemType == ToolbarItemTypes.Separator ) + Label = item.Label, + ThemedIcon = item.ThemedIcon, + Command = item.Command, + CommandParameter = item.CommandParameter, + IconSize = item.IconSize, + }); + } + ; + + if (item.ItemType == ToolbarItemTypes.Separator) { //Add a ToolbarSeparator to the ItemsSource for the ItemsRepeaterPartName //itemsSource.Add( new ToolbarSeparator ); - }; + } + ; /// etc //SetAvailableSize( availableSize - item.Width ); @@ -579,11 +583,11 @@ private void PopulateItemsSourceForItemsRepeater() itemsRepeater.ItemsSource = itemsSource; } - /// We do this for each item until there is no more space - /// available, then we check its OverflowBehavior and move - /// it if neccessary. + /// We do this for each item until there is no more space + /// available, then we check its OverflowBehavior and move + /// it if neccessary. - } + } @@ -594,17 +598,17 @@ private void PopulateItemsSourceForOverflowMenu() /// is what we need to add to the Overflow Menu /// - foreach ( ToolbarItem item in GetToolbarItemsOverflowList() ) + foreach (ToolbarItem item in GetToolbarItemsOverflowList()) { - if ( item != null ) + if (item != null) { - if ( item.ItemType != ToolbarItemTypes.Separator ) - { + if (item.ItemType != ToolbarItemTypes.Separator) + { MenuFlyoutSeparator menuFlyoutSeparator = new MenuFlyoutSeparator(); /// OverflowMenuFlyout.AddMenuItem( menuFlyoutSeparator ); } - if ( item.ItemType != ToolbarItemTypes.FlyoutButton ) + if (item.ItemType != ToolbarItemTypes.FlyoutButton) { MenuFlyoutSubItem menuFlyoutSubItem = new MenuFlyoutSubItem(); menuFlyoutSubItem.Text = item.Label; @@ -615,13 +619,13 @@ private void PopulateItemsSourceForOverflowMenu() /// We will need to make child menu items for the /// ToolbarItem's flyout items. /// - + /// OverflowMenuFlyout.AddMenuItem( menuFlyoutSubItem ); } - if ( item.ItemType != ToolbarItemTypes.Button ) + if (item.ItemType != ToolbarItemTypes.Button) { - MenuFlyoutItem menuFlyoutItem= new MenuFlyoutItem(); + MenuFlyoutItem menuFlyoutItem = new MenuFlyoutItem(); //MenuFlyoutItemEx menuFlyoutItemEx = new MenuFlyoutItemEx(); menuFlyoutItem.Text = item.Label; menuFlyoutItem.Command = item.Command; @@ -633,7 +637,7 @@ private void PopulateItemsSourceForOverflowMenu() /// OverflowMenuFlyout.AddMenuItem( menuFlyoutSeparator ); } - if ( item.ItemType != ToolbarItemTypes.ToggleButton ) + if (item.ItemType != ToolbarItemTypes.ToggleButton) { ToggleMenuFlyoutItem menuToggleItem = new ToggleMenuFlyoutItem(); //ToggleMenuFlyoutItemEx menuToggleItemEx = new ToggleMenuFlyoutItemEx(); @@ -655,15 +659,15 @@ private void PopulateItemsSourceForOverflowMenu() #region Create Elements - private ToolbarButton CreateToolbarButton(string label , Style iconStyle , double minWidth , double minHeight , double iconSize) + private ToolbarButton CreateToolbarButton(string label, Style iconStyle, double minWidth, double minHeight, double iconSize) { ToolbarButton createdButton = new ToolbarButton { - Label = label , - ThemedIcon = iconStyle , - MinWidth = minWidth , - MinHeight = minHeight , - IconSize = iconSize , + Label = label, + ThemedIcon = iconStyle, + MinWidth = minWidth, + MinHeight = minHeight, + IconSize = iconSize, }; return createdButton; @@ -671,16 +675,16 @@ private ToolbarButton CreateToolbarButton(string label , Style iconStyle , doubl - private ToolbarToggleButton CreateToolbarToggleButton(string label , Style iconStyle , double minWidth , double minHeight , double iconSize , bool isChecked) + private ToolbarToggleButton CreateToolbarToggleButton(string label, Style iconStyle, double minWidth, double minHeight, double iconSize, bool isChecked) { ToolbarToggleButton createdToggleButton = new ToolbarToggleButton { - Label = label , - ThemedIcon = iconStyle , - MinWidth = minWidth , - MinHeight = minHeight , - IconSize = iconSize , - IsChecked = isChecked , + Label = label, + ThemedIcon = iconStyle, + MinWidth = minWidth, + MinHeight = minHeight, + IconSize = iconSize, + IsChecked = isChecked, }; return createdToggleButton; @@ -705,10 +709,10 @@ private ToolbarSeparator CreateToolbarSeparator() /// private void AddItemToOverflowList(IToolbarOverflowItemSet item) { - if ( item != null && _tempToolbarItemsOverflowList != null) + if (item != null && _tempToolbarItemsOverflowList != null) { - _tempToolbarItemsOverflowList.Add( item ); - Debug.Write( "<- Added " + item.ToString() + " to OverflowList " + Environment.NewLine ); + _tempToolbarItemsOverflowList.Add(item); + Debug.Write("<- Added " + item.ToString() + " to OverflowList " + Environment.NewLine); } } @@ -720,10 +724,10 @@ private void AddItemToOverflowList(IToolbarOverflowItemSet item) /// private void AddItemToItemList(IToolbarItemSet item) { - if ( item != null && _tempToolbarItemsList != null ) + if (item != null && _tempToolbarItemsList != null) { - _tempToolbarItemsList.Add( item ); - Debug.Write( "Added " + item.ToString() + " to ItemList " + Environment.NewLine ); + _tempToolbarItemsList.Add(item); + Debug.Write("Added " + item.ToString() + " to ItemList " + Environment.NewLine); } } diff --git a/src/Files.App.Controls/Toolbar/ToolbarButton/ToolbarButton.Constants.cs b/src/Files.App.Controls/Toolbar/ToolbarButton/ToolbarButton.Constants.cs index 97119d0b8a9a..60a0a9606f76 100644 --- a/src/Files.App.Controls/Toolbar/ToolbarButton/ToolbarButton.Constants.cs +++ b/src/Files.App.Controls/Toolbar/ToolbarButton/ToolbarButton.Constants.cs @@ -4,34 +4,34 @@ namespace Files.App.Controls { // TemplateParts - [TemplatePart( Name = ThemedIconPartName , Type = typeof( ThemedIcon ) )] - [TemplatePart( Name = ContentPresenterPartName , Type = typeof( ContentPresenter ) )] + [TemplatePart(Name = ThemedIconPartName, Type = typeof(ThemedIcon))] + [TemplatePart(Name = ContentPresenterPartName, Type = typeof(ContentPresenter))] // VisualStates - [TemplateVisualState( Name = NormalStateName , GroupName = CommonStatesGroupName )] - [TemplateVisualState( Name = PointerOverStateName , GroupName = CommonStatesGroupName )] - [TemplateVisualState( Name = PressedStateName , GroupName = CommonStatesGroupName )] - [TemplateVisualState( Name = DisabledStateName , GroupName = CommonStatesGroupName )] + [TemplateVisualState(Name = NormalStateName, GroupName = CommonStatesGroupName)] + [TemplateVisualState(Name = PointerOverStateName, GroupName = CommonStatesGroupName)] + [TemplateVisualState(Name = PressedStateName, GroupName = CommonStatesGroupName)] + [TemplateVisualState(Name = DisabledStateName, GroupName = CommonStatesGroupName)] - [TemplateVisualState( Name = HasContentStateName , GroupName = ContentStatesGroupName )] - [TemplateVisualState( Name = HasNoContentStateName , GroupName = ContentStatesGroupName )] + [TemplateVisualState(Name = HasContentStateName, GroupName = ContentStatesGroupName)] + [TemplateVisualState(Name = HasNoContentStateName, GroupName = ContentStatesGroupName)] public partial class ToolbarButton : Button, IToolbarItemSet { // TemplatePart Names - internal const string ThemedIconPartName = "PART_ThemedIcon"; - internal const string ContentPresenterPartName = "PART_ContentPresenter"; + internal const string ThemedIconPartName = "PART_ThemedIcon"; + internal const string ContentPresenterPartName = "PART_ContentPresenter"; // VisualState Group Names - internal const string CommonStatesGroupName = "CommonStates"; - internal const string ContentStatesGroupName = "ContentStates"; + internal const string CommonStatesGroupName = "CommonStates"; + internal const string ContentStatesGroupName = "ContentStates"; // VisualState Names - internal const string NormalStateName = "Normal"; - internal const string PointerOverStateName = "PointerOver"; - internal const string PressedStateName = "Pressed"; - internal const string DisabledStateName = "Disabled"; + internal const string NormalStateName = "Normal"; + internal const string PointerOverStateName = "PointerOver"; + internal const string PressedStateName = "Pressed"; + internal const string DisabledStateName = "Disabled"; - internal const string HasContentStateName = "HasContent"; - internal const string HasNoContentStateName = "HasNoContent"; + internal const string HasContentStateName = "HasContent"; + internal const string HasNoContentStateName = "HasNoContent"; } } diff --git a/src/Files.App.Controls/Toolbar/ToolbarButton/ToolbarButton.Properties.cs b/src/Files.App.Controls/Toolbar/ToolbarButton/ToolbarButton.Properties.cs index 0022f2961ec0..676376686533 100644 --- a/src/Files.App.Controls/Toolbar/ToolbarButton/ToolbarButton.Properties.cs +++ b/src/Files.App.Controls/Toolbar/ToolbarButton/ToolbarButton.Properties.cs @@ -24,17 +24,17 @@ public partial class ToolbarButton : Button, IToolbarItemSet /// public string Label { - get => (string)GetValue( LabelProperty ); - set => SetValue( LabelProperty , value ); + get => (string)GetValue(LabelProperty); + set => SetValue(LabelProperty, value); } - protected virtual void OnLabelPropertyChanged(string oldValue , string newValue) + protected virtual void OnLabelPropertyChanged(string oldValue, string newValue) { - if ( oldValue != newValue ) + if (oldValue != newValue) { - LabelChanged( newValue ); + LabelChanged(newValue); } } @@ -59,17 +59,17 @@ protected virtual void OnLabelPropertyChanged(string oldValue , string newValue) /// public Style ThemedIcon { - get => (Style)GetValue( ThemedIconProperty ); - set => SetValue( ThemedIconProperty , value ); + get => (Style)GetValue(ThemedIconProperty); + set => SetValue(ThemedIconProperty, value); } - protected virtual void OnThemedIconPropertyChanged(Style oldValue , Style newValue) + protected virtual void OnThemedIconPropertyChanged(Style oldValue, Style newValue) { - if ( newValue != oldValue ) + if (newValue != oldValue) { - ThemedIconChanged( newValue ); + ThemedIconChanged(newValue); } } @@ -91,17 +91,17 @@ protected virtual void OnThemedIconPropertyChanged(Style oldValue , Style newVal /// public double IconSize { - get => (double)GetValue( IconSizeProperty ); - set => SetValue( IconSizeProperty , value ); + get => (double)GetValue(IconSizeProperty); + set => SetValue(IconSizeProperty, value); } - protected virtual void OnIconSizePropertyChanged(double oldValue , double newValue) + protected virtual void OnIconSizePropertyChanged(double oldValue, double newValue) { - if ( newValue != oldValue ) + if (newValue != oldValue) { - IconSizeChanged( newValue ); + IconSizeChanged(newValue); } } @@ -110,12 +110,12 @@ protected virtual void OnIconSizePropertyChanged(double oldValue , double newVal #region ButtonBase Events /// - protected override void OnContentChanged(object oldContent , object newContent) + protected override void OnContentChanged(object oldContent, object newContent) { - if ( newContent != oldContent ) + if (newContent != oldContent) { - ContentChanged( newContent ); - base.OnContentChanged( oldContent , newContent ); + ContentChanged(newContent); + base.OnContentChanged(oldContent, newContent); } } diff --git a/src/Files.App.Controls/Toolbar/ToolbarButton/ToolbarButton.cs b/src/Files.App.Controls/Toolbar/ToolbarButton/ToolbarButton.cs index a2ed552682d7..5561c9ca41b7 100644 --- a/src/Files.App.Controls/Toolbar/ToolbarButton/ToolbarButton.cs +++ b/src/Files.App.Controls/Toolbar/ToolbarButton/ToolbarButton.cs @@ -10,17 +10,17 @@ public partial class ToolbarButton : Button, IToolbarItemSet public ToolbarButton() { - DefaultStyleKey = typeof( ToolbarButton ); + DefaultStyleKey = typeof(ToolbarButton); } /// protected override void OnApplyTemplate() { - RegisterPropertyChangedCallback( ContentProperty , OnContentChanged ); + RegisterPropertyChangedCallback(ContentProperty, OnContentChanged); base.OnApplyTemplate(); - UpdateContentStates( CheckHasContent() ); + UpdateContentStates(CheckHasContent()); } #region Private Getters @@ -59,7 +59,7 @@ private void UpdateLabel(string newLabel) private void UpdateContent(object newContent) { - if ( CheckHasContent() == false ) + if (CheckHasContent() == false) { // We clear the content } @@ -68,7 +68,7 @@ private void UpdateContent(object newContent) // We make sure the content displays } - UpdateContentStates( CheckHasContent() ); + UpdateContentStates(CheckHasContent()); } @@ -80,13 +80,13 @@ private void UpdateContent(object newContent) /// private void UpdateContentStates(bool hasContent) { - if ( hasContent ) + if (hasContent) { - VisualStateManager.GoToState( this , HasContentStateName , true ); + VisualStateManager.GoToState(this, HasContentStateName, true); } else { - VisualStateManager.GoToState( this , HasNoContentStateName , true ); + VisualStateManager.GoToState(this, HasNoContentStateName, true); } } @@ -128,7 +128,7 @@ private void UpdateIconSize(double newSize) /// private void LabelChanged(string newLabel) { - UpdateLabel( newLabel ); + UpdateLabel(newLabel); } @@ -139,7 +139,7 @@ private void LabelChanged(string newLabel) /// private void ThemedIconChanged(Style newStyle) { - UpdateThemedIcon( newStyle ); + UpdateThemedIcon(newStyle); } @@ -148,8 +148,8 @@ private void ThemedIconChanged(Style newStyle) /// /// private void IconSizeChanged(double newSize) - { - UpdateIconSize( newSize ); + { + UpdateIconSize(newSize); } #endregion @@ -163,16 +163,16 @@ private void IconSizeChanged(double newSize) /// private void ContentChanged(object newContent) { - if ( newContent != null ) + if (newContent != null) { - SetHasContent( true ); + SetHasContent(true); } - else + else { - SetHasContent( false ); + SetHasContent(false); } - UpdateContent( newContent ); + UpdateContent(newContent); } #endregion diff --git a/src/Files.App.Controls/Toolbar/ToolbarFlyoutButton/ToolbarFlyoutButton.cs b/src/Files.App.Controls/Toolbar/ToolbarFlyoutButton/ToolbarFlyoutButton.cs index 5517b8b76800..d0d159887861 100644 --- a/src/Files.App.Controls/Toolbar/ToolbarFlyoutButton/ToolbarFlyoutButton.cs +++ b/src/Files.App.Controls/Toolbar/ToolbarFlyoutButton/ToolbarFlyoutButton.cs @@ -7,7 +7,7 @@ public partial class ToolbarFlyoutButton : DropDownButton, IToolbarItemSet { public ToolbarFlyoutButton() { - this.DefaultStyleKey = typeof( ToolbarFlyoutButton ); + this.DefaultStyleKey = typeof(ToolbarFlyoutButton); } protected override void OnApplyTemplate() diff --git a/src/Files.App.Controls/Toolbar/ToolbarItem/ToolbarItem.Properties.cs b/src/Files.App.Controls/Toolbar/ToolbarItem/ToolbarItem.Properties.cs index cf710f2ea8ef..56a81de49cc3 100644 --- a/src/Files.App.Controls/Toolbar/ToolbarItem/ToolbarItem.Properties.cs +++ b/src/Files.App.Controls/Toolbar/ToolbarItem/ToolbarItem.Properties.cs @@ -2,7 +2,6 @@ // Licensed under the MIT License. using Microsoft.UI.Xaml.Input; -using Files.App.Controls.Primitives; namespace Files.App.Controls { @@ -27,17 +26,17 @@ public partial class ToolbarItem : DependencyObject /// public ToolbarItemTypes ItemType { - get => (ToolbarItemTypes)GetValue( ItemTypeProperty ); - set => SetValue( ItemTypeProperty , value ); + get => (ToolbarItemTypes)GetValue(ItemTypeProperty); + set => SetValue(ItemTypeProperty, value); } - protected virtual void OnItemTypePropertyChanged(ToolbarItemTypes oldValue , ToolbarItemTypes newValue) + protected virtual void OnItemTypePropertyChanged(ToolbarItemTypes oldValue, ToolbarItemTypes newValue) { - if ( oldValue != newValue ) + if (oldValue != newValue) { - ItemTypeChanged( newValue ); + ItemTypeChanged(newValue); } } @@ -62,17 +61,17 @@ protected virtual void OnItemTypePropertyChanged(ToolbarItemTypes oldValue , Too /// public OverflowBehaviors OverflowBehavior { - get => (OverflowBehaviors)GetValue( OverflowBehaviorProperty ); - set => SetValue( OverflowBehaviorProperty , value ); + get => (OverflowBehaviors)GetValue(OverflowBehaviorProperty); + set => SetValue(OverflowBehaviorProperty, value); } - protected virtual void OnOverflowBehaviorPropertyChanged(OverflowBehaviors oldValue , OverflowBehaviors newValue) + protected virtual void OnOverflowBehaviorPropertyChanged(OverflowBehaviors oldValue, OverflowBehaviors newValue) { - if ( newValue != oldValue ) + if (newValue != oldValue) { - OverflowBehaviorChanged( newValue ); + OverflowBehaviorChanged(newValue); } } @@ -97,17 +96,17 @@ protected virtual void OnOverflowBehaviorPropertyChanged(OverflowBehaviors oldVa /// public string Label { - get => (string)GetValue( LabelProperty ); - set => SetValue( LabelProperty , value ); + get => (string)GetValue(LabelProperty); + set => SetValue(LabelProperty, value); } - protected virtual void OnLabelPropertyChanged(string oldValue , string newValue) + protected virtual void OnLabelPropertyChanged(string oldValue, string newValue) { - if ( newValue != oldValue ) - { - LabelChanged( newValue ); + if (newValue != oldValue) + { + LabelChanged(newValue); } } @@ -117,26 +116,26 @@ protected virtual void OnLabelPropertyChanged(string oldValue , string newValue) public static readonly DependencyProperty SubItemsProperty = DependencyProperty.Register( - nameof( SubItems ), - typeof( IList ), + nameof(SubItems), + typeof(IList), typeof(ToolbarItem), - new PropertyMetadata( new List(), (d, e) => ((ToolbarItem)d).OnSubItemsPropertyChanged(( IList )e.OldValue, ( IList )e.NewValue))); + new PropertyMetadata(new List(), (d, e) => ((ToolbarItem)d).OnSubItemsPropertyChanged((IList)e.OldValue, (IList)e.NewValue))); public IList SubItems { - get => (IList)GetValue( SubItemsProperty ); - set => SetValue( SubItemsProperty , value ); + get => (IList)GetValue(SubItemsProperty); + set => SetValue(SubItemsProperty, value); } - protected virtual void OnSubItemsPropertyChanged(IList oldItems , IList newItems) + protected virtual void OnSubItemsPropertyChanged(IList oldItems, IList newItems) { - if ( newItems != oldItems ) + if (newItems != oldItems) { - SubItemsChanged( newItems ); + SubItemsChanged(newItems); } } @@ -161,17 +160,17 @@ protected virtual void OnSubItemsPropertyChanged(IList oldItems , I /// public object Content { - get => (object)GetValue( ContentProperty ); - set => SetValue( ContentProperty , value ); + get => (object)GetValue(ContentProperty); + set => SetValue(ContentProperty, value); } - protected virtual void OnContentPropertyChanged(object oldValue , object newValue) + protected virtual void OnContentPropertyChanged(object oldValue, object newValue) { - if ( newValue != oldValue ) + if (newValue != oldValue) { - ContentChanged( newValue ); + ContentChanged(newValue); } } @@ -196,17 +195,17 @@ protected virtual void OnContentPropertyChanged(object oldValue , object newValu /// public Style ThemedIcon { - get => (Style)GetValue( ThemedIconProperty ); - set => SetValue( ThemedIconProperty , value ); + get => (Style)GetValue(ThemedIconProperty); + set => SetValue(ThemedIconProperty, value); } - protected virtual void OnThemedIconPropertyChanged(Style oldValue , Style newValue) + protected virtual void OnThemedIconPropertyChanged(Style oldValue, Style newValue) { - if ( newValue != oldValue ) + if (newValue != oldValue) { - ThemedIconChanged( newValue ); + ThemedIconChanged(newValue); } } @@ -228,17 +227,17 @@ protected virtual void OnThemedIconPropertyChanged(Style oldValue , Style newVal /// public double IconSize { - get => (double)GetValue( IconSizeProperty ); - set => SetValue( IconSizeProperty , value ); + get => (double)GetValue(IconSizeProperty); + set => SetValue(IconSizeProperty, value); } - protected virtual void OnIconSizePropertyChanged(double oldValue , double newValue) + protected virtual void OnIconSizePropertyChanged(double oldValue, double newValue) { - if ( newValue != oldValue ) + if (newValue != oldValue) { - IconSizeChanged( newValue ); + IconSizeChanged(newValue); } } @@ -263,17 +262,17 @@ protected virtual void OnIconSizePropertyChanged(double oldValue , double newVal /// public bool IsChecked { - get => (bool)GetValue( IsCheckedProperty ); - set => SetValue( IsCheckedProperty , value ); + get => (bool)GetValue(IsCheckedProperty); + set => SetValue(IsCheckedProperty, value); } - protected virtual void OnIsCheckedPropertyChanged(bool oldValue , bool newValue) + protected virtual void OnIsCheckedPropertyChanged(bool oldValue, bool newValue) { - if ( newValue != oldValue ) + if (newValue != oldValue) { - IsCheckedChanged( newValue ); + IsCheckedChanged(newValue); } } @@ -298,17 +297,17 @@ protected virtual void OnIsCheckedPropertyChanged(bool oldValue , bool newValue) /// public string KeyboardAcceleratorTextOverride { - get => (string)GetValue( KeyboardAcceleratorTextOverrideProperty ); - set => SetValue( KeyboardAcceleratorTextOverrideProperty , value ); + get => (string)GetValue(KeyboardAcceleratorTextOverrideProperty); + set => SetValue(KeyboardAcceleratorTextOverrideProperty, value); } - protected virtual void OnKeyboardAcceleratorTextOverridePropertyChanged(string oldValue , string newValue) + protected virtual void OnKeyboardAcceleratorTextOverridePropertyChanged(string oldValue, string newValue) { - if ( newValue != oldValue ) + if (newValue != oldValue) { - KeyboardAcceleratorTextOverrideChanged( newValue ); + KeyboardAcceleratorTextOverrideChanged(newValue); } } @@ -333,17 +332,17 @@ protected virtual void OnKeyboardAcceleratorTextOverridePropertyChanged(string o /// public string GroupName { - get => (string)GetValue( GroupNameProperty ); - set => SetValue( GroupNameProperty , value ); + get => (string)GetValue(GroupNameProperty); + set => SetValue(GroupNameProperty, value); } - protected virtual void OnGroupNamePropertyChanged(string oldValue , string newValue) + protected virtual void OnGroupNamePropertyChanged(string oldValue, string newValue) { - if ( newValue != oldValue ) + if (newValue != oldValue) { - GroupNameChanged( newValue ); + GroupNameChanged(newValue); } } @@ -368,17 +367,17 @@ protected virtual void OnGroupNamePropertyChanged(string oldValue , string newVa /// public XamlUICommand Command { - get => (XamlUICommand)GetValue( CommandProperty ); - set => SetValue( CommandProperty , value ); + get => (XamlUICommand)GetValue(CommandProperty); + set => SetValue(CommandProperty, value); } - protected virtual void OnCommandPropertyChanged(XamlUICommand oldValue , XamlUICommand newValue) + protected virtual void OnCommandPropertyChanged(XamlUICommand oldValue, XamlUICommand newValue) { - if ( newValue != oldValue ) + if (newValue != oldValue) { - CommandChanged( newValue ); + CommandChanged(newValue); } } @@ -403,17 +402,17 @@ protected virtual void OnCommandPropertyChanged(XamlUICommand oldValue , XamlUIC /// public object CommandParameter { - get => (object)GetValue( CommandParameterProperty ); - set => SetValue( CommandParameterProperty , value ); + get => (object)GetValue(CommandParameterProperty); + set => SetValue(CommandParameterProperty, value); } - protected virtual void OnCommandParameterPropertyChanged(object oldValue , object newValue) + protected virtual void OnCommandParameterPropertyChanged(object oldValue, object newValue) { - if ( newValue != oldValue ) + if (newValue != oldValue) { - CommandParameterChanged( newValue ); + CommandParameterChanged(newValue); } } diff --git a/src/Files.App.Controls/Toolbar/ToolbarItem/ToolbarItem.cs b/src/Files.App.Controls/Toolbar/ToolbarItem/ToolbarItem.cs index 5e8bdb6421ec..6709a474c8eb 100644 --- a/src/Files.App.Controls/Toolbar/ToolbarItem/ToolbarItem.cs +++ b/src/Files.App.Controls/Toolbar/ToolbarItem/ToolbarItem.cs @@ -1,7 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using Files.App.Controls.Primitives; using Microsoft.UI.Xaml.Input; namespace Files.App.Controls @@ -13,7 +12,7 @@ namespace Files.App.Controls /// public partial class ToolbarItem : DependencyObject { - # region Update Item Properties + #region Update Item Properties private void UpdateItemType(ToolbarItemTypes newItemType) { @@ -54,7 +53,7 @@ private void UpdateItemType(ToolbarItemTypes newItemType) private void UpdateLabel(string newLabel) - { + { /// /// Updates the internal item's Text or Label /// property as it changes. @@ -68,7 +67,7 @@ private void UpdateLabel(string newLabel) /// /// private void UpdateSubItems(IList newItems) - { + { } @@ -198,21 +197,21 @@ private void UpdateIsChecked(bool isChecked) private void ItemTypeChanged(ToolbarItemTypes newItemType) { - UpdateItemType( newItemType ); + UpdateItemType(newItemType); } private void OverflowBehaviorChanged(OverflowBehaviors newOverflowBehavior) { - UpdateOverflowBehavior( newOverflowBehavior ); + UpdateOverflowBehavior(newOverflowBehavior); } - private void LabelChanged(string newLabel) + private void LabelChanged(string newLabel) { - UpdateLabel( newLabel ); + UpdateLabel(newLabel); } @@ -224,49 +223,49 @@ private void LabelChanged(string newLabel) /// private void SubItemsChanged(IList newItems) { - UpdateSubItems( newItems ); + UpdateSubItems(newItems); } - private void ContentChanged(object newContent) + private void ContentChanged(object newContent) { - UpdateContent( newContent ); + UpdateContent(newContent); } private void ThemedIconChanged(Style newStyle) { - UpdateThemedIcon( newStyle ); + UpdateThemedIcon(newStyle); } - private void KeyboardAcceleratorTextOverrideChanged( string newKeyboardAcceleratorText) + private void KeyboardAcceleratorTextOverrideChanged(string newKeyboardAcceleratorText) { - UpdateKeyboardAcceleratorTextOverride( newKeyboardAcceleratorText ); + UpdateKeyboardAcceleratorTextOverride(newKeyboardAcceleratorText); } private void GroupNameChanged(string newGroupName) { - UpdateGroupName( newGroupName ); + UpdateGroupName(newGroupName); } private void CommandChanged(XamlUICommand newCommand) { - UpdateCommand( newCommand ); + UpdateCommand(newCommand); } private void CommandParameterChanged(object newCommandParameter) { - UpdateCommandParameter( newCommandParameter ); + UpdateCommandParameter(newCommandParameter); } @@ -276,7 +275,7 @@ private void CommandParameterChanged(object newCommandParameter) /// private void IconSizeChanged(double newSize) { - UpdateIconSize( newSize ); + UpdateIconSize(newSize); } @@ -286,7 +285,7 @@ private void IconSizeChanged(double newSize) /// private void IsCheckedChanged(bool isChecked) { - UpdateIsChecked( isChecked ); + UpdateIsChecked(isChecked); } #endregion diff --git a/src/Files.App.Controls/Toolbar/ToolbarRadioButton/ToolbarRadioButton.cs b/src/Files.App.Controls/Toolbar/ToolbarRadioButton/ToolbarRadioButton.cs index 5e111a32d64b..7760b0b869fc 100644 --- a/src/Files.App.Controls/Toolbar/ToolbarRadioButton/ToolbarRadioButton.cs +++ b/src/Files.App.Controls/Toolbar/ToolbarRadioButton/ToolbarRadioButton.cs @@ -7,7 +7,7 @@ public partial class ToolbarRadioButton : RadioButton, IToolbarItemSet { public ToolbarRadioButton() { - DefaultStyleKey = typeof( ToolbarRadioButton ); + DefaultStyleKey = typeof(ToolbarRadioButton); } protected override void OnApplyTemplate() diff --git a/src/Files.App.Controls/Toolbar/ToolbarSeparator/ToolbarSeparator.cs b/src/Files.App.Controls/Toolbar/ToolbarSeparator/ToolbarSeparator.cs index 7cd4d57acf0f..b8d7290522e3 100644 --- a/src/Files.App.Controls/Toolbar/ToolbarSeparator/ToolbarSeparator.cs +++ b/src/Files.App.Controls/Toolbar/ToolbarSeparator/ToolbarSeparator.cs @@ -3,7 +3,7 @@ namespace Files.App.Controls { - public partial class ToolbarSeparator : Control , IToolbarItemSet + public partial class ToolbarSeparator : Control, IToolbarItemSet { public ToolbarSeparator() { diff --git a/src/Files.App.Controls/Toolbar/ToolbarToggleButton/ToolbarToggleButton.Constants.cs b/src/Files.App.Controls/Toolbar/ToolbarToggleButton/ToolbarToggleButton.Constants.cs index d6c974aff5eb..4e05ae5d6156 100644 --- a/src/Files.App.Controls/Toolbar/ToolbarToggleButton/ToolbarToggleButton.Constants.cs +++ b/src/Files.App.Controls/Toolbar/ToolbarToggleButton/ToolbarToggleButton.Constants.cs @@ -4,54 +4,54 @@ namespace Files.App.Controls { // TemplateParts - [TemplatePart( Name = ThemedIconPartName , Type = typeof( ThemedIcon ) )] - [TemplatePart( Name = ContentPresenterPartName , Type = typeof( ContentPresenter ) )] + [TemplatePart(Name = ThemedIconPartName, Type = typeof(ThemedIcon))] + [TemplatePart(Name = ContentPresenterPartName, Type = typeof(ContentPresenter))] // VisualStates - [TemplateVisualState( Name = NormalStateName , GroupName = CommonStatesGroupName )] - [TemplateVisualState( Name = PointerOverStateName , GroupName = CommonStatesGroupName )] - [TemplateVisualState( Name = PressedStateName , GroupName = CommonStatesGroupName )] - [TemplateVisualState( Name = DisabledStateName , GroupName = CommonStatesGroupName )] - - [TemplateVisualState( Name = CheckedStateName , GroupName = CommonStatesGroupName )] - [TemplateVisualState( Name = CheckedPointerOverStateName , GroupName = CommonStatesGroupName )] - [TemplateVisualState( Name = CheckedPressedStateName , GroupName = CommonStatesGroupName )] - [TemplateVisualState( Name = CheckedDisabledStateName , GroupName = CommonStatesGroupName )] - - [TemplateVisualState( Name = IndeterminateStateName , GroupName = CommonStatesGroupName )] - [TemplateVisualState( Name = IndeterminatePointerOverStateName , GroupName = CommonStatesGroupName )] - [TemplateVisualState( Name = IndeterminatePressedStateName , GroupName = CommonStatesGroupName )] - [TemplateVisualState( Name = IndeterminateDisabledStateName , GroupName = CommonStatesGroupName )] - - [TemplateVisualState( Name = HasContentStateName , GroupName = ContentStatesGroupName )] - [TemplateVisualState( Name = HasNoContentStateName , GroupName = ContentStatesGroupName )] + [TemplateVisualState(Name = NormalStateName, GroupName = CommonStatesGroupName)] + [TemplateVisualState(Name = PointerOverStateName, GroupName = CommonStatesGroupName)] + [TemplateVisualState(Name = PressedStateName, GroupName = CommonStatesGroupName)] + [TemplateVisualState(Name = DisabledStateName, GroupName = CommonStatesGroupName)] + + [TemplateVisualState(Name = CheckedStateName, GroupName = CommonStatesGroupName)] + [TemplateVisualState(Name = CheckedPointerOverStateName, GroupName = CommonStatesGroupName)] + [TemplateVisualState(Name = CheckedPressedStateName, GroupName = CommonStatesGroupName)] + [TemplateVisualState(Name = CheckedDisabledStateName, GroupName = CommonStatesGroupName)] + + [TemplateVisualState(Name = IndeterminateStateName, GroupName = CommonStatesGroupName)] + [TemplateVisualState(Name = IndeterminatePointerOverStateName, GroupName = CommonStatesGroupName)] + [TemplateVisualState(Name = IndeterminatePressedStateName, GroupName = CommonStatesGroupName)] + [TemplateVisualState(Name = IndeterminateDisabledStateName, GroupName = CommonStatesGroupName)] + + [TemplateVisualState(Name = HasContentStateName, GroupName = ContentStatesGroupName)] + [TemplateVisualState(Name = HasNoContentStateName, GroupName = ContentStatesGroupName)] public partial class ToolbarToggleButton : ToggleButton, IToolbarItemSet { // TemplatePart Names - internal const string ThemedIconPartName = "PART_ThemedIcon"; - internal const string ContentPresenterPartName = "PART_ContentPresenter"; + internal const string ThemedIconPartName = "PART_ThemedIcon"; + internal const string ContentPresenterPartName = "PART_ContentPresenter"; // VisualState Group Names - internal const string CommonStatesGroupName = "CommonStates"; - internal const string ContentStatesGroupName = "ContentStates"; + internal const string CommonStatesGroupName = "CommonStates"; + internal const string ContentStatesGroupName = "ContentStates"; // VisualState Names - internal const string NormalStateName = "Normal"; - internal const string PointerOverStateName = "PointerOver"; - internal const string PressedStateName = "Pressed"; - internal const string DisabledStateName = "Disabled"; - - internal const string CheckedStateName = "Checked"; - internal const string CheckedPointerOverStateName = "CheckedPointerOver"; - internal const string CheckedPressedStateName = "CheckedPressed"; - internal const string CheckedDisabledStateName = "CheckedDisabled"; - - internal const string IndeterminateStateName = "Indeterminate"; - internal const string IndeterminatePointerOverStateName = "IndeterminatePointerOver"; - internal const string IndeterminatePressedStateName = "IndeterminatePressed"; - internal const string IndeterminateDisabledStateName = "IndeterminateDisabled"; - - internal const string HasContentStateName = "HasContent"; - internal const string HasNoContentStateName = "HasNoContent"; + internal const string NormalStateName = "Normal"; + internal const string PointerOverStateName = "PointerOver"; + internal const string PressedStateName = "Pressed"; + internal const string DisabledStateName = "Disabled"; + + internal const string CheckedStateName = "Checked"; + internal const string CheckedPointerOverStateName = "CheckedPointerOver"; + internal const string CheckedPressedStateName = "CheckedPressed"; + internal const string CheckedDisabledStateName = "CheckedDisabled"; + + internal const string IndeterminateStateName = "Indeterminate"; + internal const string IndeterminatePointerOverStateName = "IndeterminatePointerOver"; + internal const string IndeterminatePressedStateName = "IndeterminatePressed"; + internal const string IndeterminateDisabledStateName = "IndeterminateDisabled"; + + internal const string HasContentStateName = "HasContent"; + internal const string HasNoContentStateName = "HasNoContent"; } } diff --git a/src/Files.App.Controls/Toolbar/ToolbarToggleButton/ToolbarToggleButton.Properties.cs b/src/Files.App.Controls/Toolbar/ToolbarToggleButton/ToolbarToggleButton.Properties.cs index c0bb0a69c300..1cc13e6bfc52 100644 --- a/src/Files.App.Controls/Toolbar/ToolbarToggleButton/ToolbarToggleButton.Properties.cs +++ b/src/Files.App.Controls/Toolbar/ToolbarToggleButton/ToolbarToggleButton.Properties.cs @@ -24,17 +24,17 @@ public partial class ToolbarToggleButton : ToggleButton, IToolbarItemSet /// public string Label { - get => (string)GetValue( LabelProperty ); - set => SetValue( LabelProperty , value ); + get => (string)GetValue(LabelProperty); + set => SetValue(LabelProperty, value); } - protected virtual void OnLabelPropertyChanged(string oldValue , string newValue) + protected virtual void OnLabelPropertyChanged(string oldValue, string newValue) { - if ( oldValue != newValue ) + if (oldValue != newValue) { - LabelChanged( newValue ); + LabelChanged(newValue); } } @@ -59,17 +59,17 @@ protected virtual void OnLabelPropertyChanged(string oldValue , string newValue) /// public Style ThemedIcon { - get => (Style)GetValue( ThemedIconProperty ); - set => SetValue( ThemedIconProperty , value ); + get => (Style)GetValue(ThemedIconProperty); + set => SetValue(ThemedIconProperty, value); } - protected virtual void OnThemedIconPropertyChanged(Style oldValue , Style newValue) + protected virtual void OnThemedIconPropertyChanged(Style oldValue, Style newValue) { - if ( newValue != oldValue ) + if (newValue != oldValue) { - ThemedIconChanged( newValue ); + ThemedIconChanged(newValue); } } @@ -91,17 +91,17 @@ protected virtual void OnThemedIconPropertyChanged(Style oldValue , Style newVal /// public double IconSize { - get => (double)GetValue( IconSizeProperty ); - set => SetValue( IconSizeProperty , value ); + get => (double)GetValue(IconSizeProperty); + set => SetValue(IconSizeProperty, value); } - protected virtual void OnIconSizePropertyChanged(double oldValue , double newValue) + protected virtual void OnIconSizePropertyChanged(double oldValue, double newValue) { - if ( newValue != oldValue ) + if (newValue != oldValue) { - IconSizeChanged( newValue ); + IconSizeChanged(newValue); } } @@ -110,12 +110,12 @@ protected virtual void OnIconSizePropertyChanged(double oldValue , double newVal #region ButtonBase Events /// - protected override void OnContentChanged(object oldContent , object newContent) + protected override void OnContentChanged(object oldContent, object newContent) { - if ( newContent != oldContent ) + if (newContent != oldContent) { - ContentChanged( newContent ); - base.OnContentChanged( oldContent , newContent ); + ContentChanged(newContent); + base.OnContentChanged(oldContent, newContent); } } diff --git a/src/Files.App.Controls/Toolbar/ToolbarToggleButton/ToolbarToggleButton.cs b/src/Files.App.Controls/Toolbar/ToolbarToggleButton/ToolbarToggleButton.cs index a7331e6954f3..d31356e8a6d6 100644 --- a/src/Files.App.Controls/Toolbar/ToolbarToggleButton/ToolbarToggleButton.cs +++ b/src/Files.App.Controls/Toolbar/ToolbarToggleButton/ToolbarToggleButton.cs @@ -10,16 +10,16 @@ public partial class ToolbarToggleButton : ToggleButton, IToolbarItemSet public ToolbarToggleButton() { - DefaultStyleKey = typeof( ToolbarToggleButton ); + DefaultStyleKey = typeof(ToolbarToggleButton); } protected override void OnApplyTemplate() { - RegisterPropertyChangedCallback( ContentProperty , OnContentChanged ); + RegisterPropertyChangedCallback(ContentProperty, OnContentChanged); base.OnApplyTemplate(); - UpdateContentStates( CheckHasContent() ); + UpdateContentStates(CheckHasContent()); } #region Private Getters @@ -58,7 +58,7 @@ private void UpdateLabel(string newLabel) private void UpdateContent(object newContent) { - if ( CheckHasContent() == false ) + if (CheckHasContent() == false) { // We clear the content } @@ -67,7 +67,7 @@ private void UpdateContent(object newContent) // We make sure the content displays } - UpdateContentStates( CheckHasContent() ); + UpdateContentStates(CheckHasContent()); } @@ -79,13 +79,13 @@ private void UpdateContent(object newContent) /// private void UpdateContentStates(bool hasContent) { - if ( hasContent ) + if (hasContent) { - VisualStateManager.GoToState( this , HasContentStateName , true ); + VisualStateManager.GoToState(this, HasContentStateName, true); } else { - VisualStateManager.GoToState( this , HasNoContentStateName , true ); + VisualStateManager.GoToState(this, HasNoContentStateName, true); } } @@ -127,7 +127,7 @@ private void UpdateIconSize(double newSize) /// private void LabelChanged(string newLabel) { - UpdateLabel( newLabel ); + UpdateLabel(newLabel); } @@ -138,7 +138,7 @@ private void LabelChanged(string newLabel) /// private void ThemedIconChanged(Style newStyle) { - UpdateThemedIcon( newStyle ); + UpdateThemedIcon(newStyle); } @@ -149,7 +149,7 @@ private void ThemedIconChanged(Style newStyle) /// private void IconSizeChanged(double newSize) { - UpdateIconSize( newSize ); + UpdateIconSize(newSize); } #endregion @@ -163,16 +163,16 @@ private void IconSizeChanged(double newSize) /// private void ContentChanged(object newContent) { - if ( newContent != null ) + if (newContent != null) { - SetHasContent( true ); + SetHasContent(true); } else { - SetHasContent( false ); + SetHasContent(false); } - UpdateContent( newContent ); + UpdateContent(newContent); } #endregion diff --git a/src/Files.App.CsWin32/ComHeapPtr`1.cs b/src/Files.App.CsWin32/ComHeapPtr`1.cs index ff63a40942fa..2bf4fa41c642 100644 --- a/src/Files.App.CsWin32/ComHeapPtr`1.cs +++ b/src/Files.App.CsWin32/ComHeapPtr`1.cs @@ -3,8 +3,6 @@ using System; using System.Runtime.CompilerServices; -using Windows.Win32; -using Windows.Win32.System.Com; namespace Windows.Win32 { diff --git a/src/Files.App.CsWin32/ComPtr`1.cs b/src/Files.App.CsWin32/ComPtr`1.cs index 6ceb19067cf8..2cceed532893 100644 --- a/src/Files.App.CsWin32/ComPtr`1.cs +++ b/src/Files.App.CsWin32/ComPtr`1.cs @@ -3,10 +3,8 @@ using System; using System.Runtime.CompilerServices; -using Windows.Win32; using Windows.Win32.Foundation; using Windows.Win32.System.Com; -using Windows.Win32.System.WinRT; namespace Windows.Win32 { diff --git a/src/Files.App.CsWin32/IStorageProviderQuotaUI.cs b/src/Files.App.CsWin32/IStorageProviderQuotaUI.cs index 04c6741412a7..20f9dc08d55b 100644 --- a/src/Files.App.CsWin32/IStorageProviderQuotaUI.cs +++ b/src/Files.App.CsWin32/IStorageProviderQuotaUI.cs @@ -2,9 +2,7 @@ // Licensed under the MIT License. using System; -using System.Diagnostics; using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; using Windows.Win32.Foundation; namespace Windows.Win32.System.WinRT diff --git a/src/Files.App.CsWin32/IStorageProviderStatusUI.cs b/src/Files.App.CsWin32/IStorageProviderStatusUI.cs index 913bbc852e5e..1d778bc008ea 100644 --- a/src/Files.App.CsWin32/IStorageProviderStatusUI.cs +++ b/src/Files.App.CsWin32/IStorageProviderStatusUI.cs @@ -2,9 +2,7 @@ // Licensed under the MIT License. using System; -using System.Diagnostics; using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; using Windows.Win32.Foundation; namespace Windows.Win32.System.WinRT diff --git a/src/Files.App.CsWin32/IStorageProviderStatusUISource.cs b/src/Files.App.CsWin32/IStorageProviderStatusUISource.cs index f0d96390f204..caf7aa291bf3 100644 --- a/src/Files.App.CsWin32/IStorageProviderStatusUISource.cs +++ b/src/Files.App.CsWin32/IStorageProviderStatusUISource.cs @@ -2,9 +2,7 @@ // Licensed under the MIT License. using System; -using System.Diagnostics; using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; using Windows.Win32.Foundation; namespace Windows.Win32.System.WinRT diff --git a/src/Files.App.CsWin32/IStorageProviderStatusUISourceFactory.cs b/src/Files.App.CsWin32/IStorageProviderStatusUISourceFactory.cs index cca56098e7f1..9ab9495766d7 100644 --- a/src/Files.App.CsWin32/IStorageProviderStatusUISourceFactory.cs +++ b/src/Files.App.CsWin32/IStorageProviderStatusUISourceFactory.cs @@ -2,9 +2,7 @@ // Licensed under the MIT License. using System; -using System.Diagnostics; using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; using Windows.Win32.Foundation; namespace Windows.Win32.System.WinRT diff --git a/src/Files.App.Storage/GlobalUsings.cs b/src/Files.App.Storage/GlobalUsings.cs index 24e1a2323cd6..8fa89979a935 100644 --- a/src/Files.App.Storage/GlobalUsings.cs +++ b/src/Files.App.Storage/GlobalUsings.cs @@ -1,4 +1,4 @@ -// Copyright (c) Files Community +// Copyright (c) Files Community // Licensed under the MIT License. // System diff --git a/src/Files.App.Storage/Storables/FtpStorage/FtpStorable.cs b/src/Files.App.Storage/Storables/FtpStorage/FtpStorable.cs index 7987071dab29..3d927df0de68 100644 --- a/src/Files.App.Storage/Storables/FtpStorage/FtpStorable.cs +++ b/src/Files.App.Storage/Storables/FtpStorage/FtpStorable.cs @@ -16,7 +16,7 @@ public abstract class FtpStorable : IStorableChild /// /// Gets the parent folder of the storable, if any. /// - protected virtual IFolder? Parent { get; } + protected virtual IFolder? Parent { get; } protected internal FtpStorable(string path, string name, IFolder? parent) { diff --git a/src/Files.App.Storage/Storables/WindowsStorage/IFolderSettings.cs b/src/Files.App.Storage/Storables/WindowsStorage/IFolderSettings.cs index 2fd4cfbcafa8..55a16c37bc58 100644 --- a/src/Files.App.Storage/Storables/WindowsStorage/IFolderSettings.cs +++ b/src/Files.App.Storage/Storables/WindowsStorage/IFolderSettings.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Files.App.Storage +namespace Files.App.Storage { public interface IFolderSettings { diff --git a/src/Files.App.Storage/Storables/WindowsStorage/JumpListDestinationType.cs b/src/Files.App.Storage/Storables/WindowsStorage/JumpListDestinationType.cs index e176cc787ea2..b811e47d0625 100644 --- a/src/Files.App.Storage/Storables/WindowsStorage/JumpListDestinationType.cs +++ b/src/Files.App.Storage/Storables/WindowsStorage/JumpListDestinationType.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Files.App.Storage +namespace Files.App.Storage { public enum JumpListDestinationType { diff --git a/src/Files.App.Storage/Storables/WindowsStorage/JumpListManager.cs b/src/Files.App.Storage/Storables/WindowsStorage/JumpListManager.cs index 1f239a8ea144..ddee40eb69d4 100644 --- a/src/Files.App.Storage/Storables/WindowsStorage/JumpListManager.cs +++ b/src/Files.App.Storage/Storables/WindowsStorage/JumpListManager.cs @@ -1,13 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using System.Collections.Concurrent; -using Windows.Win32; -using Windows.Win32.Foundation; -using Windows.Win32.System.Com; -using Windows.Win32.UI.Shell; -using Windows.Win32.UI.Shell.Common; - namespace Files.App.Storage { public unsafe class JumpListManager : IDisposable diff --git a/src/Files.App.Storage/Storables/WindowsStorage/WindowsFile.cs b/src/Files.App.Storage/Storables/WindowsStorage/WindowsFile.cs index 93362f26a7e9..ef4b7d85d24b 100644 --- a/src/Files.App.Storage/Storables/WindowsStorage/WindowsFile.cs +++ b/src/Files.App.Storage/Storables/WindowsStorage/WindowsFile.cs @@ -2,7 +2,6 @@ // Licensed under the MIT License. using System.IO; -using Windows.Win32; using Windows.Win32.UI.Shell; namespace Files.App.Storage diff --git a/src/Files.App.Storage/Storables/WindowsStorage/WindowsStorableHelpers.PowerShell.cs b/src/Files.App.Storage/Storables/WindowsStorage/WindowsStorableHelpers.PowerShell.cs index fcc3da01b630..ec3204a12141 100644 --- a/src/Files.App.Storage/Storables/WindowsStorage/WindowsStorableHelpers.PowerShell.cs +++ b/src/Files.App.Storage/Storables/WindowsStorage/WindowsStorableHelpers.PowerShell.cs @@ -7,7 +7,7 @@ public static partial class WindowsStorableHelpers { public static async Task TrySetShortcutIconOnPowerShellAsElevatedAsync(this IWindowsStorable storable, IWindowsStorable iconFile, int index) { - string psScript = + string psScript = $@"$FilePath = '{storable}' $IconFile = '{iconFile}' $IconIndex = '{index}' diff --git a/src/Files.App.Storage/Storables/WindowsStorage/WindowsStorableHelpers.Process.cs b/src/Files.App.Storage/Storables/WindowsStorage/WindowsStorableHelpers.Process.cs index 724434b5f082..aa3948a27e7d 100644 --- a/src/Files.App.Storage/Storables/WindowsStorage/WindowsStorableHelpers.Process.cs +++ b/src/Files.App.Storage/Storables/WindowsStorage/WindowsStorableHelpers.Process.cs @@ -2,7 +2,6 @@ // Licensed under the MIT License. using Windows.Win32; -using Windows.Win32.Foundation; using Windows.Win32.System.SystemInformation; namespace Files.App.Storage diff --git a/src/Files.App/Actions/Content/Archives/Decompress/BaseDecompressArchiveAction.cs b/src/Files.App/Actions/Content/Archives/Decompress/BaseDecompressArchiveAction.cs index f399becaf2e5..1c630e6d0d62 100644 --- a/src/Files.App/Actions/Content/Archives/Decompress/BaseDecompressArchiveAction.cs +++ b/src/Files.App/Actions/Content/Archives/Decompress/BaseDecompressArchiveAction.cs @@ -4,7 +4,6 @@ using Files.App.Dialogs; using Microsoft.UI.Xaml.Controls; using SevenZip; -using System.Diagnostics.CodeAnalysis; using System.Text; using Windows.Foundation.Metadata; using Windows.Storage; diff --git a/src/Files.App/Actions/Content/Background/SetAsLockscreenBackgroundAction.cs b/src/Files.App/Actions/Content/Background/SetAsLockscreenBackgroundAction.cs index 5723e4a4e1b6..79b6e48868b4 100644 --- a/src/Files.App/Actions/Content/Background/SetAsLockscreenBackgroundAction.cs +++ b/src/Files.App/Actions/Content/Background/SetAsLockscreenBackgroundAction.cs @@ -1,8 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using Microsoft.Extensions.Logging; - namespace Files.App.Actions { internal sealed partial class SetAsLockscreenBackgroundAction : BaseSetAsAction diff --git a/src/Files.App/Actions/Content/Background/SetAsSlideshowBackgroundAction.cs b/src/Files.App/Actions/Content/Background/SetAsSlideshowBackgroundAction.cs index a903222eac62..f98ea84becad 100644 --- a/src/Files.App/Actions/Content/Background/SetAsSlideshowBackgroundAction.cs +++ b/src/Files.App/Actions/Content/Background/SetAsSlideshowBackgroundAction.cs @@ -1,8 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using Microsoft.Extensions.Logging; - namespace Files.App.Actions { internal sealed partial class SetAsSlideshowBackgroundAction : BaseSetAsAction diff --git a/src/Files.App/Actions/Content/Background/SetAsWallpaperBackgroundAction.cs b/src/Files.App/Actions/Content/Background/SetAsWallpaperBackgroundAction.cs index 01e4775cdd31..b8c23e4294df 100644 --- a/src/Files.App/Actions/Content/Background/SetAsWallpaperBackgroundAction.cs +++ b/src/Files.App/Actions/Content/Background/SetAsWallpaperBackgroundAction.cs @@ -1,8 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using Microsoft.Extensions.Logging; - namespace Files.App.Actions { internal sealed partial class SetAsWallpaperBackgroundAction : BaseSetAsAction diff --git a/src/Files.App/Actions/Content/Install/InstallInfDriverAction.cs b/src/Files.App/Actions/Content/Install/InstallInfDriverAction.cs index ac9bebad3c74..766b6b8df25f 100644 --- a/src/Files.App/Actions/Content/Install/InstallInfDriverAction.cs +++ b/src/Files.App/Actions/Content/Install/InstallInfDriverAction.cs @@ -11,7 +11,7 @@ internal sealed partial class InstallInfDriverAction : ObservableObject, IAction public string Label => Strings.InstallDriver.GetLocalizedResource(); - + public string Description => Strings.InstallInfDriverDescription.GetLocalizedFormatResource(context.SelectedItems.Count); diff --git a/src/Files.App/Actions/Content/Tags/OpenAllTaggedActions.cs b/src/Files.App/Actions/Content/Tags/OpenAllTaggedActions.cs index e6492509db41..16e6fe0c5b4f 100644 --- a/src/Files.App/Actions/Content/Tags/OpenAllTaggedActions.cs +++ b/src/Files.App/Actions/Content/Tags/OpenAllTaggedActions.cs @@ -3,8 +3,8 @@ namespace Files.App.Actions { - sealed partial class OpenAllTaggedActions: ObservableObject, IAction - { + sealed partial class OpenAllTaggedActions : ObservableObject, IAction + { private readonly IContentPageContext _pageContext; private readonly ITagsContext _tagsContext; @@ -18,7 +18,7 @@ public string Description public RichGlyph Glyph => new("\uE71D"); - public bool IsExecutable => + public bool IsExecutable => _pageContext.ShellPage is not null && _tagsContext.TaggedItems.Any(); @@ -37,16 +37,16 @@ public async Task ExecuteAsync(object? parameter = null) .Where(item => !item.isFolder) .Select(f => f.path) .ToList(); - + var folderPaths = _tagsContext .TaggedItems .Where(item => item.isFolder) .Select(f => f.path) .ToList(); - + await Task.WhenAll(filePaths.Select(path => NavigationHelpers.OpenPath(path, _pageContext.ShellPage!))); - foreach (var path in folderPaths) + foreach (var path in folderPaths) await NavigationHelpers.OpenPathInNewTab(path); } diff --git a/src/Files.App/Actions/Display/LayoutAction.cs b/src/Files.App/Actions/Display/LayoutAction.cs index e57c6bf27774..1d26b8fc72cb 100644 --- a/src/Files.App/Actions/Display/LayoutAction.cs +++ b/src/Files.App/Actions/Display/LayoutAction.cs @@ -238,7 +238,7 @@ public Task ExecuteAsync(object? parameter = null) break; case FolderLayoutModes.CardsView: if (UserSettingsService.LayoutSettingsService.CardsViewSize > CardsViewSizeKind.Small) - UserSettingsService.LayoutSettingsService.CardsViewSize -= 1; + UserSettingsService.LayoutSettingsService.CardsViewSize -= 1; break; case FolderLayoutModes.GridView: if (UserSettingsService.LayoutSettingsService.GridViewSize > GridViewSizeKind.Small) @@ -275,7 +275,7 @@ public HotKey MediaHotKey public bool IsExecutable => ContentPageContext.PageType is not ContentPageTypes.Home && - ContentPageContext.ShellPage?.InstanceViewModel.FolderSettings.LayoutMode is FolderLayoutModes layoutMode && + ContentPageContext.ShellPage?.InstanceViewModel.FolderSettings.LayoutMode is FolderLayoutModes layoutMode && ((layoutMode is FolderLayoutModes.DetailsView && UserSettingsService.LayoutSettingsService.DetailsViewSize < DetailsViewSizeKind.ExtraLarge) || (layoutMode is FolderLayoutModes.ListView && UserSettingsService.LayoutSettingsService.ListViewSize < ListViewSizeKind.ExtraLarge) || (layoutMode is FolderLayoutModes.CardsView && UserSettingsService.LayoutSettingsService.CardsViewSize < CardsViewSizeKind.ExtraLarge) || diff --git a/src/Files.App/Actions/FileSystem/OpenItemAction.cs b/src/Files.App/Actions/FileSystem/OpenItemAction.cs index 34c4d7cfdfae..87519b842cda 100644 --- a/src/Files.App/Actions/FileSystem/OpenItemAction.cs +++ b/src/Files.App/Actions/FileSystem/OpenItemAction.cs @@ -15,7 +15,7 @@ public string Label public string Description => Strings.OpenItemDescription.GetLocalizedFormatResource(context.SelectedItems.Count); - + public RichGlyph Glyph => new(themedIconStyle: "App.ThemedIcons.OpenFile"); diff --git a/src/Files.App/Actions/FileSystem/Transfer/BaseTransferItemAction.cs b/src/Files.App/Actions/FileSystem/Transfer/BaseTransferItemAction.cs index aa37f1fbd908..a9addf150083 100644 --- a/src/Files.App/Actions/FileSystem/Transfer/BaseTransferItemAction.cs +++ b/src/Files.App/Actions/FileSystem/Transfer/BaseTransferItemAction.cs @@ -6,7 +6,6 @@ using System.IO; using Windows.ApplicationModel.DataTransfer; using Windows.Storage; -using Windows.System; namespace Files.App.Actions { diff --git a/src/Files.App/Actions/Git/GitFetchAction.cs b/src/Files.App/Actions/Git/GitFetchAction.cs index cb6016fa2af5..dc0a3842ef50 100644 --- a/src/Files.App/Actions/Git/GitFetchAction.cs +++ b/src/Files.App/Actions/Git/GitFetchAction.cs @@ -19,7 +19,7 @@ public bool IsExecutable public GitFetchAction() { _context = Ioc.Default.GetRequiredService(); - + _context.PropertyChanged += Context_PropertyChanged; } diff --git a/src/Files.App/Actions/Git/GitInitAction.cs b/src/Files.App/Actions/Git/GitInitAction.cs index c472b3251d89..11f323948793 100644 --- a/src/Files.App/Actions/Git/GitInitAction.cs +++ b/src/Files.App/Actions/Git/GitInitAction.cs @@ -3,8 +3,8 @@ namespace Files.App.Actions { - sealed partial class GitInitAction : ObservableObject, IAction - { + sealed partial class GitInitAction : ObservableObject, IAction + { private readonly IContentPageContext _context; public string Label @@ -13,7 +13,7 @@ public string Label public string Description => Strings.InitRepoDescription.GetLocalizedResource(); - public bool IsExecutable => + public bool IsExecutable => _context.Folder is not null && _context.Folder.ItemPath != SystemIO.Path.GetPathRoot(_context.Folder.ItemPath) && !_context.IsGitRepository; diff --git a/src/Files.App/Actions/Navigation/CloseTabBaseAction.cs b/src/Files.App/Actions/Navigation/CloseTabBaseAction.cs index 051957f3ce10..d5f14cd0d924 100644 --- a/src/Files.App/Actions/Navigation/CloseTabBaseAction.cs +++ b/src/Files.App/Actions/Navigation/CloseTabBaseAction.cs @@ -10,13 +10,13 @@ internal abstract class CloseTabBaseAction : ObservableObject, IAction public abstract string Label { get; } public abstract string Description { get; } - + public bool IsExecutable => GetIsExecutable(); public virtual HotKey HotKey => HotKey.None; - + public virtual HotKey SecondHotKey => HotKey.None; diff --git a/src/Files.App/Actions/Navigation/ReopenClosedTabAction.cs b/src/Files.App/Actions/Navigation/ReopenClosedTabAction.cs index 5631d0b914e3..2be7e45b532b 100644 --- a/src/Files.App/Actions/Navigation/ReopenClosedTabAction.cs +++ b/src/Files.App/Actions/Navigation/ReopenClosedTabAction.cs @@ -1,8 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using Files.App.UserControls.TabBar; - namespace Files.App.Actions { internal sealed partial class ReopenClosedTabAction : ObservableObject, IAction diff --git a/src/Files.App/Actions/Open/OpenPropertiesAction.cs b/src/Files.App/Actions/Open/OpenPropertiesAction.cs index 3e65026262d6..2cc4247eb02b 100644 --- a/src/Files.App/Actions/Open/OpenPropertiesAction.cs +++ b/src/Files.App/Actions/Open/OpenPropertiesAction.cs @@ -21,7 +21,7 @@ public HotKey HotKey public bool IsExecutable => context.PageType is not ContentPageTypes.Home && - !(context.PageType is ContentPageTypes.SearchResults && + !(context.PageType is ContentPageTypes.SearchResults && !context.HasSelection); public OpenPropertiesAction() @@ -50,7 +50,7 @@ private void OpenPropertiesFromItemContextMenuFlyout(object? _, object e) var page = context.ShellPage?.SlimContentPage; if (page is not null) page.ItemContextMenuFlyout.Closed -= OpenPropertiesFromItemContextMenuFlyout; - + FilePropertiesHelpers.OpenPropertiesWindow(context.ShellPage!); } @@ -59,7 +59,7 @@ private void OpenPropertiesFromBaseContextMenuFlyout(object? _, object e) var page = context.ShellPage?.SlimContentPage; if (page is not null) page.BaseContextMenuFlyout.Closed -= OpenPropertiesFromBaseContextMenuFlyout; - + FilePropertiesHelpers.OpenPropertiesWindow(context.ShellPage!); } diff --git a/src/Files.App/Actions/Open/OpenRepoInIDEAction.cs b/src/Files.App/Actions/Open/OpenRepoInIDEAction.cs index 0d4d346850cd..c4c3d5514f30 100644 --- a/src/Files.App/Actions/Open/OpenRepoInIDEAction.cs +++ b/src/Files.App/Actions/Open/OpenRepoInIDEAction.cs @@ -2,7 +2,7 @@ // Licensed under the MIT License. namespace Files.App.Actions -{ +{ internal sealed partial class OpenRepoInIDEAction : ObservableObject, IAction { private readonly IDevToolsSettingsService _devToolsSettingsService; diff --git a/src/Files.App/Actions/Open/OpenSettingsAction.cs b/src/Files.App/Actions/Open/OpenSettingsAction.cs index 6c1712b887fb..1278f0560df6 100644 --- a/src/Files.App/Actions/Open/OpenSettingsAction.cs +++ b/src/Files.App/Actions/Open/OpenSettingsAction.cs @@ -19,7 +19,7 @@ public string Description public HotKey HotKey => new(Keys.OemComma, KeyModifiers.Ctrl); - + public RichGlyph Glyph => new(themedIconStyle: "App.ThemedIcons.Settings"); diff --git a/src/Files.App/Actions/Show/ToggleShelfPaneAction.cs b/src/Files.App/Actions/Show/ToggleShelfPaneAction.cs index 43ff818fa7fa..93242351c900 100644 --- a/src/Files.App/Actions/Show/ToggleShelfPaneAction.cs +++ b/src/Files.App/Actions/Show/ToggleShelfPaneAction.cs @@ -23,7 +23,7 @@ public bool IsAccessibleGlobally // TODO Remove IsExecutable when shelf feature is ready public bool IsExecutable => AppLifecycleHelper.AppEnvironment is AppEnvironment.Dev; - + public bool IsOn => generalSettingsService.ShowShelfPane; diff --git a/src/Files.App/Constants.cs b/src/Files.App/Constants.cs index a8d191705981..d5ecefa28323 100644 --- a/src/Files.App/Constants.cs +++ b/src/Files.App/Constants.cs @@ -207,7 +207,7 @@ public static class ExternalUrl public const string PrivacyPolicyUrl = @"https://files.community/privacy"; public const string SupportUsUrl = @"https://github.com/files-community/Files?sponsor"; public const string CrowdinUrl = @"https://crowdin.com/project/files-app"; - public static readonly string ReleaseNotesUrl= $"https://files.community/blog/posts/v{Package.Current.Id.Version.Major}-{Package.Current.Id.Version.Minor}-{Package.Current.Id.Version.Build}?minimal"; + public static readonly string ReleaseNotesUrl = $"https://files.community/blog/posts/v{Package.Current.Id.Version.Major}-{Package.Current.Id.Version.Minor}-{Package.Current.Id.Version.Build}?minimal"; } public static class DocsPath @@ -219,7 +219,7 @@ public static class Actions { public const int MaxSelectedItems = 5; } - + public static class DragAndDrop { public const Int32 HoverToOpenTimespan = 1300; diff --git a/src/Files.App/Converters/StatusCenterStateToBrushConverter.cs b/src/Files.App/Converters/StatusCenterStateToBrushConverter.cs index 8b8a53606563..77398fc0f141 100644 --- a/src/Files.App/Converters/StatusCenterStateToBrushConverter.cs +++ b/src/Files.App/Converters/StatusCenterStateToBrushConverter.cs @@ -84,7 +84,7 @@ public SolidColorBrush CanceledForegroundBrush public object? Convert(object value, Type targetType, object parameter, string language) { if (value is StatusCenterItemKind state) - { + { if (bool.TryParse(parameter?.ToString(), out var isBackground) && isBackground) { return state switch diff --git a/src/Files.App/Converters/StatusCenterStateToStateIconConverter.cs b/src/Files.App/Converters/StatusCenterStateToStateIconConverter.cs index 178bb4ba7ce0..62a01038914a 100644 --- a/src/Files.App/Converters/StatusCenterStateToStateIconConverter.cs +++ b/src/Files.App/Converters/StatusCenterStateToStateIconConverter.cs @@ -17,16 +17,16 @@ partial class StatusCenterStateToStateIconConverter : IValueConverter { var pathMarkup = state switch { - StatusCenterItemIconKind.Copy => Application.Current.Resources["App.Theme.PathIcon.ActionCopy"] as string, - StatusCenterItemIconKind.Move => Application.Current.Resources["App.Theme.PathIcon.ActionMove"] as string, - StatusCenterItemIconKind.Delete => Application.Current.Resources["App.Theme.PathIcon.ActionDelete"] as string, - StatusCenterItemIconKind.Recycle => Application.Current.Resources["App.Theme.PathIcon.ActionDelete"] as string, - StatusCenterItemIconKind.Extract => Application.Current.Resources["App.Theme.PathIcon.ActionExtract"] as string, - StatusCenterItemIconKind.Compress => Application.Current.Resources["App.Theme.PathIcon.ActionExtract"] as string, - StatusCenterItemIconKind.Successful => Application.Current.Resources["App.Theme.PathIcon.ActionSuccess"] as string, - StatusCenterItemIconKind.Error => Application.Current.Resources["App.Theme.PathIcon.ActionInfo"] as string, - StatusCenterItemIconKind.GitClone => Application.Current.Resources["App.Theme.PathIcon.ActionGitClone"] as string, - StatusCenterItemIconKind.InstallFont => Application.Current.Resources["App.Theme.PathIcon.ActionInstallFont"] as string, + StatusCenterItemIconKind.Copy => Application.Current.Resources["App.Theme.PathIcon.ActionCopy"] as string, + StatusCenterItemIconKind.Move => Application.Current.Resources["App.Theme.PathIcon.ActionMove"] as string, + StatusCenterItemIconKind.Delete => Application.Current.Resources["App.Theme.PathIcon.ActionDelete"] as string, + StatusCenterItemIconKind.Recycle => Application.Current.Resources["App.Theme.PathIcon.ActionDelete"] as string, + StatusCenterItemIconKind.Extract => Application.Current.Resources["App.Theme.PathIcon.ActionExtract"] as string, + StatusCenterItemIconKind.Compress => Application.Current.Resources["App.Theme.PathIcon.ActionExtract"] as string, + StatusCenterItemIconKind.Successful => Application.Current.Resources["App.Theme.PathIcon.ActionSuccess"] as string, + StatusCenterItemIconKind.Error => Application.Current.Resources["App.Theme.PathIcon.ActionInfo"] as string, + StatusCenterItemIconKind.GitClone => Application.Current.Resources["App.Theme.PathIcon.ActionGitClone"] as string, + StatusCenterItemIconKind.InstallFont => Application.Current.Resources["App.Theme.PathIcon.ActionInstallFont"] as string, _ => "" }; diff --git a/src/Files.App/Data/AppModels/SingleFileDatabaseModel.cs b/src/Files.App/Data/AppModels/SingleFileDatabaseModel.cs index 162d14a84083..9b858e0dfcd1 100644 --- a/src/Files.App/Data/AppModels/SingleFileDatabaseModel.cs +++ b/src/Files.App/Data/AppModels/SingleFileDatabaseModel.cs @@ -1,8 +1,4 @@ -using Files.Core.Storage; -using Files.Core.Storage.Extensions; -using Files.Core.Storage.Storables; -using Files.Shared.Extensions; -using Files.Shared.Utils; +using Files.Shared.Utils; using System.IO; namespace Files.App.Data.AppModels diff --git a/src/Files.App/Data/Behaviors/StickyHeaderBehavior.cs b/src/Files.App/Data/Behaviors/StickyHeaderBehavior.cs index 29fafb438288..d41f144e626b 100644 --- a/src/Files.App/Data/Behaviors/StickyHeaderBehavior.cs +++ b/src/Files.App/Data/Behaviors/StickyHeaderBehavior.cs @@ -8,9 +8,6 @@ using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Hosting; -using Microsoft.UI.Xaml.Input; -using Microsoft.UI.Xaml.Media; -using Windows.Foundation; using Windows.Foundation.Metadata; namespace Files.App.Data.Behaviors diff --git a/src/Files.App/Data/Commands/ActionCommand.cs b/src/Files.App/Data/Commands/ActionCommand.cs index d3a413ce2721..51a122c6258f 100644 --- a/src/Files.App/Data/Commands/ActionCommand.cs +++ b/src/Files.App/Data/Commands/ActionCommand.cs @@ -1,7 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using Sentry; using Files.App.Actions; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; diff --git a/src/Files.App/Data/Commands/HotKey/HotKey.cs b/src/Files.App/Data/Commands/HotKey/HotKey.cs index 4c710e3d783d..30e1bbac98ba 100644 --- a/src/Files.App/Data/Commands/HotKey/HotKey.cs +++ b/src/Files.App/Data/Commands/HotKey/HotKey.cs @@ -2,7 +2,6 @@ // Licensed under the MIT License. using System.Collections.Frozen; -using System.Runtime.InteropServices; using System.Text; using Windows.Win32; using Forms = System.Windows.Forms; diff --git a/src/Files.App/Data/Commands/Manager/CommandManager.cs b/src/Files.App/Data/Commands/Manager/CommandManager.cs index 29f8a9f25c1c..0ead424a2c80 100644 --- a/src/Files.App/Data/Commands/Manager/CommandManager.cs +++ b/src/Files.App/Data/Commands/Manager/CommandManager.cs @@ -134,7 +134,7 @@ public IRichCommand this[HotKey hotKey] public IRichCommand LayoutIncreaseSize => commands[CommandCodes.LayoutIncreaseSize]; public IRichCommand LayoutDetails => commands[CommandCodes.LayoutDetails]; public IRichCommand LayoutList => commands[CommandCodes.LayoutList]; - public IRichCommand LayoutCards=> commands[CommandCodes.LayoutCards]; + public IRichCommand LayoutCards => commands[CommandCodes.LayoutCards]; public IRichCommand LayoutGrid => commands[CommandCodes.LayoutGrid]; public IRichCommand LayoutColumns => commands[CommandCodes.LayoutColumns]; public IRichCommand LayoutAdaptive => commands[CommandCodes.LayoutAdaptive]; diff --git a/src/Files.App/Data/Commands/Manager/ICommandManager.cs b/src/Files.App/Data/Commands/Manager/ICommandManager.cs index 1a891037c5f7..f1711fb134ec 100644 --- a/src/Files.App/Data/Commands/Manager/ICommandManager.cs +++ b/src/Files.App/Data/Commands/Manager/ICommandManager.cs @@ -123,7 +123,7 @@ public interface ICommandManager : IEnumerable IRichCommand LayoutIncreaseSize { get; } IRichCommand LayoutDetails { get; } IRichCommand LayoutList { get; } - IRichCommand LayoutCards{ get; } + IRichCommand LayoutCards { get; } IRichCommand LayoutGrid { get; } IRichCommand LayoutColumns { get; } IRichCommand LayoutAdaptive { get; } diff --git a/src/Files.App/Data/Contexts/ContentPage/ContentPageContext.cs b/src/Files.App/Data/Contexts/ContentPage/ContentPageContext.cs index da3cf6dc0b81..5be1861d13c3 100644 --- a/src/Files.App/Data/Contexts/ContentPage/ContentPageContext.cs +++ b/src/Files.App/Data/Contexts/ContentPage/ContentPageContext.cs @@ -1,7 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using Files.App.UserControls.TabBar; using System.Collections.Immutable; namespace Files.App.Data.Contexts @@ -92,7 +91,7 @@ private void Context_Changed(object? sender, EventArgs e) page.ContentChanged += Page_ContentChanged; page.InstanceViewModel.PropertyChanged += InstanceViewModel_PropertyChanged; page.ToolbarViewModel.PropertyChanged += ToolbarViewModel_PropertyChanged; - + if (page.PaneHolder is not null) page.PaneHolder.PropertyChanged += PaneHolder_PropertyChanged; } diff --git a/src/Files.App/Data/Contexts/HomePage/HomePageContext.cs b/src/Files.App/Data/Contexts/HomePage/HomePageContext.cs index a4e07b64ddf7..dcc552a83b1e 100644 --- a/src/Files.App/Data/Contexts/HomePage/HomePageContext.cs +++ b/src/Files.App/Data/Contexts/HomePage/HomePageContext.cs @@ -1,7 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using Files.App.UserControls.Widgets; using Microsoft.UI.Xaml.Controls; using System.Collections.Immutable; diff --git a/src/Files.App/Data/Contexts/Multitasking/IMultitaskingContext.cs b/src/Files.App/Data/Contexts/Multitasking/IMultitaskingContext.cs index ad39ce4f39c6..d68068155de2 100644 --- a/src/Files.App/Data/Contexts/Multitasking/IMultitaskingContext.cs +++ b/src/Files.App/Data/Contexts/Multitasking/IMultitaskingContext.cs @@ -1,9 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using Files.App.UserControls.TabBar; -using System.ComponentModel; - namespace Files.App.Data.Contexts { public interface IMultitaskingContext : INotifyPropertyChanged diff --git a/src/Files.App/Data/Contexts/Multitasking/MultitaskingContext.cs b/src/Files.App/Data/Contexts/Multitasking/MultitaskingContext.cs index 8219ded4f7ef..e1ae0e50760e 100644 --- a/src/Files.App/Data/Contexts/Multitasking/MultitaskingContext.cs +++ b/src/Files.App/Data/Contexts/Multitasking/MultitaskingContext.cs @@ -2,7 +2,6 @@ // Licensed under the MIT License. using Microsoft.UI.Xaml; -using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Input; using System.Collections.Specialized; diff --git a/src/Files.App/Data/Contexts/Tags/ITagsContext.cs b/src/Files.App/Data/Contexts/Tags/ITagsContext.cs index faf38e436b49..8103d422f096 100644 --- a/src/Files.App/Data/Contexts/Tags/ITagsContext.cs +++ b/src/Files.App/Data/Contexts/Tags/ITagsContext.cs @@ -3,8 +3,8 @@ namespace Files.App.Data.Contexts { - interface ITagsContext: INotifyPropertyChanged - { + interface ITagsContext : INotifyPropertyChanged + { IEnumerable<(string path, bool isFolder)> TaggedItems { get; } - } + } } diff --git a/src/Files.App/Data/Contexts/Tags/TagsContext.cs b/src/Files.App/Data/Contexts/Tags/TagsContext.cs index 729e9f11a364..5ae3fe925207 100644 --- a/src/Files.App/Data/Contexts/Tags/TagsContext.cs +++ b/src/Files.App/Data/Contexts/Tags/TagsContext.cs @@ -6,7 +6,7 @@ namespace Files.App.Data.Contexts { sealed partial class TagsContext : ITagsContext - { + { private static readonly IReadOnlyList<(string path, bool isFolder)> _emptyTaggedItemsList = Enumerable.Empty<(string path, bool isFolder)>().ToImmutableList(); diff --git a/src/Files.App/Data/Contracts/IAppearanceSettingsService.cs b/src/Files.App/Data/Contracts/IAppearanceSettingsService.cs index 1324463a973b..f5086d9b689d 100644 --- a/src/Files.App/Data/Contracts/IAppearanceSettingsService.cs +++ b/src/Files.App/Data/Contracts/IAppearanceSettingsService.cs @@ -101,7 +101,7 @@ public interface IAppearanceSettingsService : IBaseSettingsService, INotifyPrope /// Gets or sets a value whether the toolbar should be displayed. /// bool ShowToolbar { get; set; } - + /// /// Gets or sets a value whether the tab actions button should be displayed. /// @@ -110,7 +110,7 @@ public interface IAppearanceSettingsService : IBaseSettingsService, INotifyPrope /// /// Gets or sets a value whether the shelf pane toggle button should be displayed. /// - bool ShowShelfPaneToggleButton{ get; set; } + bool ShowShelfPaneToggleButton { get; set; } /// diff --git a/src/Files.App/Data/Contracts/IApplicationSettingsService.cs b/src/Files.App/Data/Contracts/IApplicationSettingsService.cs index df7535e83b8e..a809120dd5c6 100644 --- a/src/Files.App/Data/Contracts/IApplicationSettingsService.cs +++ b/src/Files.App/Data/Contracts/IApplicationSettingsService.cs @@ -14,7 +14,7 @@ public interface IApplicationSettingsService : IBaseSettingsService /// Gets or sets a value indicating whether or not the user clicked the 'sponsor' prompt. /// bool HasClickedSponsorPrompt { get; set; } - + /// /// Gets or sets a value indicating whether or not to display a prompt when running the app as administrator. /// diff --git a/src/Files.App/Data/Contracts/ICompressArchiveModel.cs b/src/Files.App/Data/Contracts/ICompressArchiveModel.cs index 8c18047483c9..c1f0227c18ce 100644 --- a/src/Files.App/Data/Contracts/ICompressArchiveModel.cs +++ b/src/Files.App/Data/Contracts/ICompressArchiveModel.cs @@ -47,7 +47,7 @@ public interface ICompressArchiveModel /// 7zip archive splitting size. /// ArchiveSplittingSizes SplittingSize { get; } - + /// /// Number of CPU Threads to use. /// diff --git a/src/Files.App/Data/Contracts/IDevToolsSettingsService.cs b/src/Files.App/Data/Contracts/IDevToolsSettingsService.cs index 2148c8322722..b942dec691cb 100644 --- a/src/Files.App/Data/Contracts/IDevToolsSettingsService.cs +++ b/src/Files.App/Data/Contracts/IDevToolsSettingsService.cs @@ -9,7 +9,7 @@ public interface IDevToolsSettingsService : IBaseSettingsService, INotifyPropert /// Gets or sets a value when the Open in IDE button should be displayed on the status bar. /// OpenInIDEOption OpenInIDEOption { get; set; } - + /// /// Gets or sets the path of the chosen IDE. /// diff --git a/src/Files.App/Data/Contracts/IDialogService.cs b/src/Files.App/Data/Contracts/IDialogService.cs index 4c2d44c3ea14..b86216c2b95c 100644 --- a/src/Files.App/Data/Contracts/IDialogService.cs +++ b/src/Files.App/Data/Contracts/IDialogService.cs @@ -1,9 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using Files.App.ViewModels.Dialogs; -using Files.App.Data.Enums; - namespace Files.App.Data.Contracts { /// diff --git a/src/Files.App/Data/Contracts/IInfoPaneSettingsService.cs b/src/Files.App/Data/Contracts/IInfoPaneSettingsService.cs index 687c995a417a..c32a1880632c 100644 --- a/src/Files.App/Data/Contracts/IInfoPaneSettingsService.cs +++ b/src/Files.App/Data/Contracts/IInfoPaneSettingsService.cs @@ -1,8 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using System.ComponentModel; - namespace Files.App.Data.Contracts { public interface IInfoPaneSettingsService : IBaseSettingsService, INotifyPropertyChanged diff --git a/src/Files.App/Data/Contracts/IResourcesService.cs b/src/Files.App/Data/Contracts/IResourcesService.cs index aa8874ec7198..d201307ea520 100644 --- a/src/Files.App/Data/Contracts/IResourcesService.cs +++ b/src/Files.App/Data/Contracts/IResourcesService.cs @@ -26,7 +26,7 @@ public interface IResourcesService /// /// void SetAppThemeAddressBarBackgroundColor(Color appThemeAddressBarBackgroundColor); - + /// /// Overrides the XAML resource for App.Theme.Toolbar.BackgroundBrush /// diff --git a/src/Files.App/Data/Contracts/IShellPage.cs b/src/Files.App/Data/Contracts/IShellPage.cs index fdf28822d652..86b25b89949f 100644 --- a/src/Files.App/Data/Contracts/IShellPage.cs +++ b/src/Files.App/Data/Contracts/IShellPage.cs @@ -65,7 +65,7 @@ public interface IShellPage : ITabBarItemContent, IMultiPaneInfo, IDisposable, I /// Navigates to the home page /// public void NavigateHome(); - + /// /// Navigates to the release notes page /// diff --git a/src/Files.App/Data/Contracts/IStartMenuService.cs b/src/Files.App/Data/Contracts/IStartMenuService.cs index f322d469291a..c5fb16d557b3 100644 --- a/src/Files.App/Data/Contracts/IStartMenuService.cs +++ b/src/Files.App/Data/Contracts/IStartMenuService.cs @@ -1,6 +1,4 @@ -using Files.Core.Storage; - -namespace Files.App.Data.Contracts +namespace Files.App.Data.Contracts { /// /// A service that manages actions associated with system Start Menu. diff --git a/src/Files.App/Data/Contracts/IStorageArchiveService.cs b/src/Files.App/Data/Contracts/IStorageArchiveService.cs index ee0ee550bfdc..ef4bfd6b949a 100644 --- a/src/Files.App/Data/Contracts/IStorageArchiveService.cs +++ b/src/Files.App/Data/Contracts/IStorageArchiveService.cs @@ -1,8 +1,8 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using System.Text; using SevenZip; +using System.Text; namespace Files.App.Data.Contracts { diff --git a/src/Files.App/Data/Contracts/ImagingService.cs b/src/Files.App/Data/Contracts/ImagingService.cs index 30d3dcd0a427..76fc1d0fc234 100644 --- a/src/Files.App/Data/Contracts/ImagingService.cs +++ b/src/Files.App/Data/Contracts/ImagingService.cs @@ -1,8 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using Files.Core.Storage; -using Files.Core.Storage.Storables; using Files.Shared.Utils; using Windows.Storage.FileProperties; diff --git a/src/Files.App/Data/EventArguments/EventArrivedEventArgs.cs b/src/Files.App/Data/EventArguments/EventArrivedEventArgs.cs index 6b51012237f7..7e8052a69bde 100644 --- a/src/Files.App/Data/EventArguments/EventArrivedEventArgs.cs +++ b/src/Files.App/Data/EventArguments/EventArrivedEventArgs.cs @@ -2,7 +2,6 @@ // Licensed under the MIT License. using Microsoft.Management.Infrastructure; -using System; namespace Files.App.Data.EventArguments { diff --git a/src/Files.App/Data/EventArguments/PathBoxItemDroppedEventArgs.cs b/src/Files.App/Data/EventArguments/PathBoxItemDroppedEventArgs.cs index a2a997392c08..e9b2c2c71439 100644 --- a/src/Files.App/Data/EventArguments/PathBoxItemDroppedEventArgs.cs +++ b/src/Files.App/Data/EventArguments/PathBoxItemDroppedEventArgs.cs @@ -1,9 +1,7 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using Files.App.Views; using Files.Shared.Helpers; -using Microsoft.UI.Xaml.Controls; using Windows.ApplicationModel.DataTransfer; namespace Files.App.Data.EventArguments diff --git a/src/Files.App/Data/EventArguments/PathNavigationEventArgs.cs b/src/Files.App/Data/EventArguments/PathNavigationEventArgs.cs index d7e9dbd4420b..f44bd27aeb46 100644 --- a/src/Files.App/Data/EventArguments/PathNavigationEventArgs.cs +++ b/src/Files.App/Data/EventArguments/PathNavigationEventArgs.cs @@ -1,10 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using Files.App.Views; -using Microsoft.UI.Xaml.Controls; -using Windows.ApplicationModel.DataTransfer; - namespace Files.App.Data.EventArguments { public sealed class PathNavigationEventArgs diff --git a/src/Files.App/Data/EventArguments/SearchBoxQuerySubmittedEventArgs.cs b/src/Files.App/Data/EventArguments/SearchBoxQuerySubmittedEventArgs.cs index b63f96e4a938..a52f3154361d 100644 --- a/src/Files.App/Data/EventArguments/SearchBoxQuerySubmittedEventArgs.cs +++ b/src/Files.App/Data/EventArguments/SearchBoxQuerySubmittedEventArgs.cs @@ -1,10 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using Files.App.Data.Models; -using Microsoft.UI.Xaml.Controls; -using Windows.Foundation; - namespace Files.App.Data.EventArguments { public sealed class SearchBoxQuerySubmittedEventArgs diff --git a/src/Files.App/Data/EventArguments/SearchBoxTextChangedEventArgs.cs b/src/Files.App/Data/EventArguments/SearchBoxTextChangedEventArgs.cs index e484adee3f02..3583e3d46a5a 100644 --- a/src/Files.App/Data/EventArguments/SearchBoxTextChangedEventArgs.cs +++ b/src/Files.App/Data/EventArguments/SearchBoxTextChangedEventArgs.cs @@ -1,9 +1,7 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using Files.App.Data.Models; using Microsoft.UI.Xaml.Controls; -using Windows.Foundation; namespace Files.App.Data.EventArguments { diff --git a/src/Files.App/Data/EventArguments/SelectedTagChangedEventArgs.cs b/src/Files.App/Data/EventArguments/SelectedTagChangedEventArgs.cs index 9ab5193cfcc9..5501cb49223f 100644 --- a/src/Files.App/Data/EventArguments/SelectedTagChangedEventArgs.cs +++ b/src/Files.App/Data/EventArguments/SelectedTagChangedEventArgs.cs @@ -3,5 +3,5 @@ namespace Files.App.Data.EventArguments { - public record SelectedTagChangedEventArgs(IEnumerable<(string path, bool isFolder)> Items); + public record SelectedTagChangedEventArgs(IEnumerable<(string path, bool isFolder)> Items); } diff --git a/src/Files.App/Data/EventArguments/SettingChangedEventArgs.cs b/src/Files.App/Data/EventArguments/SettingChangedEventArgs.cs index 9fc0238fefcc..d44e774d0ca5 100644 --- a/src/Files.App/Data/EventArguments/SettingChangedEventArgs.cs +++ b/src/Files.App/Data/EventArguments/SettingChangedEventArgs.cs @@ -1,8 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using System; - namespace Files.App.Data.EventArguments { public sealed class SettingChangedEventArgs : EventArgs diff --git a/src/Files.App/Data/EventArguments/ToolbarQuerySubmittedEventArgs.cs b/src/Files.App/Data/EventArguments/ToolbarQuerySubmittedEventArgs.cs index 3e6585271eb3..8e83c9b4f6f9 100644 --- a/src/Files.App/Data/EventArguments/ToolbarQuerySubmittedEventArgs.cs +++ b/src/Files.App/Data/EventArguments/ToolbarQuerySubmittedEventArgs.cs @@ -1,10 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using Files.App.Views; -using Microsoft.UI.Xaml.Controls; -using Windows.ApplicationModel.DataTransfer; - namespace Files.App.Data.EventArguments { public sealed class ToolbarQuerySubmittedEventArgs diff --git a/src/Files.App/Data/Factories/SecurityAdvancedAccessControlItemFactory.cs b/src/Files.App/Data/Factories/SecurityAdvancedAccessControlItemFactory.cs index eefb0642b2ba..cfee423820e1 100644 --- a/src/Files.App/Data/Factories/SecurityAdvancedAccessControlItemFactory.cs +++ b/src/Files.App/Data/Factories/SecurityAdvancedAccessControlItemFactory.cs @@ -1,10 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using Files.App.Extensions; -using System.Collections.Generic; -using System.Collections.ObjectModel; - namespace Files.App.Data.Factories { public static class SecurityAdvancedAccessControlItemFactory diff --git a/src/Files.App/Data/Factories/ShellContextFlyoutHelper.cs b/src/Files.App/Data/Factories/ShellContextFlyoutHelper.cs index 836ff7ed3ea8..361766242fe7 100644 --- a/src/Files.App/Data/Factories/ShellContextFlyoutHelper.cs +++ b/src/Files.App/Data/Factories/ShellContextFlyoutHelper.cs @@ -262,8 +262,8 @@ [new ListedItem(null) { ItemPath = path }], (showSendToMenu || !UserSettingsService.GeneralSettingsService.ShowSendToMenu)) shellMenuItems.Remove(sendToItem); - var turnOnBitLocker = shellMenuItems.FirstOrDefault(x => - x.Tag is Win32ContextMenuItem menuItem && + var turnOnBitLocker = shellMenuItems.FirstOrDefault(x => + x.Tag is Win32ContextMenuItem menuItem && (menuItem.CommandString?.StartsWith("encrypt-bde") ?? false)); if (turnOnBitLocker is not null) @@ -384,8 +384,8 @@ x.Tag is Win32ContextMenuItem menuItem && { AddItemsToMainMenu(itemContextMenuFlyout.SecondaryCommands, item); } - else if (itemContextMenuFlyout.SecondaryCommands.FirstOrDefault(x => x is AppBarButton appBarButton - && appBarButton.Tag as string == "ItemOverflow") is AppBarButton overflowItem) + else if (itemContextMenuFlyout.SecondaryCommands.FirstOrDefault(x => x is AppBarButton appBarButton + && appBarButton.Tag as string == "ItemOverflow") is AppBarButton overflowItem) { AddItemsToOverflowMenu(overflowItem, item); } diff --git a/src/Files.App/Data/Items/AccessControlPrincipal.cs b/src/Files.App/Data/Items/AccessControlPrincipal.cs index bb6757957bcc..4da0dc3ebcdd 100644 --- a/src/Files.App/Data/Items/AccessControlPrincipal.cs +++ b/src/Files.App/Data/Items/AccessControlPrincipal.cs @@ -2,7 +2,6 @@ // Licensed under the MIT License. using Windows.Win32; -using Windows.Win32.Foundation; using Windows.Win32.Security; namespace Files.App.Data.Items @@ -87,7 +86,7 @@ public AccessControlPrincipal(string sid) // Get account name and domain bResult = PInvoke.LookupAccountSid(string.Empty, lpSid, lpName, ref cchName, lpDomain, ref cchDomainName, out var snu); - if(!bResult) + if (!bResult) return; PrincipalType = snu switch diff --git a/src/Files.App/Data/Items/ActionWithParameterItem.cs b/src/Files.App/Data/Items/ActionWithParameterItem.cs index 921191a30cec..63ea8691b015 100644 --- a/src/Files.App/Data/Items/ActionWithParameterItem.cs +++ b/src/Files.App/Data/Items/ActionWithParameterItem.cs @@ -1,8 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using System.Text.Json.Serialization; - namespace Files.App.Data.Items { [Serializable] diff --git a/src/Files.App/Data/Items/EncodingItem.cs b/src/Files.App/Data/Items/EncodingItem.cs index 24c79bc35bf2..51ec61b121e9 100644 --- a/src/Files.App/Data/Items/EncodingItem.cs +++ b/src/Files.App/Data/Items/EncodingItem.cs @@ -5,36 +5,36 @@ namespace Files.App.Data.Items { - /// - /// Represents a text encoding in the application. - /// - public sealed class EncodingItem - { + /// + /// Represents a text encoding in the application. + /// + public sealed class EncodingItem + { - public Encoding? Encoding { get; set; } + public Encoding? Encoding { get; set; } - /// - /// Gets the encoding name. e.g. English (United States) - /// - public string Name { get; set; } + /// + /// Gets the encoding name. e.g. English (United States) + /// + public string Name { get; set; } - /// - /// Initializes a new instance of the class. - /// - /// The code of the language. - public EncodingItem(string? code) - { - if (string.IsNullOrEmpty(code)) - { - Encoding = null; - Name = Strings.Default.GetLocalizedResource(); - } - else - { - Encoding = Encoding.GetEncoding(code); - Name = Encoding.EncodingName; - } - } + /// + /// Initializes a new instance of the class. + /// + /// The code of the language. + public EncodingItem(string? code) + { + if (string.IsNullOrEmpty(code)) + { + Encoding = null; + Name = Strings.Default.GetLocalizedResource(); + } + else + { + Encoding = Encoding.GetEncoding(code); + Name = Encoding.EncodingName; + } + } public EncodingItem(Encoding encoding, string name) { @@ -76,5 +76,5 @@ public EncodingItem(Encoding encoding, string name) .ToArray(); public override string ToString() => Name; - } + } } diff --git a/src/Files.App/Data/Items/WindowEx.cs b/src/Files.App/Data/Items/WindowEx.cs index b19f3ba449f8..b00cb0565279 100644 --- a/src/Files.App/Data/Items/WindowEx.cs +++ b/src/Files.App/Data/Items/WindowEx.cs @@ -1,7 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using Microsoft.UI.Composition.SystemBackdrops; using Microsoft.UI.Windowing; using Microsoft.UI.Xaml; using System.Runtime.InteropServices; diff --git a/src/Files.App/Data/Messages/FileSystemDialogOptionChangedMessage.cs b/src/Files.App/Data/Messages/FileSystemDialogOptionChangedMessage.cs index 2de95be9dcc7..218418245c0a 100644 --- a/src/Files.App/Data/Messages/FileSystemDialogOptionChangedMessage.cs +++ b/src/Files.App/Data/Messages/FileSystemDialogOptionChangedMessage.cs @@ -2,7 +2,6 @@ // Licensed under the MIT License. using CommunityToolkit.Mvvm.Messaging.Messages; -using Files.App.ViewModels.Dialogs.FileSystemDialog; namespace Files.App.Data.Messages { diff --git a/src/Files.App/Data/Models/AddItemDialogResultModel.cs b/src/Files.App/Data/Models/AddItemDialogResultModel.cs index 568b3bcdda2d..721458170cf3 100644 --- a/src/Files.App/Data/Models/AddItemDialogResultModel.cs +++ b/src/Files.App/Data/Models/AddItemDialogResultModel.cs @@ -1,8 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using Files.Shared; - namespace Files.App.Data.Models { /// diff --git a/src/Files.App/Data/Models/CompressArchiveModel.cs b/src/Files.App/Data/Models/CompressArchiveModel.cs index cb26f874e0e1..b3f63d3d1618 100644 --- a/src/Files.App/Data/Models/CompressArchiveModel.cs +++ b/src/Files.App/Data/Models/CompressArchiveModel.cs @@ -108,7 +108,7 @@ public IProgress Progress /// public CancellationToken CancellationToken { get; set; } - + /// public int CPUThreads { get; set; } diff --git a/src/Files.App/Data/Models/CurrentInstanceViewModel.cs b/src/Files.App/Data/Models/CurrentInstanceViewModel.cs index 3eae3ce7ba9a..ffc6a977f291 100644 --- a/src/Files.App/Data/Models/CurrentInstanceViewModel.cs +++ b/src/Files.App/Data/Models/CurrentInstanceViewModel.cs @@ -52,7 +52,7 @@ public bool IsPageTypeNotHome OnPropertyChanged(nameof(CanCopyPathInPage)); } } - + private bool isPageTypeReleaseNotes = false; public bool IsPageTypeReleaseNotes { @@ -64,7 +64,7 @@ public bool IsPageTypeReleaseNotes OnPropertyChanged(nameof(CanCopyPathInPage)); } } - + private bool isPageTypeSettings = false; public bool IsPageTypeSettings { diff --git a/src/Files.App/Data/Models/DirectoryPropertiesViewModel.cs b/src/Files.App/Data/Models/DirectoryPropertiesViewModel.cs index 3be81f4b6587..d6fd99840b3e 100644 --- a/src/Files.App/Data/Models/DirectoryPropertiesViewModel.cs +++ b/src/Files.App/Data/Models/DirectoryPropertiesViewModel.cs @@ -41,8 +41,8 @@ public int SelectedBranchIndex get => _SelectedBranchIndex; set { - if (SetProperty(ref _SelectedBranchIndex, value) && - value != -1 && + if (SetProperty(ref _SelectedBranchIndex, value) && + value != -1 && (value != ACTIVE_BRANCH_INDEX || !_ShowLocals) && value < Branches.Count) { @@ -90,8 +90,8 @@ public bool ShowOpenInIDEButton } } - public ObservableCollection Branches => _ShowLocals - ? _localBranches + public ObservableCollection Branches => _ShowLocals + ? _localBranches : _remoteBranches; public EventHandler? CheckoutRequested; @@ -125,7 +125,7 @@ ContentPageContext.ShellPage is not null && : null; _gitRepositoryPath = repositoryPath; - + // Change ShowLocals value only if branches flyout is closed if (!IsBranchesFlyoutExpanded) ShowLocals = true; diff --git a/src/Files.App/Data/Models/DisposableArray.cs b/src/Files.App/Data/Models/DisposableArray.cs index 1125fdacc6c7..840e5ced1889 100644 --- a/src/Files.App/Data/Models/DisposableArray.cs +++ b/src/Files.App/Data/Models/DisposableArray.cs @@ -1,8 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using Files.Shared.Extensions; - namespace Files.App.Data.Models { public sealed partial class DisposableArray : FreeableStore diff --git a/src/Files.App/Data/Models/DrivesViewModel.cs b/src/Files.App/Data/Models/DrivesViewModel.cs index 4e1b13cf161b..cf1976d82266 100644 --- a/src/Files.App/Data/Models/DrivesViewModel.cs +++ b/src/Files.App/Data/Models/DrivesViewModel.cs @@ -2,7 +2,6 @@ // Licensed under the MIT License. using Files.App.Services.SizeProvider; -using Files.Core.Storage.Storables; using Microsoft.Extensions.Logging; using System.IO; diff --git a/src/Files.App/Data/Models/GitItemModel.cs b/src/Files.App/Data/Models/GitItemModel.cs index a71f4740d3a4..a82cd9d79e38 100644 --- a/src/Files.App/Data/Models/GitItemModel.cs +++ b/src/Files.App/Data/Models/GitItemModel.cs @@ -15,7 +15,7 @@ internal sealed class GitItemModel /// This is often showed as A(Added), D(Deleted), M(Modified), U(Untracked) in VS Code. /// public ChangeKind? Status { get; init; } - + /// /// Gets or initializes file change kind icon /// diff --git a/src/Files.App/Data/Models/PinnedFoldersManager.cs b/src/Files.App/Data/Models/PinnedFoldersManager.cs index 3b1c8b11c9ba..04ce0eb23eb3 100644 --- a/src/Files.App/Data/Models/PinnedFoldersManager.cs +++ b/src/Files.App/Data/Models/PinnedFoldersManager.cs @@ -3,7 +3,6 @@ using System.Collections.Specialized; using System.IO; -using System.Text.Json.Serialization; namespace Files.App.Data.Models { diff --git a/src/Files.App/Data/Models/SelectedItemsPropertiesViewModel.cs b/src/Files.App/Data/Models/SelectedItemsPropertiesViewModel.cs index 18ac59ddf185..ace192cbf17b 100644 --- a/src/Files.App/Data/Models/SelectedItemsPropertiesViewModel.cs +++ b/src/Files.App/Data/Models/SelectedItemsPropertiesViewModel.cs @@ -635,7 +635,7 @@ public bool ShortcutItemArgumentsVisibility get => shortcutItemArgumentsVisibility; set => SetProperty(ref shortcutItemArgumentsVisibility, value); } - + private bool shortcutItemWindowArgsVisibility = false; public bool ShortcutItemWindowArgsVisibility { diff --git a/src/Files.App/Data/Models/TagViewModel.cs b/src/Files.App/Data/Models/TagViewModel.cs index 598fd5a0478f..cdcc36a8ed58 100644 --- a/src/Files.App/Data/Models/TagViewModel.cs +++ b/src/Files.App/Data/Models/TagViewModel.cs @@ -1,8 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using System.Text.Json.Serialization; - namespace Files.App.Data.Models { [Serializable] diff --git a/src/Files.App/Data/Parameters/ColumnParam.cs b/src/Files.App/Data/Parameters/ColumnParam.cs index 65753d883b01..2ce6e0e8f55d 100644 --- a/src/Files.App/Data/Parameters/ColumnParam.cs +++ b/src/Files.App/Data/Parameters/ColumnParam.cs @@ -1,8 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using Files.App.Views; -using Files.App.Views.Layouts; using Microsoft.UI.Xaml.Controls; namespace Files.App.Data.Parameters diff --git a/src/Files.App/Data/Parameters/TabBarItemParameter.cs b/src/Files.App/Data/Parameters/TabBarItemParameter.cs index 3443a3492c25..8c4c44f6949c 100644 --- a/src/Files.App/Data/Parameters/TabBarItemParameter.cs +++ b/src/Files.App/Data/Parameters/TabBarItemParameter.cs @@ -1,8 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using System.Text.Json; - namespace Files.App.Data.Parameters { public sealed class TabBarItemParameter diff --git a/src/Files.App/Data/TemplateSelectors/FileSystemDialogItemSelector.cs b/src/Files.App/Data/TemplateSelectors/FileSystemDialogItemSelector.cs index 49e2009f474d..6b5b82df50be 100644 --- a/src/Files.App/Data/TemplateSelectors/FileSystemDialogItemSelector.cs +++ b/src/Files.App/Data/TemplateSelectors/FileSystemDialogItemSelector.cs @@ -1,7 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using Files.App.ViewModels.Dialogs.FileSystemDialog; using Microsoft.UI.Xaml; namespace Files.App.Data.TemplateSelectors diff --git a/src/Files.App/Dialogs/AddBranchDialog.xaml.cs b/src/Files.App/Dialogs/AddBranchDialog.xaml.cs index 420f089419f9..0ced3d074fc2 100644 --- a/src/Files.App/Dialogs/AddBranchDialog.xaml.cs +++ b/src/Files.App/Dialogs/AddBranchDialog.xaml.cs @@ -1,7 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using Files.App.ViewModels.Dialogs; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; diff --git a/src/Files.App/Dialogs/AddItemDialog.xaml.cs b/src/Files.App/Dialogs/AddItemDialog.xaml.cs index f230d7ed0ad6..a68da84fed86 100644 --- a/src/Files.App/Dialogs/AddItemDialog.xaml.cs +++ b/src/Files.App/Dialogs/AddItemDialog.xaml.cs @@ -1,8 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using Files.App.ViewModels.Dialogs; -using Files.App.ViewModels.Dialogs.AddItemDialog; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; diff --git a/src/Files.App/Dialogs/CloneRepoDialog.xaml.cs b/src/Files.App/Dialogs/CloneRepoDialog.xaml.cs index bdfb0dd9a2c1..e3d7d92f563f 100644 --- a/src/Files.App/Dialogs/CloneRepoDialog.xaml.cs +++ b/src/Files.App/Dialogs/CloneRepoDialog.xaml.cs @@ -3,7 +3,6 @@ using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; -using Windows.ApplicationModel.DataTransfer; namespace Files.App.Dialogs { diff --git a/src/Files.App/Dialogs/CreateShortcutDialog.xaml.cs b/src/Files.App/Dialogs/CreateShortcutDialog.xaml.cs index 1909a21cd75e..086627286d85 100644 --- a/src/Files.App/Dialogs/CreateShortcutDialog.xaml.cs +++ b/src/Files.App/Dialogs/CreateShortcutDialog.xaml.cs @@ -1,8 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using Files.App.ViewModels.Dialogs; -using Files.App.ViewModels.Dialogs; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Data; diff --git a/src/Files.App/Dialogs/DecompressArchiveDialog.xaml.cs b/src/Files.App/Dialogs/DecompressArchiveDialog.xaml.cs index c795de3221fb..6f260b9325a9 100644 --- a/src/Files.App/Dialogs/DecompressArchiveDialog.xaml.cs +++ b/src/Files.App/Dialogs/DecompressArchiveDialog.xaml.cs @@ -1,7 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using Files.App.ViewModels.Dialogs; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; using System.Text; diff --git a/src/Files.App/Dialogs/DynamicDialog.xaml.cs b/src/Files.App/Dialogs/DynamicDialog.xaml.cs index 73277c28940e..73e5fc122692 100644 --- a/src/Files.App/Dialogs/DynamicDialog.xaml.cs +++ b/src/Files.App/Dialogs/DynamicDialog.xaml.cs @@ -1,7 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using Files.App.ViewModels.Dialogs; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; diff --git a/src/Files.App/Dialogs/ElevateConfirmDialog.xaml.cs b/src/Files.App/Dialogs/ElevateConfirmDialog.xaml.cs index a9360045a62a..88069e9170bc 100644 --- a/src/Files.App/Dialogs/ElevateConfirmDialog.xaml.cs +++ b/src/Files.App/Dialogs/ElevateConfirmDialog.xaml.cs @@ -1,11 +1,8 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using Files.App.ViewModels.Dialogs; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; -using System; -using System.Threading.Tasks; namespace Files.App.Dialogs { diff --git a/src/Files.App/Dialogs/ReorderSidebarItemsDialog.xaml.cs b/src/Files.App/Dialogs/ReorderSidebarItemsDialog.xaml.cs index 1f52db5576dc..b5be41005632 100644 --- a/src/Files.App/Dialogs/ReorderSidebarItemsDialog.xaml.cs +++ b/src/Files.App/Dialogs/ReorderSidebarItemsDialog.xaml.cs @@ -2,15 +2,9 @@ // Licensed under the MIT License. using CommunityToolkit.WinUI; -using Files.App.Data.Items; -using Files.App.Extensions; -using Files.App.ViewModels.Dialogs; -using Files.App.ViewModels.Dialogs; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Input; -using System; -using System.Threading.Tasks; using Windows.ApplicationModel.DataTransfer; namespace Files.App.Dialogs @@ -59,7 +53,7 @@ private void ListViewItem_DragOver(object sender, DragEventArgs e) if ((sender as Grid)?.DataContext is not LocationItem locationItem) return; var deferral = e.GetDeferral(); - + if ((e.DataView.Properties["sourceLocationItem"] as Grid)?.DataContext is LocationItem sourceLocationItem) { DragOver_SetCaptions(sourceLocationItem, locationItem, e); diff --git a/src/Files.App/Dialogs/SettingsDialog.xaml.cs b/src/Files.App/Dialogs/SettingsDialog.xaml.cs index 27ba9a61b38a..6bb9b809385d 100644 --- a/src/Files.App/Dialogs/SettingsDialog.xaml.cs +++ b/src/Files.App/Dialogs/SettingsDialog.xaml.cs @@ -37,7 +37,7 @@ public void NavigateTo(SettingsNavigationParams navParams) ); if (oldSelection is not null) oldSelection.IsSelected = false; - + MainSettingsNavigationView.SelectedItem = targetSection; } diff --git a/src/Files.App/Extensions/EnumExtensions.cs b/src/Files.App/Extensions/EnumExtensions.cs index 3d5a4b7ecbde..ab3759d85da3 100644 --- a/src/Files.App/Extensions/EnumExtensions.cs +++ b/src/Files.App/Extensions/EnumExtensions.cs @@ -1,7 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using System; using System.Reflection; namespace Files.App.Extensions diff --git a/src/Files.App/Extensions/ImageSourceExtensions.cs b/src/Files.App/Extensions/ImageSourceExtensions.cs index a05692d37312..313e1d8dd0c1 100644 --- a/src/Files.App/Extensions/ImageSourceExtensions.cs +++ b/src/Files.App/Extensions/ImageSourceExtensions.cs @@ -1,11 +1,8 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using System; using System.IO; using System.Runtime.InteropServices.WindowsRuntime; -using System.Threading; -using System.Threading.Tasks; using Windows.Storage; using Windows.Storage.Streams; diff --git a/src/Files.App/Extensions/LocalizationExtensions.cs b/src/Files.App/Extensions/LocalizationExtensions.cs index 6331b13126a2..ce7862811e6c 100644 --- a/src/Files.App/Extensions/LocalizationExtensions.cs +++ b/src/Files.App/Extensions/LocalizationExtensions.cs @@ -1,8 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using Files.App.Services; - namespace Files.App.Extensions { /// diff --git a/src/Files.App/Extensions/MessageFormatExtensions.cs b/src/Files.App/Extensions/MessageFormatExtensions.cs index 1de281ff2799..a0ac3702ac30 100644 --- a/src/Files.App/Extensions/MessageFormatExtensions.cs +++ b/src/Files.App/Extensions/MessageFormatExtensions.cs @@ -2,9 +2,9 @@ // Licensed under the MIT License. using Jeffijoe.MessageFormat; +using Microsoft.Extensions.Logging; using Microsoft.Windows.ApplicationModel.Resources; using System.Globalization; -using Microsoft.Extensions.Logging; namespace Files.App.Extensions { diff --git a/src/Files.App/Extensions/ShellNewEntryExtensions.cs b/src/Files.App/Extensions/ShellNewEntryExtensions.cs index e09ad6e7fb2f..00cedd074d9b 100644 --- a/src/Files.App/Extensions/ShellNewEntryExtensions.cs +++ b/src/Files.App/Extensions/ShellNewEntryExtensions.cs @@ -1,15 +1,7 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using Files.App.Utils; -using Files.App.Helpers; -using Files.App.Utils.Shell; -using Files.Shared; -using Files.Shared.Extensions; -using System; -using System.Collections.Generic; using System.IO; -using System.Threading.Tasks; using Windows.Storage; namespace Files.App.Extensions diff --git a/src/Files.App/Extensions/Win32FindDataExtensions.cs b/src/Files.App/Extensions/Win32FindDataExtensions.cs index 1e3d9a8ba927..3971145beac6 100644 --- a/src/Files.App/Extensions/Win32FindDataExtensions.cs +++ b/src/Files.App/Extensions/Win32FindDataExtensions.cs @@ -1,8 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using static Files.App.Helpers.Win32Helper; - namespace Files.App.Extensions { public static class Win32FindDataExtensions diff --git a/src/Files.App/Helpers/Application/AppToastNotificationHelper.cs b/src/Files.App/Helpers/Application/AppToastNotificationHelper.cs index e34ce4c4df26..a73201c093bd 100644 --- a/src/Files.App/Helpers/Application/AppToastNotificationHelper.cs +++ b/src/Files.App/Helpers/Application/AppToastNotificationHelper.cs @@ -1,10 +1,5 @@ using Microsoft.Windows.AppNotifications; using Microsoft.Windows.AppNotifications.Builder; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Files.App.Helpers.Application { diff --git a/src/Files.App/Helpers/CollectionDebugView.cs b/src/Files.App/Helpers/CollectionDebugView.cs index 6ad43496debe..11a933c85ac9 100644 --- a/src/Files.App/Helpers/CollectionDebugView.cs +++ b/src/Files.App/Helpers/CollectionDebugView.cs @@ -1,10 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using System; -using System.Collections.Generic; -using System.Diagnostics; - namespace Files.App.Helpers { internal sealed class CollectionDebugView diff --git a/src/Files.App/Helpers/CredentialsHelpers.cs b/src/Files.App/Helpers/CredentialsHelpers.cs index 334dd752200c..10d3b3bc1412 100644 --- a/src/Files.App/Helpers/CredentialsHelpers.cs +++ b/src/Files.App/Helpers/CredentialsHelpers.cs @@ -1,5 +1,4 @@ -using System.Runtime.InteropServices; -using Windows.Security.Credentials; +using Windows.Security.Credentials; namespace Files.App.Helpers { diff --git a/src/Files.App/Helpers/Dialog/DynamicDialogFactory.cs b/src/Files.App/Helpers/Dialog/DynamicDialogFactory.cs index 3608b91bc045..a6468fbafaa9 100644 --- a/src/Files.App/Helpers/Dialog/DynamicDialogFactory.cs +++ b/src/Files.App/Helpers/Dialog/DynamicDialogFactory.cs @@ -424,7 +424,7 @@ await commands.OpenSettings.ExecuteAsync( new SettingsNavigationParams() { PageKind = SettingsPageKind.DevToolsPage } ); } - + public static async Task ShowFor_CannotCloneRepo(string exception) { var dialog = new DynamicDialog(new DynamicDialogViewModel() diff --git a/src/Files.App/Helpers/Environment/PackageHelper.cs b/src/Files.App/Helpers/Environment/PackageHelper.cs index bfd9712fd699..f9c54130ce64 100644 --- a/src/Files.App/Helpers/Environment/PackageHelper.cs +++ b/src/Files.App/Helpers/Environment/PackageHelper.cs @@ -1,9 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using System; -using System.Diagnostics; -using System.Threading.Tasks; using Windows.System; namespace Files.App.Helpers diff --git a/src/Files.App/Helpers/IntervalSampler.cs b/src/Files.App/Helpers/IntervalSampler.cs index e9c64671440f..1518f4c0aa73 100644 --- a/src/Files.App/Helpers/IntervalSampler.cs +++ b/src/Files.App/Helpers/IntervalSampler.cs @@ -1,8 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using System; - namespace Files.App.Helpers { internal sealed class IntervalSampler diff --git a/src/Files.App/Helpers/Layout/AdaptiveLayoutHelpers.cs b/src/Files.App/Helpers/Layout/AdaptiveLayoutHelpers.cs index 2936632cf414..83c5ebe14eaa 100644 --- a/src/Files.App/Helpers/Layout/AdaptiveLayoutHelpers.cs +++ b/src/Files.App/Helpers/Layout/AdaptiveLayoutHelpers.cs @@ -93,7 +93,7 @@ static bool IsImage(ListedItem item) static bool IsMedia(ListedItem item) => !string.IsNullOrEmpty(item.FileExtension) - && (FileExtensionHelpers.IsAudioFile(item.FileExtension) + && (FileExtensionHelpers.IsAudioFile(item.FileExtension) || FileExtensionHelpers.IsVideoFile(item.FileExtension)); } diff --git a/src/Files.App/Helpers/Layout/LayoutPreferencesDatabaseManager.cs b/src/Files.App/Helpers/Layout/LayoutPreferencesDatabaseManager.cs index 5e9699102c03..14ae02bd94ed 100644 --- a/src/Files.App/Helpers/Layout/LayoutPreferencesDatabaseManager.cs +++ b/src/Files.App/Helpers/Layout/LayoutPreferencesDatabaseManager.cs @@ -1,8 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using System.Diagnostics.CodeAnalysis; - namespace Files.App.Helpers { /// diff --git a/src/Files.App/Helpers/NaturalStringComparer.cs b/src/Files.App/Helpers/NaturalStringComparer.cs index 399ee10bcbbe..6108d604c0b4 100644 --- a/src/Files.App/Helpers/NaturalStringComparer.cs +++ b/src/Files.App/Helpers/NaturalStringComparer.cs @@ -21,47 +21,47 @@ public static IComparer GetForProcessor() /// private sealed class NaturalComparer : IComparer, IComparer, IComparer> { - private readonly StringComparison stringComparison; - - public NaturalComparer(StringComparison stringComparison = StringComparison.Ordinal) - { - this.stringComparison = stringComparison; - } - - public int Compare(object? x, object? y) - { - if (x == y) return 0; - if (x == null) return -1; - if (y == null) return 1; - - return x switch - { - string x1 when y is string y1 => Compare(x1.AsSpan(), y1.AsSpan(), stringComparison), - IComparable comparable => comparable.CompareTo(y), - _ => StringComparer.FromComparison(stringComparison).Compare(x, y) - }; - } - - public int Compare(string? x, string? y) - { - if (ReferenceEquals(x, y)) return 0; - if (x is null) return -1; - if (y is null) return 1; - - return Compare(x.AsSpan(), y.AsSpan(), stringComparison); - } - - public int Compare(ReadOnlySpan x, ReadOnlySpan y) - { - return Compare(x, y, stringComparison); - } - - public int Compare(ReadOnlyMemory x, ReadOnlyMemory y) - { - return Compare(x.Span, y.Span, stringComparison); - } - - public static int Compare(ReadOnlySpan x, ReadOnlySpan y, StringComparison stringComparison) + private readonly StringComparison stringComparison; + + public NaturalComparer(StringComparison stringComparison = StringComparison.Ordinal) + { + this.stringComparison = stringComparison; + } + + public int Compare(object? x, object? y) + { + if (x == y) return 0; + if (x == null) return -1; + if (y == null) return 1; + + return x switch + { + string x1 when y is string y1 => Compare(x1.AsSpan(), y1.AsSpan(), stringComparison), + IComparable comparable => comparable.CompareTo(y), + _ => StringComparer.FromComparison(stringComparison).Compare(x, y) + }; + } + + public int Compare(string? x, string? y) + { + if (ReferenceEquals(x, y)) return 0; + if (x is null) return -1; + if (y is null) return 1; + + return Compare(x.AsSpan(), y.AsSpan(), stringComparison); + } + + public int Compare(ReadOnlySpan x, ReadOnlySpan y) + { + return Compare(x, y, stringComparison); + } + + public int Compare(ReadOnlyMemory x, ReadOnlyMemory y) + { + return Compare(x.Span, y.Span, stringComparison); + } + + public static int Compare(ReadOnlySpan x, ReadOnlySpan y, StringComparison stringComparison) { // Handle file extensions specially int xExtPos = GetExtensionPosition(x); @@ -70,9 +70,9 @@ public static int Compare(ReadOnlySpan x, ReadOnlySpan y, StringComp // If both have extensions, compare the names first if (xExtPos >= 0 && yExtPos >= 0) { - var xName = x.Slice(0, xExtPos); + var xName = x.Slice(0, xExtPos); var yName = y.Slice(0, yExtPos); - + int nameCompare = CompareWithoutExtension(xName, yName, stringComparison); if (nameCompare != 0) return nameCompare; @@ -143,35 +143,35 @@ private static bool IsIgnorableSeparator(ReadOnlySpan span, int index) } - private static ReadOnlySpan GetNumber(ReadOnlySpan span, out ReadOnlySpan number) - { - var i = 0; - while (i < span.Length && char.IsDigit(span[i])) - { - i++; - } + private static ReadOnlySpan GetNumber(ReadOnlySpan span, out ReadOnlySpan number) + { + var i = 0; + while (i < span.Length && char.IsDigit(span[i])) + { + i++; + } - number = span.Slice(0, i); - return span.Slice(i); - } + number = span.Slice(0, i); + return span.Slice(i); + } - private static int CompareNumValues(ReadOnlySpan numValue1, ReadOnlySpan numValue2) - { - var num1AsSpan = numValue1.TrimStart('0'); - var num2AsSpan = numValue2.TrimStart('0'); + private static int CompareNumValues(ReadOnlySpan numValue1, ReadOnlySpan numValue2) + { + var num1AsSpan = numValue1.TrimStart('0'); + var num2AsSpan = numValue2.TrimStart('0'); - if (num1AsSpan.Length < num2AsSpan.Length) return -1; + if (num1AsSpan.Length < num2AsSpan.Length) return -1; - if (num1AsSpan.Length > num2AsSpan.Length) return 1; + if (num1AsSpan.Length > num2AsSpan.Length) return 1; - var compareResult = num1AsSpan.CompareTo(num2AsSpan, StringComparison.Ordinal); + var compareResult = num1AsSpan.CompareTo(num2AsSpan, StringComparison.Ordinal); - if (compareResult != 0) return Math.Sign(compareResult); + if (compareResult != 0) return Math.Sign(compareResult); - if (numValue2.Length == numValue1.Length) return compareResult; + if (numValue2.Length == numValue1.Length) return compareResult; - return numValue2.Length < numValue1.Length ? -1 : 1; // "033" < "33" == true - } + return numValue2.Length < numValue1.Length ? -1 : 1; // "033" < "33" == true + } } } } diff --git a/src/Files.App/Helpers/Navigation/MultitaskingTabsHelpers.cs b/src/Files.App/Helpers/Navigation/MultitaskingTabsHelpers.cs index 2e4b347fddd9..f24bc2d5a97f 100644 --- a/src/Files.App/Helpers/Navigation/MultitaskingTabsHelpers.cs +++ b/src/Files.App/Helpers/Navigation/MultitaskingTabsHelpers.cs @@ -1,11 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using Files.App.UserControls.TabBar; -using Files.App.ViewModels; -using System.Linq; -using System.Threading.Tasks; - namespace Files.App.Helpers { public static class MultitaskingTabsHelpers @@ -40,7 +35,7 @@ public static void CloseOtherTabs(TabBarItem clickedTab, ITabBar multitaskingCon tabs.Where((t) => t != clickedTab).ToList().ForEach(tab => multitaskingControl.CloseTab(tab)); } } - + public static void CloseAllTabs(ITabBar multitaskingControl) { if (multitaskingControl is not null) diff --git a/src/Files.App/Helpers/Navigation/NavigationHelpers.cs b/src/Files.App/Helpers/Navigation/NavigationHelpers.cs index 079f61a77340..0723bc313e09 100644 --- a/src/Files.App/Helpers/Navigation/NavigationHelpers.cs +++ b/src/Files.App/Helpers/Navigation/NavigationHelpers.cs @@ -198,7 +198,7 @@ private static async Task UpdateTabInfoAsync(TabBarItem tabItem, object navigati iconSource.ImageSource = new BitmapImage(new Uri(Constants.FluentIconsPaths.HomeIcon)); } else if (currentPath == "ReleaseNotes") - { + { tabLocationHeader = Strings.ReleaseNotes.GetLocalizedResource(); iconSource.ImageSource = new BitmapImage(new Uri(AppLifecycleHelper.AppIconPath)); } @@ -489,7 +489,8 @@ public static async Task OpenPath(string path, IShellPage associatedInstan opened = await OpenFile(path, associatedInstance, shortcutInfo, openViaApplicationPicker, args); break; - }; + } + ; if (opened.ErrorCode == FileSystemStatusCode.NotFound && !openSilent) { diff --git a/src/Files.App/Helpers/Navigation/NavigationInteractionTracker.cs b/src/Files.App/Helpers/Navigation/NavigationInteractionTracker.cs index a10a0c268041..5c6886a794cf 100644 --- a/src/Files.App/Helpers/Navigation/NavigationInteractionTracker.cs +++ b/src/Files.App/Helpers/Navigation/NavigationInteractionTracker.cs @@ -221,7 +221,7 @@ public void IdleStateEntered(InteractionTracker sender, InteractionTrackerIdleSt } } else - { + { _parent._tracker.TryUpdatePositionWithAnimation(_returnAnimation); } _shouldBounceBack = false; diff --git a/src/Files.App/Helpers/PathNormalization.cs b/src/Files.App/Helpers/PathNormalization.cs index 58b55ff76b92..b992063950c6 100644 --- a/src/Files.App/Helpers/PathNormalization.cs +++ b/src/Files.App/Helpers/PathNormalization.cs @@ -2,7 +2,6 @@ // Licensed under the MIT License. using Microsoft.Extensions.Logging; -using System; using System.IO; namespace Files.App.Helpers diff --git a/src/Files.App/Helpers/RegexHelpers.cs b/src/Files.App/Helpers/RegexHelpers.cs index 79b19c69ef5b..309dfb6f7785 100644 --- a/src/Files.App/Helpers/RegexHelpers.cs +++ b/src/Files.App/Helpers/RegexHelpers.cs @@ -9,22 +9,22 @@ public static partial class RegexHelpers { [GeneratedRegex(@"\w:\w")] public static partial Regex AlternateStream(); - + [GeneratedRegex("(?<=^[^\"]*(?:\"[^\"]*\"[^\"]*)*) (?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)")] public static partial Regex SpaceSplit(); - + [GeneratedRegex(@"^\\\\\?\\[^\\]*\\?")] public static partial Regex WindowsPath(); - + [GeneratedRegex(@"^[A-Z]:\\\$Recycle\.Bin\\", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant)] public static partial Regex RecycleBinPath(); - + [GeneratedRegex(@"^(?!/)(?!.*//)[^\000-\037\177 ~^:?*[]+(?!.*\.\.)(?!.*@\{)(?!.*\\)(? diff --git a/src/Files.App/Helpers/Win32/Win32Helper.Storage.cs b/src/Files.App/Helpers/Win32/Win32Helper.Storage.cs index 7e878896a3f9..93b28ad04429 100644 --- a/src/Files.App/Helpers/Win32/Win32Helper.Storage.cs +++ b/src/Files.App/Helpers/Win32/Win32Helper.Storage.cs @@ -14,9 +14,7 @@ using Vanara.PInvoke; using Windows.System; using Windows.Win32; -using Windows.Win32.Foundation; using Windows.Win32.Storage.FileSystem; -using static Vanara.PInvoke.Kernel32; using COMPRESSION_FORMAT = Windows.Win32.Storage.FileSystem.COMPRESSION_FORMAT; using HRESULT = Vanara.PInvoke.HRESULT; using HWND = Vanara.PInvoke.HWND; diff --git a/src/Files.App/Helpers/Win32/Win32Helper.WindowManagement.cs b/src/Files.App/Helpers/Win32/Win32Helper.WindowManagement.cs index b502d87c1f70..996c7af3bed7 100644 --- a/src/Files.App/Helpers/Win32/Win32Helper.WindowManagement.cs +++ b/src/Files.App/Helpers/Win32/Win32Helper.WindowManagement.cs @@ -1,9 +1,6 @@ // Copyright (c) 2024 Files Community // Licensed under the MIT License. See the LICENSE. -using Microsoft.UI.Input; -using Microsoft.UI.Xaml; -using System.Reflection; using System.Runtime.InteropServices; using Windows.Win32; using Windows.Win32.UI.WindowsAndMessaging; diff --git a/src/Files.App/Helpers/Xaml/DependencyObjectHelpers.cs b/src/Files.App/Helpers/Xaml/DependencyObjectHelpers.cs index 8924da55ba44..938bf6917776 100644 --- a/src/Files.App/Helpers/Xaml/DependencyObjectHelpers.cs +++ b/src/Files.App/Helpers/Xaml/DependencyObjectHelpers.cs @@ -3,8 +3,6 @@ using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Media; -using System; -using System.Collections.Generic; using System.Reflection; namespace Files.App.Helpers diff --git a/src/Files.App/MainWindow.xaml.cs b/src/Files.App/MainWindow.xaml.cs index 6dcfc8b56310..8aeea54bb927 100644 --- a/src/Files.App/MainWindow.xaml.cs +++ b/src/Files.App/MainWindow.xaml.cs @@ -277,7 +277,7 @@ async Task PerformNavigationAsync(string payload, string selectItem = null) .Select((tabItem, idx) => new { tabItem, idx }) .FirstOrDefault(x => x.tabItem.NavigationParameter.NavigationParameter is PaneNavigationArguments paneArgs && - (paneNavigationArgs.LeftPaneNavPathParam == paneArgs.LeftPaneNavPathParam || + (paneNavigationArgs.LeftPaneNavPathParam == paneArgs.LeftPaneNavPathParam || paneNavigationArgs.LeftPaneNavPathParam == paneArgs.RightPaneNavPathParam))?.idx ?? -1; if (existingTabIndex >= 0) diff --git a/src/Files.App/Services/App/AppDialogService.cs b/src/Files.App/Services/App/AppDialogService.cs index d5859b77d53d..418eaf3d6d55 100644 --- a/src/Files.App/Services/App/AppDialogService.cs +++ b/src/Files.App/Services/App/AppDialogService.cs @@ -1,15 +1,10 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using System.Collections.Frozen; using Files.App.Dialogs; -using Files.App.ViewModels.Dialogs; -using Files.App.Services; -using Files.App.ViewModels.Dialogs; -using Files.App.ViewModels.Dialogs.AddItemDialog; -using Files.App.ViewModels.Dialogs.FileSystemDialog; using Microsoft.Extensions.Logging; using Microsoft.UI.Xaml.Controls; +using System.Collections.Frozen; using Windows.Foundation.Metadata; namespace Files.App.Services diff --git a/src/Files.App/Services/App/AppResourcesService.cs b/src/Files.App/Services/App/AppResourcesService.cs index 4718d8d8f0fd..c3bf262d108d 100644 --- a/src/Files.App/Services/App/AppResourcesService.cs +++ b/src/Files.App/Services/App/AppResourcesService.cs @@ -10,7 +10,7 @@ namespace Files.App.Services public sealed class ResourcesService : IResourcesService { private IAppThemeModeService AppThemeModeService { get; } = Ioc.Default.GetRequiredService(); - + /// public void SetAppThemeBackgroundColor(Color appThemeBackgroundColor) { @@ -31,7 +31,7 @@ public void SetAppThemeToolbarBackgroundColor(Color appThemeToolbarBackgroundCol { Application.Current.Resources["App.Theme.Toolbar.BackgroundBrush"] = appThemeToolbarBackgroundColor; } - + /// public void SetAppThemeSidebarBackgroundColor(Color appThemeSidebarBackgroundColor) { @@ -43,7 +43,7 @@ public void SetAppThemeFileAreaBackgroundColor(Color appThemeFileAreaBackgroundC { Application.Current.Resources["App.Theme.FileArea.BackgroundBrush"] = appThemeFileAreaBackgroundColor; } - + /// public void SetAppThemeFileAreaSecondaryBackgroundColor(Color appThemeFileAreaSecondaryBackgroundColor) { diff --git a/src/Files.App/Services/App/AppUpdateStoreService.cs b/src/Files.App/Services/App/AppUpdateStoreService.cs index 7d2a2d533150..6964c0f67b36 100644 --- a/src/Files.App/Services/App/AppUpdateStoreService.cs +++ b/src/Files.App/Services/App/AppUpdateStoreService.cs @@ -1,7 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using CommunityToolkit.WinUI.Helpers; using Microsoft.Extensions.Logging; using Microsoft.UI.Xaml.Controls; using System.IO; diff --git a/src/Files.App/Services/DateTimeFormatter/AbstractDateTimeFormatter.cs b/src/Files.App/Services/DateTimeFormatter/AbstractDateTimeFormatter.cs index 9437eb26e0b9..f690ddfecc0e 100644 --- a/src/Files.App/Services/DateTimeFormatter/AbstractDateTimeFormatter.cs +++ b/src/Files.App/Services/DateTimeFormatter/AbstractDateTimeFormatter.cs @@ -2,7 +2,6 @@ // Licensed under the MIT License. using System.Globalization; -using Windows.Globalization; namespace Files.App.Services.DateTimeFormatter { diff --git a/src/Files.App/Services/DateTimeFormatter/DateTimeFormatterFactory.cs b/src/Files.App/Services/DateTimeFormatter/DateTimeFormatterFactory.cs index 54b4b5f5abe3..cb13916e8b6b 100644 --- a/src/Files.App/Services/DateTimeFormatter/DateTimeFormatterFactory.cs +++ b/src/Files.App/Services/DateTimeFormatter/DateTimeFormatterFactory.cs @@ -1,8 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using System; - namespace Files.App.Services.DateTimeFormatter { public sealed class DateTimeFormatterFactory : IDateTimeFormatterFactory diff --git a/src/Files.App/Services/DateTimeFormatter/SystemDateTimeFormatter.cs b/src/Files.App/Services/DateTimeFormatter/SystemDateTimeFormatter.cs index 79aa2251e7a9..294593056a7d 100644 --- a/src/Files.App/Services/DateTimeFormatter/SystemDateTimeFormatter.cs +++ b/src/Files.App/Services/DateTimeFormatter/SystemDateTimeFormatter.cs @@ -1,9 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using Files.App.Extensions; -using System; - namespace Files.App.Services.DateTimeFormatter { internal sealed class SystemDateTimeFormatter : AbstractDateTimeFormatter diff --git a/src/Files.App/Services/DateTimeFormatter/UniversalDateTimeFormatter.cs b/src/Files.App/Services/DateTimeFormatter/UniversalDateTimeFormatter.cs index 1271f73652df..cb08253fabc9 100644 --- a/src/Files.App/Services/DateTimeFormatter/UniversalDateTimeFormatter.cs +++ b/src/Files.App/Services/DateTimeFormatter/UniversalDateTimeFormatter.cs @@ -1,9 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using Files.App.Extensions; -using System; - namespace Files.App.Services.DateTimeFormatter { internal sealed class UniversalDateTimeFormatter : AbstractDateTimeFormatter diff --git a/src/Files.App/Services/PreviewPopupProviders/PreviewPopupService.cs b/src/Files.App/Services/PreviewPopupProviders/PreviewPopupService.cs index c6408ef4a842..a09e4849c72c 100644 --- a/src/Files.App/Services/PreviewPopupProviders/PreviewPopupService.cs +++ b/src/Files.App/Services/PreviewPopupProviders/PreviewPopupService.cs @@ -1,8 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using Files.App.Services.PreviewPopupProviders; - namespace Files.App.Services.PreviewPopupProviders { /// diff --git a/src/Files.App/Services/PreviewPopupProviders/SeerProProvider.cs b/src/Files.App/Services/PreviewPopupProviders/SeerProProvider.cs index c5a39d53355d..7141c8d5ce24 100644 --- a/src/Files.App/Services/PreviewPopupProviders/SeerProProvider.cs +++ b/src/Files.App/Services/PreviewPopupProviders/SeerProProvider.cs @@ -52,7 +52,7 @@ public async Task SwitchPreviewAsync(string path) if (!IsTrackSelectionSettingEnabled && !string.IsNullOrEmpty(CurrentPath)) { await TogglePreviewPopupAsync(CurrentPath); - return; + return; } // Update the preview window if the path changed diff --git a/src/Files.App/Services/Settings/ApplicationSettingsService.cs b/src/Files.App/Services/Settings/ApplicationSettingsService.cs index 769995db9368..0ad454c44db0 100644 --- a/src/Files.App/Services/Settings/ApplicationSettingsService.cs +++ b/src/Files.App/Services/Settings/ApplicationSettingsService.cs @@ -1,9 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using Files.App.Utils.Serialization; -using Files.App.Services.Settings; - namespace Files.App.Services.Settings { internal sealed partial class ApplicationSettingsService : BaseObservableJsonSettings, IApplicationSettingsService @@ -19,13 +16,13 @@ public bool HasClickedSponsorPrompt get => Get(false); set => Set(value); } - + public bool ShowRunningAsAdminPrompt { get => Get(true); set => Set(value); } - + public bool ShowDataStreamsAreHiddenPrompt { get => Get(true); diff --git a/src/Files.App/Services/Settings/FileTagsSettingsService.cs b/src/Files.App/Services/Settings/FileTagsSettingsService.cs index 3c999b59f43b..c44d3ecf299c 100644 --- a/src/Files.App/Services/Settings/FileTagsSettingsService.cs +++ b/src/Files.App/Services/Settings/FileTagsSettingsService.cs @@ -1,16 +1,10 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using Files.App.Extensions; -using Files.App.Utils; -using Files.App.Helpers; -using Files.App.Utils.Serialization; using Files.App.Utils.Serialization.Implementation; -using Files.App.Services.Settings; using Microsoft.Extensions.Logging; using System.IO; using Windows.Storage; -using CommunityToolkit.WinUI.Helpers; namespace Files.App.Services.Settings { diff --git a/src/Files.App/Services/Settings/UserSettingsService.cs b/src/Files.App/Services/Settings/UserSettingsService.cs index 8af8a85a37db..590bb6bf8ae5 100644 --- a/src/Files.App/Services/Settings/UserSettingsService.cs +++ b/src/Files.App/Services/Settings/UserSettingsService.cs @@ -1,12 +1,7 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using CommunityToolkit.Mvvm.DependencyInjection; -using Files.App.Utils.Serialization; using Files.App.Utils.Serialization.Implementation; -using Files.App.Services.Settings; -using Files.Shared.Extensions; -using System.Collections.Generic; using System.IO; using Windows.Storage; diff --git a/src/Files.App/Services/SizeProvider/CachedSizeProvider.cs b/src/Files.App/Services/SizeProvider/CachedSizeProvider.cs index b55c3287a50f..e3ca98eb91be 100644 --- a/src/Files.App/Services/SizeProvider/CachedSizeProvider.cs +++ b/src/Files.App/Services/SizeProvider/CachedSizeProvider.cs @@ -1,13 +1,8 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using Files.App.Extensions; -using System; using System.Collections.Concurrent; using System.IO; -using System.Threading; -using System.Threading.Tasks; -using static Files.App.Helpers.Win32Helper; namespace Files.App.Services.SizeProvider { diff --git a/src/Files.App/Services/SizeProvider/DrivesSizeProvider.cs b/src/Files.App/Services/SizeProvider/DrivesSizeProvider.cs index 5026e5c45a20..beb54dc2cff1 100644 --- a/src/Files.App/Services/SizeProvider/DrivesSizeProvider.cs +++ b/src/Files.App/Services/SizeProvider/DrivesSizeProvider.cs @@ -1,12 +1,8 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using System; using System.Collections.Concurrent; using System.IO; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; namespace Files.App.Services.SizeProvider { diff --git a/src/Files.App/Services/SizeProvider/ISizeProvider.cs b/src/Files.App/Services/SizeProvider/ISizeProvider.cs index eb72f244e114..1ce8ccfe1f09 100644 --- a/src/Files.App/Services/SizeProvider/ISizeProvider.cs +++ b/src/Files.App/Services/SizeProvider/ISizeProvider.cs @@ -1,10 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using System; -using System.Threading; -using System.Threading.Tasks; - namespace Files.App.Services.SizeProvider { public interface ISizeProvider : IDisposable diff --git a/src/Files.App/Services/SizeProvider/NoSizeProvider.cs b/src/Files.App/Services/SizeProvider/NoSizeProvider.cs index d8d51e3dca32..5b20daa3b98d 100644 --- a/src/Files.App/Services/SizeProvider/NoSizeProvider.cs +++ b/src/Files.App/Services/SizeProvider/NoSizeProvider.cs @@ -1,10 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using System; -using System.Threading; -using System.Threading.Tasks; - namespace Files.App.Services.SizeProvider { public sealed partial class NoSizeProvider : ISizeProvider diff --git a/src/Files.App/Services/SizeProvider/SizeChangedEventArgs.cs b/src/Files.App/Services/SizeProvider/SizeChangedEventArgs.cs index 6452d86c8f31..9d57f65d7ae9 100644 --- a/src/Files.App/Services/SizeProvider/SizeChangedEventArgs.cs +++ b/src/Files.App/Services/SizeProvider/SizeChangedEventArgs.cs @@ -1,8 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using System; - namespace Files.App.Services.SizeProvider { public sealed class SizeChangedEventArgs : EventArgs diff --git a/src/Files.App/Services/Storage/StorageDevicesService.cs b/src/Files.App/Services/Storage/StorageDevicesService.cs index 7aed69898901..c29ca0b4f485 100644 --- a/src/Files.App/Services/Storage/StorageDevicesService.cs +++ b/src/Files.App/Services/Storage/StorageDevicesService.cs @@ -2,9 +2,9 @@ // Licensed under the MIT License. using Microsoft.Extensions.Logging; +using OwlCore.Storage.System.IO; using System.IO; using Windows.Storage; -using OwlCore.Storage.System.IO; namespace Files.App.Services { diff --git a/src/Files.App/Services/Storage/StorageNetworkService.cs b/src/Files.App/Services/Storage/StorageNetworkService.cs index 0ee1b5881fc0..5cea00e864a1 100644 --- a/src/Files.App/Services/Storage/StorageNetworkService.cs +++ b/src/Files.App/Services/Storage/StorageNetworkService.cs @@ -209,24 +209,24 @@ public async Task AuthenticateNetworkShare(string path) unsafe { - if (!path.StartsWith(@"\\", StringComparison.Ordinal)) + if (!path.StartsWith(@"\\", StringComparison.Ordinal)) { // Special handling for network drives - // This part will change path from "y:\Download" to "\\192.168.0.1\nfs\Download" + // This part will change path from "y:\Download" to "\\192.168.0.1\nfs\Download" [DllImport("mpr.dll", CharSet = CharSet.Auto)] static extern int WNetGetConnection(string lpLocalName, StringBuilder lpRemoteName, ref int lpnLength); - + StringBuilder remoteName = new StringBuilder(300); int length = remoteName.Capacity; string lpLocalName = path.Substring(0, 2); int ret = WNetGetConnection(lpLocalName, remoteName, ref length); - if ( ret == 0 ) + if (ret == 0) path = path.Replace(lpLocalName, remoteName.ToString()); } - + fixed (char* lpcPath = path) netRes.lpRemoteName = new PWSTR(lpcPath); } diff --git a/src/Files.App/Services/Windows/WindowsJumpListService.cs b/src/Files.App/Services/Windows/WindowsJumpListService.cs index 5678331dbb3d..5c1c8b9d1abb 100644 --- a/src/Files.App/Services/Windows/WindowsJumpListService.cs +++ b/src/Files.App/Services/Windows/WindowsJumpListService.cs @@ -3,7 +3,6 @@ using Microsoft.Extensions.Logging; using System.IO; -using Windows.Storage; using Windows.UI.StartScreen; namespace Files.App.Services diff --git a/src/Files.App/Services/Windows/WindowsQuickAccessService.cs b/src/Files.App/Services/Windows/WindowsQuickAccessService.cs index 616e1d9468a8..b060f123a4d0 100644 --- a/src/Files.App/Services/Windows/WindowsQuickAccessService.cs +++ b/src/Files.App/Services/Windows/WindowsQuickAccessService.cs @@ -1,10 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using Files.App.Utils.Shell; -using Files.App.UserControls.Widgets; -using Files.App.Helpers; - namespace Files.App.Services { internal sealed class QuickAccessService : IQuickAccessService diff --git a/src/Files.App/Services/Windows/WindowsRecentItemsService.cs b/src/Files.App/Services/Windows/WindowsRecentItemsService.cs index ea604e417c50..8d2786b25725 100644 --- a/src/Files.App/Services/Windows/WindowsRecentItemsService.cs +++ b/src/Files.App/Services/Windows/WindowsRecentItemsService.cs @@ -3,11 +3,9 @@ using Microsoft.Extensions.Logging; using System.Collections.Specialized; -using System.Runtime.InteropServices; using System.Text; using Windows.Win32; using Windows.Win32.Foundation; -using Windows.Win32.System.Com; using Windows.Win32.System.SystemServices; using Windows.Win32.UI.Shell; using Windows.Win32.UI.WindowsAndMessaging; @@ -271,9 +269,9 @@ private unsafe bool UpdateRecentItems(bool isFolder) var eventArgs = GetChangedActionEventArgs(snapshot, recentItems); if (isFolder) - RecentFoldersChanged?.Invoke(this, eventArgs); + RecentFoldersChanged?.Invoke(this, eventArgs); else - RecentFilesChanged?.Invoke(this, eventArgs); + RecentFilesChanged?.Invoke(this, eventArgs); return true; } diff --git a/src/Files.App/Services/Windows/WindowsStartMenuService.cs b/src/Files.App/Services/Windows/WindowsStartMenuService.cs index cfc6783c95bb..4ff2b4027663 100644 --- a/src/Files.App/Services/Windows/WindowsStartMenuService.cs +++ b/src/Files.App/Services/Windows/WindowsStartMenuService.cs @@ -1,5 +1,4 @@ -using Files.Core.Storage; -using Windows.UI.StartScreen; +using Windows.UI.StartScreen; namespace Files.App.Services { diff --git a/src/Files.App/Services/Windows/WindowsWallpaperService.cs b/src/Files.App/Services/Windows/WindowsWallpaperService.cs index 502a2759c9aa..6aa7e1abc5de 100644 --- a/src/Files.App/Services/Windows/WindowsWallpaperService.cs +++ b/src/Files.App/Services/Windows/WindowsWallpaperService.cs @@ -5,7 +5,6 @@ using Windows.System.UserProfile; using Windows.Win32; using Windows.Win32.Foundation; -using Windows.Win32.System.Com; using Windows.Win32.UI.Shell; using Windows.Win32.UI.Shell.Common; diff --git a/src/Files.App/UserControls/ComboBoxEx/ComboBoxEx.cs b/src/Files.App/UserControls/ComboBoxEx/ComboBoxEx.cs index e1ceb930139a..fa63796ca6bd 100644 --- a/src/Files.App/UserControls/ComboBoxEx/ComboBoxEx.cs +++ b/src/Files.App/UserControls/ComboBoxEx/ComboBoxEx.cs @@ -1,7 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; using Windows.Foundation; diff --git a/src/Files.App/UserControls/FileIcon.xaml.cs b/src/Files.App/UserControls/FileIcon.xaml.cs index 028ff819c309..f772e4cba136 100644 --- a/src/Files.App/UserControls/FileIcon.xaml.cs +++ b/src/Files.App/UserControls/FileIcon.xaml.cs @@ -1,13 +1,10 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using Files.App.ViewModels; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Media.Imaging; -using System; using System.Runtime.InteropServices.WindowsRuntime; -using System.Threading.Tasks; using Windows.Storage.Streams; namespace Files.App.UserControls diff --git a/src/Files.App/UserControls/FilePreviews/CodePreview.xaml.cs b/src/Files.App/UserControls/FilePreviews/CodePreview.xaml.cs index 70baa500b48f..5eda9aa0495e 100644 --- a/src/Files.App/UserControls/FilePreviews/CodePreview.xaml.cs +++ b/src/Files.App/UserControls/FilePreviews/CodePreview.xaml.cs @@ -1,7 +1,6 @@ using ColorCode; using Files.App.ViewModels.Previews; using Microsoft.UI.Xaml.Controls; -using System; // The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236 diff --git a/src/Files.App/UserControls/FilePreviews/MarkdownPreview.xaml.cs b/src/Files.App/UserControls/FilePreviews/MarkdownPreview.xaml.cs index e4bcf3cffba1..762dc38d77bc 100644 --- a/src/Files.App/UserControls/FilePreviews/MarkdownPreview.xaml.cs +++ b/src/Files.App/UserControls/FilePreviews/MarkdownPreview.xaml.cs @@ -1,7 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using CommunityToolkit.WinUI.Controls; using Files.App.ViewModels.Previews; using Microsoft.UI.Xaml.Controls; using Windows.System; diff --git a/src/Files.App/UserControls/FilePreviews/MediaPreview.xaml.cs b/src/Files.App/UserControls/FilePreviews/MediaPreview.xaml.cs index 23fb5fff1098..65f79818924f 100644 --- a/src/Files.App/UserControls/FilePreviews/MediaPreview.xaml.cs +++ b/src/Files.App/UserControls/FilePreviews/MediaPreview.xaml.cs @@ -36,8 +36,8 @@ private void MediaPreview_Unloaded(object sender, RoutedEventArgs e) PlayerContext.Source = null; PlayerContext.Loaded -= PlayerContext_Loaded; - Unloaded -= MediaPreview_Unloaded; - } + Unloaded -= MediaPreview_Unloaded; + } private void MediaPlayer_VolumeChanged(MediaPlayer sender, object args) { diff --git a/src/Files.App/UserControls/KeyboardShortcut/KeyboardShortcut.Properties.cs b/src/Files.App/UserControls/KeyboardShortcut/KeyboardShortcut.Properties.cs index 009d19496a62..8ebf9dfa35c8 100644 --- a/src/Files.App/UserControls/KeyboardShortcut/KeyboardShortcut.Properties.cs +++ b/src/Files.App/UserControls/KeyboardShortcut/KeyboardShortcut.Properties.cs @@ -2,7 +2,6 @@ // Licensed under the MIT License. using Microsoft.UI.Xaml; -using Microsoft.UI.Xaml.Controls; namespace Files.App.UserControls.KeyboardShortcut { diff --git a/src/Files.App/UserControls/KeyboardShortcut/KeyboardShortcut.cs b/src/Files.App/UserControls/KeyboardShortcut/KeyboardShortcut.cs index 05502732f360..61711bed0532 100644 --- a/src/Files.App/UserControls/KeyboardShortcut/KeyboardShortcut.cs +++ b/src/Files.App/UserControls/KeyboardShortcut/KeyboardShortcut.cs @@ -50,7 +50,7 @@ private async void OnHotKeysChanged() items.Add(new() { Text = ",", ItemType = KeyboardShortcutItemKind.TextOnly, Size = Size }); } - switch(item.Key, item.Modifier) + switch (item.Key, item.Modifier) { // No keys or modifiers specified case (Keys.None, KeyModifiers.None): diff --git a/src/Files.App/UserControls/KeyboardShortcut/KeyboardShortcutItem.Properties.cs b/src/Files.App/UserControls/KeyboardShortcut/KeyboardShortcutItem.Properties.cs index 2b1f256afd48..ee0dd3f4eae3 100644 --- a/src/Files.App/UserControls/KeyboardShortcut/KeyboardShortcutItem.Properties.cs +++ b/src/Files.App/UserControls/KeyboardShortcut/KeyboardShortcutItem.Properties.cs @@ -2,7 +2,6 @@ // Licensed under the MIT License. using Microsoft.UI.Xaml; -using Microsoft.UI.Xaml.Controls; namespace Files.App.UserControls.KeyboardShortcut { diff --git a/src/Files.App/UserControls/Menus/MenuFlyoutItemWithThemedIcon.xaml.cs b/src/Files.App/UserControls/Menus/MenuFlyoutItemWithThemedIcon.xaml.cs index ca540a680608..834a77f6a0d1 100644 --- a/src/Files.App/UserControls/Menus/MenuFlyoutItemWithThemedIcon.xaml.cs +++ b/src/Files.App/UserControls/Menus/MenuFlyoutItemWithThemedIcon.xaml.cs @@ -8,7 +8,7 @@ namespace Files.App.UserControls { - public sealed partial class MenuFlyoutItemWithThemedIcon: MenuFlyoutItem + public sealed partial class MenuFlyoutItemWithThemedIcon : MenuFlyoutItem { public Style ThemedIconStyle { diff --git a/src/Files.App/UserControls/Menus/ToggleMenuFlyoutItemWithThemedIcon.xaml.cs b/src/Files.App/UserControls/Menus/ToggleMenuFlyoutItemWithThemedIcon.xaml.cs index b10adda4a492..88f0cd7d474b 100644 --- a/src/Files.App/UserControls/Menus/ToggleMenuFlyoutItemWithThemedIcon.xaml.cs +++ b/src/Files.App/UserControls/Menus/ToggleMenuFlyoutItemWithThemedIcon.xaml.cs @@ -8,7 +8,7 @@ namespace Files.App.UserControls { - public sealed partial class ToggleMenuFlyoutItemWithThemedIcon: ToggleMenuFlyoutItem + public sealed partial class ToggleMenuFlyoutItemWithThemedIcon : ToggleMenuFlyoutItem { public Style ThemedIconStyle { diff --git a/src/Files.App/UserControls/NavigationToolbar.xaml.cs b/src/Files.App/UserControls/NavigationToolbar.xaml.cs index 1d9228f75b0e..2653f59075fd 100644 --- a/src/Files.App/UserControls/NavigationToolbar.xaml.cs +++ b/src/Files.App/UserControls/NavigationToolbar.xaml.cs @@ -6,7 +6,6 @@ using Microsoft.UI.Input; 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; diff --git a/src/Files.App/UserControls/Pane/InfoPane.xaml.cs b/src/Files.App/UserControls/Pane/InfoPane.xaml.cs index 7ccfe0fd1be1..e3a5189fa41c 100644 --- a/src/Files.App/UserControls/Pane/InfoPane.xaml.cs +++ b/src/Files.App/UserControls/Pane/InfoPane.xaml.cs @@ -83,7 +83,7 @@ public bool IsHorizontal set => SetProperty(ref isHorizontal, value); } } - + private void TagItem_Tapped(object sender, TappedRoutedEventArgs e) { var tagName = ((sender as StackPanel)?.Children[1] as TextBlock)?.Text; diff --git a/src/Files.App/UserControls/Pane/ShelfPane.xaml.cs b/src/Files.App/UserControls/Pane/ShelfPane.xaml.cs index 7fe285de737e..01c1c2e6e23d 100644 --- a/src/Files.App/UserControls/Pane/ShelfPane.xaml.cs +++ b/src/Files.App/UserControls/Pane/ShelfPane.xaml.cs @@ -95,7 +95,7 @@ widgetCardItem.DataContext is not ShelfItem item || var menuFlyout = new MenuFlyout(); - menuFlyout.Items.Add (new MenuFlyoutItem + menuFlyout.Items.Add(new MenuFlyoutItem { Text = Strings.RemoveFromShelf.GetLocalizedResource(), Icon = new FontIcon { Glyph = "\uE738" }, @@ -127,7 +127,7 @@ public ICommand? ClearCommand } public static readonly DependencyProperty ClearCommandProperty = DependencyProperty.Register(nameof(ClearCommand), typeof(ICommand), typeof(ShelfPane), new PropertyMetadata(null)); - + public ICommand? ItemFocusedCommand { get => (ICommand?)GetValue(ItemFocusedCommandProperty); diff --git a/src/Files.App/UserControls/Selection/ExtendPreviousItemSelectionStrategy.cs b/src/Files.App/UserControls/Selection/ExtendPreviousItemSelectionStrategy.cs index d42fd085a595..460ac84cfcef 100644 --- a/src/Files.App/UserControls/Selection/ExtendPreviousItemSelectionStrategy.cs +++ b/src/Files.App/UserControls/Selection/ExtendPreviousItemSelectionStrategy.cs @@ -1,7 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using System.Collections.Generic; using System.Runtime.InteropServices; namespace Files.App.UserControls.Selection diff --git a/src/Files.App/UserControls/Selection/IgnorePreviousItemSelectionStrategy.cs b/src/Files.App/UserControls/Selection/IgnorePreviousItemSelectionStrategy.cs index 58ea310cc6a1..f82e03c43215 100644 --- a/src/Files.App/UserControls/Selection/IgnorePreviousItemSelectionStrategy.cs +++ b/src/Files.App/UserControls/Selection/IgnorePreviousItemSelectionStrategy.cs @@ -1,7 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using System.Collections.Generic; using System.Runtime.InteropServices; namespace Files.App.UserControls.Selection diff --git a/src/Files.App/UserControls/Selection/InvertPreviousItemSelectionStrategy.cs b/src/Files.App/UserControls/Selection/InvertPreviousItemSelectionStrategy.cs index 2ed042f324e5..399caa93286f 100644 --- a/src/Files.App/UserControls/Selection/InvertPreviousItemSelectionStrategy.cs +++ b/src/Files.App/UserControls/Selection/InvertPreviousItemSelectionStrategy.cs @@ -1,7 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using System.Collections.Generic; using System.Runtime.InteropServices; namespace Files.App.UserControls.Selection diff --git a/src/Files.App/UserControls/Selection/ItemSelectionStrategy.cs b/src/Files.App/UserControls/Selection/ItemSelectionStrategy.cs index 5fba4d65ca02..cc04f4dd5281 100644 --- a/src/Files.App/UserControls/Selection/ItemSelectionStrategy.cs +++ b/src/Files.App/UserControls/Selection/ItemSelectionStrategy.cs @@ -1,8 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using System.Collections.Generic; - namespace Files.App.UserControls.Selection { public abstract class ItemSelectionStrategy diff --git a/src/Files.App/UserControls/Selection/RectangleSelection.cs b/src/Files.App/UserControls/Selection/RectangleSelection.cs index e3fddb2ee439..a3dc27287475 100644 --- a/src/Files.App/UserControls/Selection/RectangleSelection.cs +++ b/src/Files.App/UserControls/Selection/RectangleSelection.cs @@ -5,7 +5,6 @@ using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Shapes; -using System; using Windows.Foundation; namespace Files.App.UserControls.Selection diff --git a/src/Files.App/UserControls/Selection/RectangleSelection_ListViewBase.cs b/src/Files.App/UserControls/Selection/RectangleSelection_ListViewBase.cs index 8dedaab885be..eb64ebb415aa 100644 --- a/src/Files.App/UserControls/Selection/RectangleSelection_ListViewBase.cs +++ b/src/Files.App/UserControls/Selection/RectangleSelection_ListViewBase.cs @@ -6,9 +6,6 @@ using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Input; using Microsoft.UI.Xaml.Shapes; -using System; -using System.Collections.Generic; -using System.Linq; using Windows.Foundation; using Windows.System; using DispatcherQueue = Microsoft.UI.Dispatching.DispatcherQueue; diff --git a/src/Files.App/UserControls/StatusBar.xaml.cs b/src/Files.App/UserControls/StatusBar.xaml.cs index ec8abd2c4842..bee3c6282b0a 100644 --- a/src/Files.App/UserControls/StatusBar.xaml.cs +++ b/src/Files.App/UserControls/StatusBar.xaml.cs @@ -1,7 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using Files.App.Data.Commands; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; diff --git a/src/Files.App/UserControls/StatusCenter/SpeedGraph.cs b/src/Files.App/UserControls/StatusCenter/SpeedGraph.cs index 5aa80607dd6d..3a4dcae09190 100644 --- a/src/Files.App/UserControls/StatusCenter/SpeedGraph.cs +++ b/src/Files.App/UserControls/StatusCenter/SpeedGraph.cs @@ -3,10 +3,8 @@ using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Hosting; -using Microsoft.UI.Xaml.Media; using System.Collections.Specialized; using System.Numerics; -using Windows.UI; // To learn more about WinUI, the WinUI project structure, // and more about our project templates, see: http://aka.ms/winui-project-info. @@ -24,7 +22,7 @@ public ObservableCollection Points SetValue(PointsProperty, value); } } - + public static readonly DependencyProperty PointsProperty = DependencyProperty.Register(nameof(Points), typeof(ObservableCollection), typeof(SpeedGraph), null); @@ -52,7 +50,7 @@ public ObservableCollection Points float highestValue; IAppThemeModeService themeModeService; - + public SpeedGraph() { compositor = ElementCompositionPreview.GetElementVisual(this).Compositor; diff --git a/src/Files.App/UserControls/TabBar/BaseTabBar.cs b/src/Files.App/UserControls/TabBar/BaseTabBar.cs index 7baf785cf354..7196b481592c 100644 --- a/src/Files.App/UserControls/TabBar/BaseTabBar.cs +++ b/src/Files.App/UserControls/TabBar/BaseTabBar.cs @@ -146,7 +146,7 @@ public void CloseTab(TabBarItem tabItem) Items.Remove(tabItem); tabItem.Unload(); - + // Dispose and save tab arguments PushRecentTab( [ diff --git a/src/Files.App/UserControls/Toolbar.xaml.cs b/src/Files.App/UserControls/Toolbar.xaml.cs index 9bca5d7648b4..a8910eb0d748 100644 --- a/src/Files.App/UserControls/Toolbar.xaml.cs +++ b/src/Files.App/UserControls/Toolbar.xaml.cs @@ -96,7 +96,7 @@ private void SortGroup_AccessKeyInvoked(UIElement sender, AccessKeyInvokedEventA for (ushort index = 0; index < items.Count; ++index) { - items[index].AccessKey = (index+1).ToString(format); + items[index].AccessKey = (index + 1).ToString(format); } } diff --git a/src/Files.App/Utils/Cloud/CloudDriveSyncStatusUI.cs b/src/Files.App/Utils/Cloud/CloudDriveSyncStatusUI.cs index 957c9d4bb3c0..4314f96eb293 100644 --- a/src/Files.App/Utils/Cloud/CloudDriveSyncStatusUI.cs +++ b/src/Files.App/Utils/Cloud/CloudDriveSyncStatusUI.cs @@ -1,7 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using Files.App.Utils.Cloud; using Microsoft.UI.Xaml; namespace Files.App.Utils.Cloud diff --git a/src/Files.App/Utils/Cloud/Detector/AbstractCloudDetector.cs b/src/Files.App/Utils/Cloud/Detector/AbstractCloudDetector.cs index b524259b7970..bbd88ff03c72 100644 --- a/src/Files.App/Utils/Cloud/Detector/AbstractCloudDetector.cs +++ b/src/Files.App/Utils/Cloud/Detector/AbstractCloudDetector.cs @@ -1,10 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using Files.App.Utils.Cloud; -using System.Collections.Generic; -using System.Threading.Tasks; - namespace Files.App.Utils.Cloud { public abstract class AbstractCloudDetector : ICloudDetector diff --git a/src/Files.App/Utils/Cloud/Detector/BoxCloudDetector.cs b/src/Files.App/Utils/Cloud/Detector/BoxCloudDetector.cs index e2a4ad7d8eeb..42b7104290ac 100644 --- a/src/Files.App/Utils/Cloud/Detector/BoxCloudDetector.cs +++ b/src/Files.App/Utils/Cloud/Detector/BoxCloudDetector.cs @@ -1,7 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using Files.App.Utils.Cloud; using System.IO; using Windows.Storage; diff --git a/src/Files.App/Utils/Cloud/Detector/CloudDetector.cs b/src/Files.App/Utils/Cloud/Detector/CloudDetector.cs index ccb376c556f5..f68aa036f6ef 100644 --- a/src/Files.App/Utils/Cloud/Detector/CloudDetector.cs +++ b/src/Files.App/Utils/Cloud/Detector/CloudDetector.cs @@ -1,8 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using Files.App.Utils.Cloud; - namespace Files.App.Utils.Cloud { /// diff --git a/src/Files.App/Utils/Cloud/Detector/DropBoxCloudDetector.cs b/src/Files.App/Utils/Cloud/Detector/DropBoxCloudDetector.cs index 975c720e945c..a67c9ee5983d 100644 --- a/src/Files.App/Utils/Cloud/Detector/DropBoxCloudDetector.cs +++ b/src/Files.App/Utils/Cloud/Detector/DropBoxCloudDetector.cs @@ -1,9 +1,7 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using Files.App.Utils.Cloud; using System.IO; -using System.Text.Json; using Windows.Storage; namespace Files.App.Utils.Cloud diff --git a/src/Files.App/Utils/Cloud/Detector/GenericCloudDetector.cs b/src/Files.App/Utils/Cloud/Detector/GenericCloudDetector.cs index 80c0a62b2172..b3e2afa9976f 100644 --- a/src/Files.App/Utils/Cloud/Detector/GenericCloudDetector.cs +++ b/src/Files.App/Utils/Cloud/Detector/GenericCloudDetector.cs @@ -1,8 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using Files.App.Utils.Cloud; - namespace Files.App.Utils.Cloud { /// diff --git a/src/Files.App/Utils/Cloud/Detector/GoogleDriveCloudDetector.cs b/src/Files.App/Utils/Cloud/Detector/GoogleDriveCloudDetector.cs index 56c8bfa44066..f3ba712c2b18 100644 --- a/src/Files.App/Utils/Cloud/Detector/GoogleDriveCloudDetector.cs +++ b/src/Files.App/Utils/Cloud/Detector/GoogleDriveCloudDetector.cs @@ -5,8 +5,8 @@ using Microsoft.Extensions.Logging; using Microsoft.Win32; using System.IO; -using Windows.Storage; using Vanara.Windows.Shell; +using Windows.Storage; namespace Files.App.Utils.Cloud { @@ -220,7 +220,7 @@ private static async Task Inspect(SqliteConnection database, string sqlCommand, } var path = googleDriveRegValPropProp.GetString(); - if (path is not null) + if (path is not null) return ConvertDriveLetterToPathAndValidate(ref path) ? path : null; _logger.LogWarning($"Could not get string from value from {_googleDriveRegValPropPropName}"); @@ -234,7 +234,7 @@ private static async Task Inspect(SqliteConnection database, string sqlCommand, /// private static bool ConvertDriveLetterToPathAndValidate(ref string path) { - if (path.Length > 1) + if (path.Length > 1) return ValidatePath(path); DriveInfo driveInfo; @@ -253,7 +253,7 @@ private static bool ConvertDriveLetterToPathAndValidate(ref string path) } private static bool ValidatePath(string path) - { + { if (Directory.Exists(path)) return true; _logger.LogWarning($"Invalid path: {path}"); @@ -273,7 +273,7 @@ private static bool ValidatePath(string path) } private static bool AddMyDriveToPathAndValidate(ref string path) - { + { // If `path` contains a shortcut named "My Drive", store its target in `shellFolderBaseFirst`. // This happens when "My Drive syncing options" is set to "Mirror files". // TODO: Avoid to use Vanara (#15000) diff --git a/src/Files.App/Utils/Cloud/Detector/OXDriveCloudDetector.cs b/src/Files.App/Utils/Cloud/Detector/OXDriveCloudDetector.cs index b53fdfb15623..bbc764853bc7 100644 --- a/src/Files.App/Utils/Cloud/Detector/OXDriveCloudDetector.cs +++ b/src/Files.App/Utils/Cloud/Detector/OXDriveCloudDetector.cs @@ -1,12 +1,9 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using Files.App.Utils.Cloud; using Microsoft.Win32; using System.IO; -using System.Text.Json; using Windows.Storage; -using static Vanara.PInvoke.Gdi32; namespace Files.App.Utils.Cloud { @@ -33,7 +30,7 @@ protected override async IAsyncEnumerable GetProviders() { var jsonPath = Path.Combine(UserDataPaths.GetDefault().LocalAppData, "Open-Xchange", "OXDrive", "userConfig.json"); if (!File.Exists(jsonPath)) - return null; + return null; var configFile = await StorageFile.GetFileFromPathAsync(jsonPath); using var jsonDoc = JsonDocument.Parse(await FileIO.ReadTextAsync(configFile)); diff --git a/src/Files.App/Utils/Cloud/Detector/SynologyDriveCloudDetector.cs b/src/Files.App/Utils/Cloud/Detector/SynologyDriveCloudDetector.cs index 16592c9af50e..df75d90a789f 100644 --- a/src/Files.App/Utils/Cloud/Detector/SynologyDriveCloudDetector.cs +++ b/src/Files.App/Utils/Cloud/Detector/SynologyDriveCloudDetector.cs @@ -1,7 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using Files.App.Utils.Cloud; using Microsoft.Data.Sqlite; using System.IO; using Windows.Storage; diff --git a/src/Files.App/Utils/Global/QuickAccessManager.cs b/src/Files.App/Utils/Global/QuickAccessManager.cs index e91a880d43f1..5971690c42b5 100644 --- a/src/Files.App/Utils/Global/QuickAccessManager.cs +++ b/src/Files.App/Utils/Global/QuickAccessManager.cs @@ -1,7 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using CommunityToolkit.WinUI.Helpers; using System.IO; namespace Files.App.Utils diff --git a/src/Files.App/Utils/Global/WindowsStorageDeviceWatcher.cs b/src/Files.App/Utils/Global/WindowsStorageDeviceWatcher.cs index f80c1b922b5f..97c4dccbfd7d 100644 --- a/src/Files.App/Utils/Global/WindowsStorageDeviceWatcher.cs +++ b/src/Files.App/Utils/Global/WindowsStorageDeviceWatcher.cs @@ -1,11 +1,7 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using Files.App.Data.Items; -using Files.App.Helpers; -using Files.Core.Storage.Storables; using Microsoft.Extensions.Logging; -using System; using System.IO; using System.Runtime.InteropServices; using Windows.Devices.Enumeration; @@ -63,7 +59,7 @@ private async void Win32_OnDeviceAdded(object? sender, DeviceEventArgs e) + " failed at the StorageFolder initialization step. This device will be ignored."); return; } - + var type = DriveHelpers.GetDriveType(driveAdded); var label = DriveHelpers.GetExtendedDriveLabel(driveAdded); DriveItem driveItem = await DriveItem.CreateFromPropertiesAsync(rootAdded, e.DeviceId, label, type); @@ -96,7 +92,7 @@ private async void Watcher_Added(DeviceWatcher sender, DeviceInformation args) return; } - Data.Items.DriveType type; + Data.Items.DriveType type; string label; try { diff --git a/src/Files.App/Utils/Library/LibraryManager.cs b/src/Files.App/Utils/Library/LibraryManager.cs index c97c6abf8f29..a3520eb6122b 100644 --- a/src/Files.App/Utils/Library/LibraryManager.cs +++ b/src/Files.App/Utils/Library/LibraryManager.cs @@ -2,7 +2,6 @@ // Licensed under the MIT License. using Files.App.Dialogs; -using Files.App.ViewModels.Dialogs; using Microsoft.Extensions.Logging; using Microsoft.UI.Xaml.Controls; using System.Collections.Specialized; diff --git a/src/Files.App/Utils/Serialization/BaseJsonSettings.cs b/src/Files.App/Utils/Serialization/BaseJsonSettings.cs index b13f98143456..215952c8f0ec 100644 --- a/src/Files.App/Utils/Serialization/BaseJsonSettings.cs +++ b/src/Files.App/Utils/Serialization/BaseJsonSettings.cs @@ -1,7 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using System; using System.Runtime.CompilerServices; namespace Files.App.Utils.Serialization diff --git a/src/Files.App/Utils/Serialization/BaseObservableJsonSettings.cs b/src/Files.App/Utils/Serialization/BaseObservableJsonSettings.cs index ac0151556ed5..39ae970163fa 100644 --- a/src/Files.App/Utils/Serialization/BaseObservableJsonSettings.cs +++ b/src/Files.App/Utils/Serialization/BaseObservableJsonSettings.cs @@ -1,7 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using System.ComponentModel; using System.Runtime.CompilerServices; namespace Files.App.Utils.Serialization diff --git a/src/Files.App/Utils/Serialization/Implementation/DefaultJsonSettingsDatabase.cs b/src/Files.App/Utils/Serialization/Implementation/DefaultJsonSettingsDatabase.cs index 797fd086a0fb..f928aff6b1a9 100644 --- a/src/Files.App/Utils/Serialization/Implementation/DefaultJsonSettingsDatabase.cs +++ b/src/Files.App/Utils/Serialization/Implementation/DefaultJsonSettingsDatabase.cs @@ -2,7 +2,6 @@ // Licensed under the MIT License. using System.Collections.Concurrent; -using System.Text.Json; namespace Files.App.Utils.Serialization.Implementation { diff --git a/src/Files.App/Utils/Serialization/Implementation/DefaultJsonSettingsSerializer.cs b/src/Files.App/Utils/Serialization/Implementation/DefaultJsonSettingsSerializer.cs index ccb621eb5a40..7965e6cbf534 100644 --- a/src/Files.App/Utils/Serialization/Implementation/DefaultJsonSettingsSerializer.cs +++ b/src/Files.App/Utils/Serialization/Implementation/DefaultJsonSettingsSerializer.cs @@ -1,8 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using System.Text.Json; - namespace Files.App.Utils.Serialization.Implementation { internal sealed class DefaultJsonSettingsSerializer : IJsonSettingsSerializer diff --git a/src/Files.App/Utils/Shell/ContextMenu.cs b/src/Files.App/Utils/Shell/ContextMenu.cs index b409ba730c03..54cb5eaab4a5 100644 --- a/src/Files.App/Utils/Shell/ContextMenu.cs +++ b/src/Files.App/Utils/Shell/ContextMenu.cs @@ -17,9 +17,9 @@ namespace Files.App.Utils.Shell public partial class ContextMenu : Win32ContextMenu, IDisposable { private Shell32.IContextMenu _cMenu; - + private User32.SafeHMENU _hMenu; - + private readonly ThreadWithMessageQueue _owningThread; private readonly Func? _itemFilter; diff --git a/src/Files.App/Utils/Shell/ShellFolderExtensions.cs b/src/Files.App/Utils/Shell/ShellFolderExtensions.cs index 68468f842ffd..81682aaa428d 100644 --- a/src/Files.App/Utils/Shell/ShellFolderExtensions.cs +++ b/src/Files.App/Utils/Shell/ShellFolderExtensions.cs @@ -1,7 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using System; using System.IO; using Vanara.PInvoke; using Vanara.Windows.Shell; diff --git a/src/Files.App/Utils/Shell/ShellHelpers.cs b/src/Files.App/Utils/Shell/ShellHelpers.cs index 149c54e11be8..2f3dc7f107d6 100644 --- a/src/Files.App/Utils/Shell/ShellHelpers.cs +++ b/src/Files.App/Utils/Shell/ShellHelpers.cs @@ -1,9 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using Files.App.Extensions; -using Files.Shared; -using System; using System.IO; namespace Files.App.Utils.Shell diff --git a/src/Files.App/Utils/Shell/ShellNewMenuHelper.cs b/src/Files.App/Utils/Shell/ShellNewMenuHelper.cs index 9fac780426b7..669f84923a54 100644 --- a/src/Files.App/Utils/Shell/ShellNewMenuHelper.cs +++ b/src/Files.App/Utils/Shell/ShellNewMenuHelper.cs @@ -69,7 +69,8 @@ private static async Task GetShellNewRegistryEntries(RegistryKey } } } - catch { + catch + { // Ignore exceptions when the registry is inaccessible to avoid freezes } diff --git a/src/Files.App/Utils/StatusCenter/StatusCenterItem.cs b/src/Files.App/Utils/StatusCenter/StatusCenterItem.cs index bba1ee1436a3..b3a46cfbd024 100644 --- a/src/Files.App/Utils/StatusCenter/StatusCenterItem.cs +++ b/src/Files.App/Utils/StatusCenter/StatusCenterItem.cs @@ -1,9 +1,9 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using System.Windows.Input; using Microsoft.UI.Xaml.Media; using System.Numerics; +using System.Windows.Input; namespace Files.App.Utils.StatusCenter { diff --git a/src/Files.App/Utils/Storage/Collection/ConcurrentCollection.cs b/src/Files.App/Utils/Storage/Collection/ConcurrentCollection.cs index 693babf28af9..ba52779a1a66 100644 --- a/src/Files.App/Utils/Storage/Collection/ConcurrentCollection.cs +++ b/src/Files.App/Utils/Storage/Collection/ConcurrentCollection.cs @@ -8,7 +8,7 @@ namespace Files.App.Helpers public sealed class ConcurrentCollection : ICollection, IList, ICollection, IList { private readonly object syncRoot = new object(); - + private readonly List collection = []; public int Count diff --git a/src/Files.App/Utils/Storage/Collection/GroupedCollection.cs b/src/Files.App/Utils/Storage/Collection/GroupedCollection.cs index fb1f88962126..9466d24ced31 100644 --- a/src/Files.App/Utils/Storage/Collection/GroupedCollection.cs +++ b/src/Files.App/Utils/Storage/Collection/GroupedCollection.cs @@ -66,7 +66,7 @@ public void InitializeExtendedGroupHeaderInfoAsync() public override void BeginBulkOperation() { base.BeginBulkOperation(); - + Model.PausePropertyChangedNotifications(); } diff --git a/src/Files.App/Utils/Storage/Enumerators/UniversalStorageEnumerator.cs b/src/Files.App/Utils/Storage/Enumerators/UniversalStorageEnumerator.cs index 8d3600206886..4bbb4592f9c0 100644 --- a/src/Files.App/Utils/Storage/Enumerators/UniversalStorageEnumerator.cs +++ b/src/Files.App/Utils/Storage/Enumerators/UniversalStorageEnumerator.cs @@ -82,7 +82,7 @@ ex is FileNotFoundException || { if (defaultIconPairs?.ContainsKey(string.Empty) ?? false) folder.FileImage = defaultIconPairs[string.Empty]; - + tempList.Add(folder); } } @@ -96,7 +96,7 @@ ex is FileNotFoundException || if (!string.IsNullOrEmpty(fileEntry.FileExtension)) { var lowercaseExtension = fileEntry.FileExtension.ToLowerInvariant(); - + if (defaultIconPairs.ContainsKey(lowercaseExtension)) fileEntry.FileImage = defaultIconPairs[lowercaseExtension]; } diff --git a/src/Files.App/Utils/Storage/Enumerators/Win32StorageEnumerator.cs b/src/Files.App/Utils/Storage/Enumerators/Win32StorageEnumerator.cs index 380eebc9134c..bd86be9c4d3a 100644 --- a/src/Files.App/Utils/Storage/Enumerators/Win32StorageEnumerator.cs +++ b/src/Files.App/Utils/Storage/Enumerators/Win32StorageEnumerator.cs @@ -5,7 +5,6 @@ using Files.Shared.Helpers; using System.IO; using Windows.Storage; -using static Files.App.Helpers.Win32Helper; using FileAttributes = System.IO.FileAttributes; namespace Files.App.Utils.Storage diff --git a/src/Files.App/Utils/Storage/Helpers/DriveHelpers.cs b/src/Files.App/Utils/Storage/Helpers/DriveHelpers.cs index 5729042b3ee2..8fce543bdc55 100644 --- a/src/Files.App/Utils/Storage/Helpers/DriveHelpers.cs +++ b/src/Files.App/Utils/Storage/Helpers/DriveHelpers.cs @@ -93,8 +93,8 @@ public static async Task GetRootFromPathAsync(string devi } // Network share else if ( - ( devicePath.StartsWith(@"\\", StringComparison.Ordinal) || - GetDriveType(new SystemIO.DriveInfo(devicePath)) is DriveType.Network ) && + (devicePath.StartsWith(@"\\", StringComparison.Ordinal) || + GetDriveType(new SystemIO.DriveInfo(devicePath)) is DriveType.Network) && !devicePath.StartsWith(@"\\SHELL\", StringComparison.Ordinal) ) { diff --git a/src/Files.App/Utils/Storage/Helpers/FilePropertiesHelpers.cs b/src/Files.App/Utils/Storage/Helpers/FilePropertiesHelpers.cs index 2ce4294c1763..70b2d66f3090 100644 --- a/src/Files.App/Utils/Storage/Helpers/FilePropertiesHelpers.cs +++ b/src/Files.App/Utils/Storage/Helpers/FilePropertiesHelpers.cs @@ -7,7 +7,6 @@ using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Media.Animation; -using Microsoft.Windows.ApplicationModel.Resources; using System.Collections.Concurrent; using Windows.Graphics; using Windows.Win32; @@ -104,7 +103,7 @@ public static void OpenPropertiesWindow(object item, IShellPage associatedInstan var width = Convert.ToInt32(800 * App.AppModel.AppWindowDPI); var height = Convert.ToInt32(500 * App.AppModel.AppWindowDPI); - propertiesWindow.AppWindow.Resize(new (width, height)); + propertiesWindow.AppWindow.Resize(new(width, height)); propertiesWindow.IsMinimizable = false; propertiesWindow.IsMaximizable = false; propertiesWindow.Content = frame; diff --git a/src/Files.App/Utils/Storage/Helpers/FilesystemResult.cs b/src/Files.App/Utils/Storage/Helpers/FilesystemResult.cs index 96de1a67e538..ccb51f9209c8 100644 --- a/src/Files.App/Utils/Storage/Helpers/FilesystemResult.cs +++ b/src/Files.App/Utils/Storage/Helpers/FilesystemResult.cs @@ -16,8 +16,8 @@ public class FilesystemResult public static implicit operator bool(FilesystemResult res) => res?.ErrorCode is FileSystemStatusCode.Success; public static explicit operator FilesystemResult(bool res) => new(res ? FileSystemStatusCode.Success : FileSystemStatusCode.Generic); - - + + public static implicit operator BOOL(FilesystemResult res) => res?.ErrorCode is FileSystemStatusCode.Success; public static explicit operator FilesystemResult(BOOL res) => new(res ? FileSystemStatusCode.Success : FileSystemStatusCode.Generic); } diff --git a/src/Files.App/Utils/Storage/Helpers/FolderHelpers.cs b/src/Files.App/Utils/Storage/Helpers/FolderHelpers.cs index e70b2bace5eb..74f0a37099f1 100644 --- a/src/Files.App/Utils/Storage/Helpers/FolderHelpers.cs +++ b/src/Files.App/Utils/Storage/Helpers/FolderHelpers.cs @@ -2,7 +2,6 @@ // Licensed under the MIT License. using System.IO; -using static Files.App.Helpers.Win32Helper; namespace Files.App.Utils.Storage { diff --git a/src/Files.App/Utils/Storage/Helpers/StorageFileExtensions.cs b/src/Files.App/Utils/Storage/Helpers/StorageFileExtensions.cs index 3b0afe33a40b..ba9ab3ba408a 100644 --- a/src/Files.App/Utils/Storage/Helpers/StorageFileExtensions.cs +++ b/src/Files.App/Utils/Storage/Helpers/StorageFileExtensions.cs @@ -351,7 +351,7 @@ private static string ResolvePath(string path, bool isFtp) if (path.StartsWith("ReleaseNotes")) return "ReleaseNotes"; - + if (path.StartsWith("Settings")) return "Settings"; diff --git a/src/Files.App/Utils/Storage/Helpers/SyncRootHelpers.cs b/src/Files.App/Utils/Storage/Helpers/SyncRootHelpers.cs index 3bfb6335a568..4573df64e0d9 100644 --- a/src/Files.App/Utils/Storage/Helpers/SyncRootHelpers.cs +++ b/src/Files.App/Utils/Storage/Helpers/SyncRootHelpers.cs @@ -2,9 +2,7 @@ // Licensed under the MIT License. using Microsoft.Win32; -using System.Runtime.CompilerServices; using Windows.Win32; -using Windows.Win32.Foundation; using Windows.Win32.System.Com; using Windows.Win32.System.WinRT; using WinRT; diff --git a/src/Files.App/Utils/Storage/Operations/FileSizeCalculator.cs b/src/Files.App/Utils/Storage/Operations/FileSizeCalculator.cs index 5c01476bfc5e..3e60af00da9b 100644 --- a/src/Files.App/Utils/Storage/Operations/FileSizeCalculator.cs +++ b/src/Files.App/Utils/Storage/Operations/FileSizeCalculator.cs @@ -3,7 +3,6 @@ using System.Collections.Concurrent; using System.IO; -using System.Runtime.InteropServices; using Windows.Win32; using Windows.Win32.Storage.FileSystem; diff --git a/src/Files.App/Utils/Storage/Operations/FilesystemHelpers.cs b/src/Files.App/Utils/Storage/Operations/FilesystemHelpers.cs index 7234fedb9076..6183a1330b78 100644 --- a/src/Files.App/Utils/Storage/Operations/FilesystemHelpers.cs +++ b/src/Files.App/Utils/Storage/Operations/FilesystemHelpers.cs @@ -1,14 +1,11 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using Files.Core.Storage; -using Files.Core.Storage.Extensions; using Microsoft.Extensions.Logging; using Microsoft.Win32; using System.IO; using System.Runtime.InteropServices; using System.Runtime.InteropServices.ComTypes; -using Vanara.Extensions; using Vanara.PInvoke; using Vanara.Windows.Shell; using Windows.ApplicationModel.DataTransfer; diff --git a/src/Files.App/Utils/Storage/StorageBaseItems/BaseStorageFolder.cs b/src/Files.App/Utils/Storage/StorageBaseItems/BaseStorageFolder.cs index 7c1c0f40e42e..5517798b8727 100644 --- a/src/Files.App/Utils/Storage/StorageBaseItems/BaseStorageFolder.cs +++ b/src/Files.App/Utils/Storage/StorageBaseItems/BaseStorageFolder.cs @@ -108,7 +108,7 @@ IAsyncOperation> IStorageFolderQueryOperations.GetFil public abstract IAsyncOperation GetFolderAsync(string name); IAsyncOperation IStorageFolder.GetFolderAsync(string name) - { + { return AsyncInfo.Run(async (cancellationToken) => await (await GetFolderAsync(name)).ToStorageFolderAsync()); diff --git a/src/Files.App/Utils/Storage/StorageBaseItems/IBaseStorageFolder.cs b/src/Files.App/Utils/Storage/StorageBaseItems/IBaseStorageFolder.cs index 48b8fcf1b913..44827c86732b 100644 --- a/src/Files.App/Utils/Storage/StorageBaseItems/IBaseStorageFolder.cs +++ b/src/Files.App/Utils/Storage/StorageBaseItems/IBaseStorageFolder.cs @@ -1,7 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using System.IO; using Windows.Foundation; using Windows.Storage; using Windows.Storage.FileProperties; diff --git a/src/Files.App/Utils/Storage/StorageBaseItems/IPasswordProtectedItem.cs b/src/Files.App/Utils/Storage/StorageBaseItems/IPasswordProtectedItem.cs index 318c41787a16..7278d390cd27 100644 --- a/src/Files.App/Utils/Storage/StorageBaseItems/IPasswordProtectedItem.cs +++ b/src/Files.App/Utils/Storage/StorageBaseItems/IPasswordProtectedItem.cs @@ -1,11 +1,8 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using FluentFTP; using FluentFTP.Exceptions; using SevenZip; -using System; -using Windows.Storage; namespace Files.App.Utils.Storage { diff --git a/src/Files.App/Utils/Storage/StorageItems/FtpStorageFile.cs b/src/Files.App/Utils/Storage/StorageItems/FtpStorageFile.cs index 42cb8309e7c6..ea2b0dc0b711 100644 --- a/src/Files.App/Utils/Storage/StorageItems/FtpStorageFile.cs +++ b/src/Files.App/Utils/Storage/StorageItems/FtpStorageFile.cs @@ -1,7 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using Files.App.Storage.Storables; using FluentFTP; using System.IO; using System.Net; diff --git a/src/Files.App/Utils/Storage/StorageItems/FtpStorageFolder.cs b/src/Files.App/Utils/Storage/StorageItems/FtpStorageFolder.cs index 4a3bc2a8b7df..48ddd3d47394 100644 --- a/src/Files.App/Utils/Storage/StorageItems/FtpStorageFolder.cs +++ b/src/Files.App/Utils/Storage/StorageItems/FtpStorageFolder.cs @@ -1,7 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using Files.App.Storage.Storables; using FluentFTP; using System.IO; using System.Net; diff --git a/src/Files.App/Utils/Storage/StorageItems/ShellStorageFile.cs b/src/Files.App/Utils/Storage/StorageItems/ShellStorageFile.cs index 395f8ab72b36..1ef3e7343109 100644 --- a/src/Files.App/Utils/Storage/StorageItems/ShellStorageFile.cs +++ b/src/Files.App/Utils/Storage/StorageItems/ShellStorageFile.cs @@ -2,7 +2,6 @@ // Licensed under the MIT License. using System.Runtime.InteropServices.WindowsRuntime; -using Vanara.PInvoke; using Windows.Foundation; using Windows.Storage; using Windows.Storage.FileProperties; diff --git a/src/Files.App/Utils/Storage/StorageItems/VirtualStorageItem.cs b/src/Files.App/Utils/Storage/StorageItems/VirtualStorageItem.cs index 3f0aee8f4fee..4efdfcc6699e 100644 --- a/src/Files.App/Utils/Storage/StorageItems/VirtualStorageItem.cs +++ b/src/Files.App/Utils/Storage/StorageItems/VirtualStorageItem.cs @@ -6,7 +6,6 @@ using Windows.Foundation; using Windows.Storage; using Windows.Storage.FileProperties; -using static Files.App.Helpers.Win32Helper; namespace Files.App.Utils.Storage { diff --git a/src/Files.App/ViewModels/Dialogs/AddItemDialog/AddItemDialogViewModel.cs b/src/Files.App/ViewModels/Dialogs/AddItemDialog/AddItemDialogViewModel.cs index 4665d89c7007..9d5e459a7c06 100644 --- a/src/Files.App/ViewModels/Dialogs/AddItemDialog/AddItemDialogViewModel.cs +++ b/src/Files.App/ViewModels/Dialogs/AddItemDialog/AddItemDialogViewModel.cs @@ -1,7 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using Files.Shared; using Files.Shared.Utils; namespace Files.App.ViewModels.Dialogs.AddItemDialog diff --git a/src/Files.App/ViewModels/Dialogs/BulkRenameDialogViewModel.cs b/src/Files.App/ViewModels/Dialogs/BulkRenameDialogViewModel.cs index ca72363a51fb..654cf23b9508 100644 --- a/src/Files.App/ViewModels/Dialogs/BulkRenameDialogViewModel.cs +++ b/src/Files.App/ViewModels/Dialogs/BulkRenameDialogViewModel.cs @@ -55,7 +55,8 @@ await context.ShellPage.FilesystemHelpers.RenameAsync( true, false ); - }; + } + ; } } diff --git a/src/Files.App/ViewModels/Dialogs/CreateItemDialogViewModel.cs b/src/Files.App/ViewModels/Dialogs/CreateItemDialogViewModel.cs index 329a7b3037ed..15ceb3dc223b 100644 --- a/src/Files.App/ViewModels/Dialogs/CreateItemDialogViewModel.cs +++ b/src/Files.App/ViewModels/Dialogs/CreateItemDialogViewModel.cs @@ -4,12 +4,12 @@ namespace Files.App.ViewModels.Dialogs { partial class CreateItemDialogViewModel : ObservableObject - { + { private bool isNameInvalid; public bool IsNameInvalid { get => isNameInvalid; set => SetProperty(ref isNameInvalid, value); } - } + } } diff --git a/src/Files.App/ViewModels/Dialogs/CreateShortcutDialogViewModel.cs b/src/Files.App/ViewModels/Dialogs/CreateShortcutDialogViewModel.cs index 0bec2b9be957..591a2c26529c 100644 --- a/src/Files.App/ViewModels/Dialogs/CreateShortcutDialogViewModel.cs +++ b/src/Files.App/ViewModels/Dialogs/CreateShortcutDialogViewModel.cs @@ -1,11 +1,11 @@ // Copyright (c) Files Community // Licensed under the MIT License. +using Files.Shared.Helpers; using System.IO; using System.Runtime.InteropServices; using System.Text; using System.Windows.Input; -using Files.Shared.Helpers; namespace Files.App.ViewModels.Dialogs { @@ -38,7 +38,7 @@ public sealed partial class CreateShortcutDialogViewModel : ObservableObject private string _shortcutName; public string ShortcutName { - get => _shortcutName; + get => _shortcutName; set { if (SetProperty(ref _shortcutName, value)) @@ -195,7 +195,7 @@ public bool IsLocationValid set { if (SetProperty(ref _isLocationValid, value)) - { + { OnPropertyChanged(nameof(ShowWarningTip)); OnPropertyChanged(nameof(IsShortcutValid)); } diff --git a/src/Files.App/ViewModels/Dialogs/DecompressArchiveDialogViewModel.cs b/src/Files.App/ViewModels/Dialogs/DecompressArchiveDialogViewModel.cs index 63ea6b6ca442..131ae481234e 100644 --- a/src/Files.App/ViewModels/Dialogs/DecompressArchiveDialogViewModel.cs +++ b/src/Files.App/ViewModels/Dialogs/DecompressArchiveDialogViewModel.cs @@ -48,7 +48,8 @@ public bool IsArchiveEncodingUndetermined public Encoding? DetectedEncoding { get => detectedEncoding; - set { + set + { SetProperty(ref detectedEncoding, value); RefreshEncodingOptions(); } @@ -71,7 +72,7 @@ void RefreshEncodingOptions() { EncodingOptions = EncodingItem.Defaults .Prepend(new EncodingItem( - detectedEncoding, + detectedEncoding, string.Format(Strings.EncodingDetected.GetLocalizedResource(), detectedEncoding.EncodingName) )) .ToArray(); @@ -83,7 +84,7 @@ void RefreshEncodingOptions() SelectedEncoding = EncodingOptions.FirstOrDefault(); } - + public IRelayCommand PrimaryButtonClickCommand { get; private set; } diff --git a/src/Files.App/ViewModels/Dialogs/FileSystemDialog/FileSystemDialogConflictItemViewModel.cs b/src/Files.App/ViewModels/Dialogs/FileSystemDialog/FileSystemDialogConflictItemViewModel.cs index 64fc9e6ba313..a73f44352f73 100644 --- a/src/Files.App/ViewModels/Dialogs/FileSystemDialog/FileSystemDialogConflictItemViewModel.cs +++ b/src/Files.App/ViewModels/Dialogs/FileSystemDialog/FileSystemDialogConflictItemViewModel.cs @@ -1,7 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using Files.App.Data.Enums; using System.IO; namespace Files.App.ViewModels.Dialogs.FileSystemDialog diff --git a/src/Files.App/ViewModels/Dialogs/FileSystemDialog/FileSystemDialogViewModel.cs b/src/Files.App/ViewModels/Dialogs/FileSystemDialog/FileSystemDialogViewModel.cs index ef4f0f93991f..9de1dbedcf24 100644 --- a/src/Files.App/ViewModels/Dialogs/FileSystemDialog/FileSystemDialogViewModel.cs +++ b/src/Files.App/ViewModels/Dialogs/FileSystemDialog/FileSystemDialogViewModel.cs @@ -1,10 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using Files.App.Data.Enums; -using Files.Shared.Extensions; -using System.Text; - namespace Files.App.ViewModels.Dialogs.FileSystemDialog { public sealed partial class FileSystemDialogViewModel : BaseDialogViewModel, IRecipient diff --git a/src/Files.App/ViewModels/Dialogs/FileSystemDialog/IFileSystemDialogConflictItemViewModel.cs b/src/Files.App/ViewModels/Dialogs/FileSystemDialog/IFileSystemDialogConflictItemViewModel.cs index 07718d27e6bf..a03d3b339105 100644 --- a/src/Files.App/ViewModels/Dialogs/FileSystemDialog/IFileSystemDialogConflictItemViewModel.cs +++ b/src/Files.App/ViewModels/Dialogs/FileSystemDialog/IFileSystemDialogConflictItemViewModel.cs @@ -1,8 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using Files.App.Data.Enums; - namespace Files.App.ViewModels.Dialogs.FileSystemDialog { public interface IFileSystemDialogConflictItemViewModel diff --git a/src/Files.App/ViewModels/Dialogs/FileTooLargeDialogViewModel.cs b/src/Files.App/ViewModels/Dialogs/FileTooLargeDialogViewModel.cs index a0ff9419bb9f..5e2ae9669e54 100644 --- a/src/Files.App/ViewModels/Dialogs/FileTooLargeDialogViewModel.cs +++ b/src/Files.App/ViewModels/Dialogs/FileTooLargeDialogViewModel.cs @@ -3,12 +3,12 @@ namespace Files.App.ViewModels.Dialogs { - public sealed partial class FileTooLargeDialogViewModel: ObservableObject + public sealed partial class FileTooLargeDialogViewModel : ObservableObject { public IEnumerable Paths { get; private set; } - public FileTooLargeDialogViewModel(IEnumerable paths) - { + public FileTooLargeDialogViewModel(IEnumerable paths) + { Paths = paths; } } diff --git a/src/Files.App/ViewModels/Dialogs/IDialog.cs b/src/Files.App/ViewModels/Dialogs/IDialog.cs index 999a7d44210d..ffeaafdf6dce 100644 --- a/src/Files.App/ViewModels/Dialogs/IDialog.cs +++ b/src/Files.App/ViewModels/Dialogs/IDialog.cs @@ -1,8 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using Files.App.Data.Enums; - namespace Files.App.ViewModels.Dialogs { public interface IDialog diff --git a/src/Files.App/ViewModels/Dialogs/ReorderSidebarItemsDialogViewModel.cs b/src/Files.App/ViewModels/Dialogs/ReorderSidebarItemsDialogViewModel.cs index 37ddb169000d..f4f90ffc4ba1 100644 --- a/src/Files.App/ViewModels/Dialogs/ReorderSidebarItemsDialogViewModel.cs +++ b/src/Files.App/ViewModels/Dialogs/ReorderSidebarItemsDialogViewModel.cs @@ -16,7 +16,7 @@ public sealed partial class ReorderSidebarItemsDialogViewModel : ObservableObjec .Where(x => x is LocationItem loc && loc.Section is SectionType.Pinned && !loc.IsHeader) .Cast()); - public ReorderSidebarItemsDialogViewModel() + public ReorderSidebarItemsDialogViewModel() { //App.Logger.LogWarning(string.Join(", ", SidebarPinnedFolderItems.Select(x => x.Path))); PrimaryButtonCommand = new RelayCommand(SaveChanges); diff --git a/src/Files.App/ViewModels/HomeViewModel.cs b/src/Files.App/ViewModels/HomeViewModel.cs index a511b580154c..7d25ee7b448f 100644 --- a/src/Files.App/ViewModels/HomeViewModel.cs +++ b/src/Files.App/ViewModels/HomeViewModel.cs @@ -1,7 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using Microsoft.UI.Xaml; using System.Windows.Input; namespace Files.App.ViewModels diff --git a/src/Files.App/ViewModels/Properties/Items/BaseProperties.cs b/src/Files.App/ViewModels/Properties/Items/BaseProperties.cs index ea436c4f654e..c204b74af287 100644 --- a/src/Files.App/ViewModels/Properties/Items/BaseProperties.cs +++ b/src/Files.App/ViewModels/Properties/Items/BaseProperties.cs @@ -4,7 +4,6 @@ using Microsoft.UI.Dispatching; using System.IO; using Windows.Storage.FileProperties; -using static Files.App.Helpers.Win32Helper; using FileAttributes = System.IO.FileAttributes; namespace Files.App.ViewModels.Properties diff --git a/src/Files.App/ViewModels/Properties/Items/CombinedProperties.cs b/src/Files.App/ViewModels/Properties/Items/CombinedProperties.cs index 5b49a6a626ec..22e2cc40d3eb 100644 --- a/src/Files.App/ViewModels/Properties/Items/CombinedProperties.cs +++ b/src/Files.App/ViewModels/Properties/Items/CombinedProperties.cs @@ -1,14 +1,6 @@ -using Files.App.Extensions; -using Files.App.Utils; -using Files.App.Helpers; using Microsoft.Extensions.Logging; using Microsoft.UI.Dispatching; -using System; -using System.Collections.Generic; using System.IO; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; using Windows.Storage; namespace Files.App.ViewModels.Properties diff --git a/src/Files.App/ViewModels/Properties/Items/DriveProperties.cs b/src/Files.App/ViewModels/Properties/Items/DriveProperties.cs index c07138a6ce33..8489450903e1 100644 --- a/src/Files.App/ViewModels/Properties/Items/DriveProperties.cs +++ b/src/Files.App/ViewModels/Properties/Items/DriveProperties.cs @@ -1,11 +1,4 @@ -using Files.App.Data.Items; -using Files.App.Extensions; -using Files.App.Utils; -using Files.App.Helpers; using Microsoft.Extensions.Logging; -using System; -using System.Threading.Tasks; -using Windows.Storage.FileProperties; namespace Files.App.ViewModels.Properties { diff --git a/src/Files.App/ViewModels/Properties/Items/FilePropertySection.cs b/src/Files.App/ViewModels/Properties/Items/FilePropertySection.cs index a8333dc130cb..058ac2a1e839 100644 --- a/src/Files.App/ViewModels/Properties/Items/FilePropertySection.cs +++ b/src/Files.App/ViewModels/Properties/Items/FilePropertySection.cs @@ -1,6 +1,4 @@ -using Files.App.Extensions; using Microsoft.UI.Xaml; -using System.Collections.Generic; namespace Files.App.ViewModels.Properties { diff --git a/src/Files.App/ViewModels/Properties/Items/FolderProperties.cs b/src/Files.App/ViewModels/Properties/Items/FolderProperties.cs index b09b7462f021..6d85b79e8224 100644 --- a/src/Files.App/ViewModels/Properties/Items/FolderProperties.cs +++ b/src/Files.App/ViewModels/Properties/Items/FolderProperties.cs @@ -83,7 +83,7 @@ public async override Task GetSpecialPropertiesAsync() Constants.ShellIconSizes.ExtraLarge, true, IconOptions.UseCurrentScale); - + if (result is not null) { ViewModel.IconData = result; @@ -120,7 +120,7 @@ public async override Task GetSpecialPropertiesAsync() GetOtherPropertiesAsync(storageFolder.Properties); // Only load the size for items on the device - if (Item.SyncStatusUI.SyncStatus is not CloudDriveSyncStatus.FileOnline and not + if (Item.SyncStatusUI.SyncStatus is not CloudDriveSyncStatus.FileOnline and not CloudDriveSyncStatus.FolderOnline and not CloudDriveSyncStatus.FolderOfflinePartial) GetFolderSizeAsync(storageFolder.Path, TokenSource.Token); diff --git a/src/Files.App/ViewModels/Properties/Items/LibraryProperties.cs b/src/Files.App/ViewModels/Properties/Items/LibraryProperties.cs index d6883f436593..0b02b62c0ba3 100644 --- a/src/Files.App/ViewModels/Properties/Items/LibraryProperties.cs +++ b/src/Files.App/ViewModels/Properties/Items/LibraryProperties.cs @@ -55,7 +55,7 @@ public async override Task GetSpecialPropertiesAsync() Constants.ShellIconSizes.ExtraLarge, true, IconOptions.UseCurrentScale); - + if (result is not null) { ViewModel.IconData = result; diff --git a/src/Files.App/ViewModels/Properties/MainPropertiesViewModel.cs b/src/Files.App/ViewModels/Properties/MainPropertiesViewModel.cs index 14a7922e0115..c95b9b60b056 100644 --- a/src/Files.App/ViewModels/Properties/MainPropertiesViewModel.cs +++ b/src/Files.App/ViewModels/Properties/MainPropertiesViewModel.cs @@ -33,14 +33,14 @@ public NavigationViewItemButtonStyleItem SelectedNavigationViewItem var page = value.ItemType switch { - PropertiesNavigationViewItemType.General => typeof(GeneralPage), - PropertiesNavigationViewItemType.Shortcut => typeof(ShortcutPage), - PropertiesNavigationViewItemType.Library => typeof(LibraryPage), - PropertiesNavigationViewItemType.Details => typeof(DetailsPage), - PropertiesNavigationViewItemType.Security => typeof(SecurityPage), + PropertiesNavigationViewItemType.General => typeof(GeneralPage), + PropertiesNavigationViewItemType.Shortcut => typeof(ShortcutPage), + PropertiesNavigationViewItemType.Library => typeof(LibraryPage), + PropertiesNavigationViewItemType.Details => typeof(DetailsPage), + PropertiesNavigationViewItemType.Security => typeof(SecurityPage), PropertiesNavigationViewItemType.Customization => typeof(CustomizationPage), PropertiesNavigationViewItemType.Compatibility => typeof(CompatibilityPage), - PropertiesNavigationViewItemType.Hashes => typeof(HashesPage), + PropertiesNavigationViewItemType.Hashes => typeof(HashesPage), _ => typeof(GeneralPage), }; diff --git a/src/Files.App/ViewModels/Properties/SecurityAdvancedViewModel.cs b/src/Files.App/ViewModels/Properties/SecurityAdvancedViewModel.cs index 3201b42c06a7..367e8b4aaee5 100644 --- a/src/Files.App/ViewModels/Properties/SecurityAdvancedViewModel.cs +++ b/src/Files.App/ViewModels/Properties/SecurityAdvancedViewModel.cs @@ -69,7 +69,7 @@ public AccessControlEntry? SelectedAccessControlEntry if (SetProperty(ref _SelectedAccessControlEntry, value)) { - if(value is not null) + if (value is not null) value.IsSelected = true; OnPropertyChanged(nameof(IsDeleteAccessControlEntryButtonEnabled)); @@ -143,7 +143,8 @@ public SecurityAdvancedViewModel(PropertiesPageNavigationParameter parameter) _path = defaultlistedItem.ItemPath; _isFolder = defaultlistedItem.PrimaryItemAttribute == StorageItemTypes.Folder && !defaultlistedItem.IsShortcut; break; - }; + } + ; LoadShieldIconResource(); @@ -179,7 +180,7 @@ private void LoadAccessControlEntry() if (error is WIN32_ERROR.ERROR_ACCESS_DENIED) { - ErrorMessage = + ErrorMessage = Strings.SecurityRequireReadPermissions.GetLocalizedResource() + "\r\n\r\n" + Strings.SecuritySuggestToTakeOwnership.GetLocalizedResource(); diff --git a/src/Files.App/ViewModels/Properties/SecurityViewModel.cs b/src/Files.App/ViewModels/Properties/SecurityViewModel.cs index 388ac13faa5e..30da282c7d7d 100644 --- a/src/Files.App/ViewModels/Properties/SecurityViewModel.cs +++ b/src/Files.App/ViewModels/Properties/SecurityViewModel.cs @@ -89,7 +89,8 @@ public SecurityViewModel(PropertiesPageNavigationParameter parameter) _path = defaultlistedItem.ItemPath; _isFolder = defaultlistedItem.PrimaryItemAttribute == StorageItemTypes.Folder && !defaultlistedItem.IsShortcut; break; - }; + } + ; var error = StorageSecurityService.GetAcl(_path, _isFolder, out _AccessControlList); _SelectedAccessControlEntry = AccessControlList.AccessControlEntries.FirstOrDefault(); diff --git a/src/Files.App/ViewModels/Settings/AdvancedViewModel.cs b/src/Files.App/ViewModels/Settings/AdvancedViewModel.cs index e8dd09d35b09..2d8344bffaf2 100644 --- a/src/Files.App/ViewModels/Settings/AdvancedViewModel.cs +++ b/src/Files.App/ViewModels/Settings/AdvancedViewModel.cs @@ -10,7 +10,6 @@ using Windows.ApplicationModel; using Windows.Storage; using Windows.Storage.Pickers; -using Windows.System; using Windows.Win32.Storage.FileSystem; namespace Files.App.ViewModels.Settings @@ -195,7 +194,7 @@ private async Task ImportSettingsAsync() private async Task ExportSettingsAsync() { - string[] extensions = [Strings.ZipFileCapitalized.GetLocalizedResource(), "*.zip" ]; + string[] extensions = [Strings.ZipFileCapitalized.GetLocalizedResource(), "*.zip"]; bool result = CommonDialogService.Open_FileSaveDialog(MainWindow.Instance.WindowHandle, false, extensions, Environment.SpecialFolder.Desktop, out var filePath); if (!result) return; @@ -327,7 +326,7 @@ public bool LeaveAppRunning } } } - + public bool ShowSystemTrayIcon { get => UserSettingsService.GeneralSettingsService.ShowSystemTrayIcon; diff --git a/src/Files.App/ViewModels/Settings/LayoutViewModel.cs b/src/Files.App/ViewModels/Settings/LayoutViewModel.cs index f6f16bf0665c..f65656655edc 100644 --- a/src/Files.App/ViewModels/Settings/LayoutViewModel.cs +++ b/src/Files.App/ViewModels/Settings/LayoutViewModel.cs @@ -19,7 +19,7 @@ public LayoutViewModel() // Sorting options SelectedDefaultSortingIndex = UserSettingsService.LayoutSettingsService.DefaultSortOption == SortOption.FileTag ? FileTagSortingIndex : (int)UserSettingsService.LayoutSettingsService.DefaultSortOption; SelectedDefaultSortPriorityIndex = UserSettingsService.LayoutSettingsService.DefaultSortDirectoriesAlongsideFiles ? 2 : UserSettingsService.LayoutSettingsService.DefaultSortFilesFirst ? 1 : 0; - + // Grouping options SelectedDefaultGroupingIndex = UserSettingsService.LayoutSettingsService.DefaultGroupOption == GroupOption.FileTag ? FileTagGroupingIndex : (int)UserSettingsService.LayoutSettingsService.DefaultGroupOption; SelectedDefaultGroupByDateUnitIndex = (int)UserSettingsService.LayoutSettingsService.DefaultGroupByDateUnit; @@ -110,7 +110,7 @@ public bool SortInDescendingOrder } } - + private int selectedDefaultSortPriorityIndex; public int SelectedDefaultSortPriorityIndex { diff --git a/src/Files.App/ViewModels/UserControls/NavigationToolbarViewModel.cs b/src/Files.App/ViewModels/UserControls/NavigationToolbarViewModel.cs index 2f8671b15e47..88952dfa9af9 100644 --- a/src/Files.App/ViewModels/UserControls/NavigationToolbarViewModel.cs +++ b/src/Files.App/ViewModels/UserControls/NavigationToolbarViewModel.cs @@ -8,7 +8,6 @@ using Microsoft.UI.Dispatching; 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.Imaging; using System.IO; diff --git a/src/Files.App/ViewModels/UserControls/Previews/BasePreviewModel.cs b/src/Files.App/ViewModels/UserControls/Previews/BasePreviewModel.cs index e8be3e2b0905..63839ade64d8 100644 --- a/src/Files.App/ViewModels/UserControls/Previews/BasePreviewModel.cs +++ b/src/Files.App/ViewModels/UserControls/Previews/BasePreviewModel.cs @@ -4,7 +4,6 @@ using Files.App.ViewModels.Properties; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Media.Imaging; -using Windows.Storage.FileProperties; namespace Files.App.ViewModels.Previews { @@ -89,7 +88,7 @@ public async virtual Task> LoadPreviewAndDetailsAsync() Constants.ShellIconSizes.Jumbo, false, IconOptions.None); - + if (result is not null) await MainWindow.Instance.DispatcherQueue.EnqueueOrInvokeAsync(async () => FileImage = await result.ToBitmapAsync()); else diff --git a/src/Files.App/ViewModels/UserControls/Previews/CodePreviewViewModel.cs b/src/Files.App/ViewModels/UserControls/Previews/CodePreviewViewModel.cs index 0f59e3fa07ac..4ad8d1f71f26 100644 --- a/src/Files.App/ViewModels/UserControls/Previews/CodePreviewViewModel.cs +++ b/src/Files.App/ViewModels/UserControls/Previews/CodePreviewViewModel.cs @@ -1,9 +1,9 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using System.Collections.Frozen; using ColorCode; using Files.App.ViewModels.Properties; +using System.Collections.Frozen; namespace Files.App.ViewModels.Previews { diff --git a/src/Files.App/ViewModels/UserControls/Previews/FolderPreviewViewModel.cs b/src/Files.App/ViewModels/UserControls/Previews/FolderPreviewViewModel.cs index f4a2d746a3d1..f80160e0f2a1 100644 --- a/src/Files.App/ViewModels/UserControls/Previews/FolderPreviewViewModel.cs +++ b/src/Files.App/ViewModels/UserControls/Previews/FolderPreviewViewModel.cs @@ -32,7 +32,7 @@ private async Task LoadPreviewAndDetailsAsync() Constants.ShellIconSizes.Jumbo, true, IconOptions.None); - + if (result is not null) Thumbnail = await result.ToBitmapAsync(); @@ -59,7 +59,7 @@ private async Task LoadPreviewAndDetailsAsync() var headName = (await GitHelpers.GetRepositoryHead(gitDirectory))?.Name ?? string.Empty; var repositoryName = GitHelpers.GetOriginRepositoryName(gitDirectory); - if(!string.IsNullOrEmpty(gitDirectory)) + if (!string.IsNullOrEmpty(gitDirectory)) Item.FileDetails.Add(GetFileProperty("GitOriginRepositoryName", repositoryName)); if (!string.IsNullOrWhiteSpace(headName)) diff --git a/src/Files.App/ViewModels/UserControls/Previews/ImagePreviewViewModel.cs b/src/Files.App/ViewModels/UserControls/Previews/ImagePreviewViewModel.cs index 582cdb372726..6a323b90e1d6 100644 --- a/src/Files.App/ViewModels/UserControls/Previews/ImagePreviewViewModel.cs +++ b/src/Files.App/ViewModels/UserControls/Previews/ImagePreviewViewModel.cs @@ -1,7 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using CommunityToolkit.WinUI; using Files.App.ViewModels.Properties; using Microsoft.UI.Xaml.Media; using Microsoft.UI.Xaml.Media.Imaging; diff --git a/src/Files.App/ViewModels/UserControls/Previews/PDFPreviewViewModel.cs b/src/Files.App/ViewModels/UserControls/Previews/PDFPreviewViewModel.cs index d386744a3891..fa1d08dc7698 100644 --- a/src/Files.App/ViewModels/UserControls/Previews/PDFPreviewViewModel.cs +++ b/src/Files.App/ViewModels/UserControls/Previews/PDFPreviewViewModel.cs @@ -1,7 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using CommunityToolkit.WinUI; using Files.App.ViewModels.Properties; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Media.Imaging; diff --git a/src/Files.App/ViewModels/UserControls/ShelfViewModel.cs b/src/Files.App/ViewModels/UserControls/ShelfViewModel.cs index f5fdc8f62a10..8b80c2b61e93 100644 --- a/src/Files.App/ViewModels/UserControls/ShelfViewModel.cs +++ b/src/Files.App/ViewModels/UserControls/ShelfViewModel.cs @@ -1,8 +1,8 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using System.Collections.Specialized; using Files.Shared.Utils; +using System.Collections.Specialized; namespace Files.App.ViewModels.UserControls { @@ -38,49 +38,49 @@ private async void Items_CollectionChanged(object? sender, NotifyCollectionChang switch (e.Action) { case NotifyCollectionChangedAction.Add when e.NewItems is not null: - { - if (e.NewItems[0] is not ShelfItem shelfItem) - return; - - var parentPath = SystemIO.Path.GetDirectoryName(shelfItem.Inner.Id) ?? string.Empty; - if (_watchers.TryGetValue(parentPath, out var reference)) { - // Only increase the reference count if the watcher already exists - reference.Item2++; - return; + if (e.NewItems[0] is not ShelfItem shelfItem) + return; + + var parentPath = SystemIO.Path.GetDirectoryName(shelfItem.Inner.Id) ?? string.Empty; + if (_watchers.TryGetValue(parentPath, out var reference)) + { + // Only increase the reference count if the watcher already exists + reference.Item2++; + return; + } + + if (await shelfItem.Inner.GetParentAsync() is not IMutableFolder mutableFolder) + return; + + // Register new watcher + var watcher = await mutableFolder.GetFolderWatcherAsync(); + watcher.CollectionChanged += Watcher_CollectionChanged; + + _watchers.Add(parentPath, (watcher, 1)); + break; } - - if (await shelfItem.Inner.GetParentAsync() is not IMutableFolder mutableFolder) - return; - - // Register new watcher - var watcher = await mutableFolder.GetFolderWatcherAsync(); - watcher.CollectionChanged += Watcher_CollectionChanged; - - _watchers.Add(parentPath, (watcher, 1)); - break; - } case NotifyCollectionChangedAction.Remove when e.OldItems is not null: - { - if (e.OldItems[0] is not ShelfItem shelfItem) - return; - - var parentPath = SystemIO.Path.GetDirectoryName(shelfItem.Inner.Id) ?? string.Empty; - if (!_watchers.TryGetValue(parentPath, out var reference)) - return; - - // Decrease the reference count and remove the watcher if no references are present - reference.Item2--; - if (reference.Item2 < 1) { - reference.Item1.CollectionChanged -= Watcher_CollectionChanged; - reference.Item1.Dispose(); - _watchers.Remove(parentPath); + if (e.OldItems[0] is not ShelfItem shelfItem) + return; + + var parentPath = SystemIO.Path.GetDirectoryName(shelfItem.Inner.Id) ?? string.Empty; + if (!_watchers.TryGetValue(parentPath, out var reference)) + return; + + // Decrease the reference count and remove the watcher if no references are present + reference.Item2--; + if (reference.Item2 < 1) + { + reference.Item1.CollectionChanged -= Watcher_CollectionChanged; + reference.Item1.Dispose(); + _watchers.Remove(parentPath); + } + + break; } - - break; - } } } @@ -92,16 +92,16 @@ private async void Watcher_CollectionChanged(object? sender, NotifyCollectionCha switch (e.Action) { case NotifyCollectionChangedAction.Remove when e.OldItems is not null: - { - // Remove the matching item notified from the watcher - var item = e.OldItems.Cast().ElementAt(0); - var itemToRemove = Items.FirstOrDefault(x => x.Inner.Id == item.Id); - if (itemToRemove is null) - return; - - await MainWindow.Instance.DispatcherQueue.EnqueueOrInvokeAsync(() => Items.Remove(itemToRemove)); - break; - } + { + // Remove the matching item notified from the watcher + var item = e.OldItems.Cast().ElementAt(0); + var itemToRemove = Items.FirstOrDefault(x => x.Inner.Id == item.Id); + if (itemToRemove is null) + return; + + await MainWindow.Instance.DispatcherQueue.EnqueueOrInvokeAsync(() => Items.Remove(itemToRemove)); + break; + } } } } diff --git a/src/Files.App/ViewModels/UserControls/SidebarViewModel.cs b/src/Files.App/ViewModels/UserControls/SidebarViewModel.cs index 37c13ec64a7e..507d7b3d819a 100644 --- a/src/Files.App/ViewModels/UserControls/SidebarViewModel.cs +++ b/src/Files.App/ViewModels/UserControls/SidebarViewModel.cs @@ -16,7 +16,6 @@ using Windows.Storage; using Windows.System; using Windows.UI.Core; -using OwlCore.Storage; namespace Files.App.ViewModels.UserControls { diff --git a/src/Files.App/ViewModels/UserControls/Widgets/NetworkLocationsWidgetViewModel.cs b/src/Files.App/ViewModels/UserControls/Widgets/NetworkLocationsWidgetViewModel.cs index eb0b71e66414..17995df491f3 100644 --- a/src/Files.App/ViewModels/UserControls/Widgets/NetworkLocationsWidgetViewModel.cs +++ b/src/Files.App/ViewModels/UserControls/Widgets/NetworkLocationsWidgetViewModel.cs @@ -7,7 +7,6 @@ using System.Windows.Input; using Windows.System; using Windows.UI.Core; -using OwlCore.Storage; namespace Files.App.ViewModels.UserControls.Widgets { @@ -249,7 +248,7 @@ await MainWindow.Instance.DispatcherQueue.EnqueueOrInvokeAsync(async () => IsNoNetworkLocations = !Items.Any(); }); - } + } // Event methods diff --git a/src/Files.App/Views/Layouts/BaseGroupableLayoutPage.cs b/src/Files.App/Views/Layouts/BaseGroupableLayoutPage.cs index 14c87e12a590..2d867c252741 100644 --- a/src/Files.App/Views/Layouts/BaseGroupableLayoutPage.cs +++ b/src/Files.App/Views/Layouts/BaseGroupableLayoutPage.cs @@ -289,7 +289,7 @@ protected virtual async void RenameTextBox_LostFocus(object sender, RoutedEventA catch (COMException) { - } + } } // Methods diff --git a/src/Files.App/Views/Layouts/BaseLayoutPage.cs b/src/Files.App/Views/Layouts/BaseLayoutPage.cs index 6b77a095a662..277bd8df7815 100644 --- a/src/Files.App/Views/Layouts/BaseLayoutPage.cs +++ b/src/Files.App/Views/Layouts/BaseLayoutPage.cs @@ -940,7 +940,7 @@ private async Task AddShellMenuItemsAsync(List s // Filter mainShellMenuItems that have a non-null LoadSubMenuAction var mainItemsWithSubMenu = mainShellMenuItems.Where(x => x.LoadSubMenuAction is not null); - + var mainSubMenuTasks = mainItemsWithSubMenu.Select(async item => { await item.LoadSubMenuAction(); @@ -955,7 +955,7 @@ private async Task AddShellMenuItemsAsync(List s await item.LoadSubMenuAction(); ShellContextFlyoutFactory.AddItemsToOverflowMenu(overflowItem, item); }); - + itemsControl?.Items.OfType().ForEach(item => { // Enable CharacterEllipsis text trimming for menu items @@ -981,7 +981,7 @@ private async Task AddShellMenuItemsAsync(List s clickAction(flyout.Items); } }); - + await Task.WhenAll(mainSubMenuTasks.Concat(overflowSubMenuTasks)); } diff --git a/src/Files.App/Views/Layouts/ColumnsLayoutPage.xaml.cs b/src/Files.App/Views/Layouts/ColumnsLayoutPage.xaml.cs index a5fe0b31466b..eac0f3da62f3 100644 --- a/src/Files.App/Views/Layouts/ColumnsLayoutPage.xaml.cs +++ b/src/Files.App/Views/Layouts/ColumnsLayoutPage.xaml.cs @@ -2,7 +2,6 @@ // Licensed under the MIT License. using CommunityToolkit.WinUI; -using CommunityToolkit.WinUI.Controls; using Files.App.Controls; using Files.App.ViewModels.Layouts; using Microsoft.UI.Xaml; diff --git a/src/Files.App/Views/Layouts/GridLayoutPage.xaml.cs b/src/Files.App/Views/Layouts/GridLayoutPage.xaml.cs index 51feed73cacb..b2f10c3c4cdf 100644 --- a/src/Files.App/Views/Layouts/GridLayoutPage.xaml.cs +++ b/src/Files.App/Views/Layouts/GridLayoutPage.xaml.cs @@ -131,7 +131,7 @@ public sealed partial class GridLayoutPage : BaseGroupableLayoutPage /// /// Gets the visibility for the contextual property string in the Cards View layout. /// - public bool CardsViewShowContextualProperty=> + public bool CardsViewShowContextualProperty => LayoutSettingsService.CardsViewSize != CardsViewSizeKind.Small; /// diff --git a/src/Files.App/Views/Properties/CompatibilityPage.xaml.cs b/src/Files.App/Views/Properties/CompatibilityPage.xaml.cs index 8d4ffec387fc..0134b6a391ee 100644 --- a/src/Files.App/Views/Properties/CompatibilityPage.xaml.cs +++ b/src/Files.App/Views/Properties/CompatibilityPage.xaml.cs @@ -2,7 +2,6 @@ // Licensed under the MIT License. using Files.App.ViewModels.Properties; -using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Navigation; namespace Files.App.Views.Properties diff --git a/src/Files.App/Views/Properties/CustomizationPage.xaml.cs b/src/Files.App/Views/Properties/CustomizationPage.xaml.cs index 63e6b5702215..084970c73253 100644 --- a/src/Files.App/Views/Properties/CustomizationPage.xaml.cs +++ b/src/Files.App/Views/Properties/CustomizationPage.xaml.cs @@ -1,7 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using Files.App.Data.Parameters; using Files.App.ViewModels.Properties; using Microsoft.UI.Xaml.Navigation; diff --git a/src/Files.App/Views/Properties/GeneralPage.xaml.cs b/src/Files.App/Views/Properties/GeneralPage.xaml.cs index 61474e91a49b..4ce97aadcad8 100644 --- a/src/Files.App/Views/Properties/GeneralPage.xaml.cs +++ b/src/Files.App/Views/Properties/GeneralPage.xaml.cs @@ -8,7 +8,6 @@ using System.IO; using Windows.Storage; using Windows.Win32; -using Files.App.Helpers; namespace Files.App.Views.Properties { diff --git a/src/Files.App/Views/Properties/SecurityAdvancedPage.xaml.cs b/src/Files.App/Views/Properties/SecurityAdvancedPage.xaml.cs index 6b5d0e1d352e..f2aa0fd60bbb 100644 --- a/src/Files.App/Views/Properties/SecurityAdvancedPage.xaml.cs +++ b/src/Files.App/Views/Properties/SecurityAdvancedPage.xaml.cs @@ -1,9 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using Files.App.Data.Items; -using Files.App.Data.Parameters; -using Files.App.Utils; using Files.App.ViewModels.Properties; using Microsoft.UI.Xaml.Navigation; diff --git a/src/Files.App/Views/Properties/SecurityPage.xaml.cs b/src/Files.App/Views/Properties/SecurityPage.xaml.cs index 51479fd022d4..b04b1b43ca3c 100644 --- a/src/Files.App/Views/Properties/SecurityPage.xaml.cs +++ b/src/Files.App/Views/Properties/SecurityPage.xaml.cs @@ -1,9 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using Files.App.Data.Items; -using Files.App.Data.Parameters; -using Files.App.Utils; using Files.App.ViewModels.Properties; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Navigation; diff --git a/src/Files.App/Views/ReleaseNotesPage.xaml.cs b/src/Files.App/Views/ReleaseNotesPage.xaml.cs index 67edb1a06d03..d93f7b5965f0 100644 --- a/src/Files.App/Views/ReleaseNotesPage.xaml.cs +++ b/src/Files.App/Views/ReleaseNotesPage.xaml.cs @@ -3,9 +3,9 @@ using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Navigation; using Microsoft.Web.WebView2.Core; using Windows.System; -using Microsoft.UI.Xaml.Navigation; namespace Files.App.Views { diff --git a/src/Files.App/Views/Settings/TagsPage.xaml.cs b/src/Files.App/Views/Settings/TagsPage.xaml.cs index 8d06c714b11e..43e5ae345d40 100644 --- a/src/Files.App/Views/Settings/TagsPage.xaml.cs +++ b/src/Files.App/Views/Settings/TagsPage.xaml.cs @@ -88,7 +88,7 @@ private void PreRemoveTag_Click(object sender, RoutedEventArgs e) private void CancelRemoveTag_Click(object sender, RoutedEventArgs e) { deleteItemFlyout?.Hide(); - } + } private void RemoveTag_Click(object sender, RoutedEventArgs e) { diff --git a/src/Files.App/Views/ShellPanesPage.xaml.cs b/src/Files.App/Views/ShellPanesPage.xaml.cs index 560708820a80..7acc6a47c6c9 100644 --- a/src/Files.App/Views/ShellPanesPage.xaml.cs +++ b/src/Files.App/Views/ShellPanesPage.xaml.cs @@ -1,7 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using CommunityToolkit.WinUI.Controls; using Files.App.Controls; using Microsoft.UI.Input; using Microsoft.UI.Xaml; diff --git a/src/Files.App/Views/Shells/BaseShellPage.cs b/src/Files.App/Views/Shells/BaseShellPage.cs index f4d8f5b9769b..78429f89c3d0 100644 --- a/src/Files.App/Views/Shells/BaseShellPage.cs +++ b/src/Files.App/Views/Shells/BaseShellPage.cs @@ -5,7 +5,6 @@ using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Input; -using Microsoft.UI.Xaml.Media.Animation; using Microsoft.UI.Xaml.Navigation; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; diff --git a/src/Files.App/Views/Shells/ColumnShellPage.xaml.cs b/src/Files.App/Views/Shells/ColumnShellPage.xaml.cs index 9aeba6830f10..fa941ac4b5d9 100644 --- a/src/Files.App/Views/Shells/ColumnShellPage.xaml.cs +++ b/src/Files.App/Views/Shells/ColumnShellPage.xaml.cs @@ -4,9 +4,7 @@ using CommunityToolkit.WinUI; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; -using Microsoft.UI.Xaml.Input; using Microsoft.UI.Xaml.Navigation; -using Windows.System; namespace Files.App.Views.Shells { @@ -105,7 +103,7 @@ protected override async void ViewModel_WorkingDirectoryModified(object sender, private async void ItemDisplayFrame_Navigated(object sender, NavigationEventArgs e) { ContentPage = await GetContentOrNullAsync(); - + if (ItemDisplayFrame.CurrentSourcePageType == typeof(ColumnLayoutPage)) { // Reset DataGrid Rows that may be in "cut" command mode @@ -155,7 +153,7 @@ public override void NavigateHome() { this.FindAscendant()?.ParentShellPageInstance?.NavigateHome(); } - + public override void NavigateToReleaseNotes() { this.FindAscendant()?.ParentShellPageInstance?.NavigateToReleaseNotes(); diff --git a/src/Files.Core.SourceGenerator/GlobalUsings.cs b/src/Files.Core.SourceGenerator/GlobalUsings.cs index 3a4d77484ca0..4bb4c7f1546b 100644 --- a/src/Files.Core.SourceGenerator/GlobalUsings.cs +++ b/src/Files.Core.SourceGenerator/GlobalUsings.cs @@ -27,4 +27,4 @@ global using global::System.Linq; global using global::System.Text; global using global::System.Threading.Tasks; -global using SystemIO = global::System.IO; \ No newline at end of file +global using SystemIO = global::System.IO; diff --git a/src/Files.Core.SourceGenerator/Parser/ReswParser.cs b/src/Files.Core.SourceGenerator/Parser/ReswParser.cs index 63780ab1609d..8584c885e092 100644 --- a/src/Files.Core.SourceGenerator/Parser/ReswParser.cs +++ b/src/Files.Core.SourceGenerator/Parser/ReswParser.cs @@ -21,10 +21,12 @@ internal static IEnumerable GetKeys(AdditionalText file) var document = XDocument.Load(file.Path); var keys = document .Descendants("data") - .Select(element => new ParserItem { + .Select(element => new ParserItem + { Key = element.Attribute("name")?.Value.Replace('.', ConstantSeparator)!, Value = element.Element("value")?.Value ?? string.Empty, - Comment = element.Element("comment")?.Value }) + Comment = element.Element("comment")?.Value + }) .Where(item => !string.IsNullOrEmpty(item.Key)); return keys is not null diff --git a/src/Files.Core.Storage/Extensions/StorageExtensions.File.cs b/src/Files.Core.Storage/Extensions/StorageExtensions.File.cs index a63151c041b9..ab94995a6f24 100644 --- a/src/Files.Core.Storage/Extensions/StorageExtensions.File.cs +++ b/src/Files.Core.Storage/Extensions/StorageExtensions.File.cs @@ -1,8 +1,8 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using System.IO; using OwlCore.Storage.System.IO; +using System.IO; namespace Files.Core.Storage.Extensions { diff --git a/src/Files.Core.Storage/GlobalUsings.cs b/src/Files.Core.Storage/GlobalUsings.cs index 88fe6c99dc37..766a80e03127 100644 --- a/src/Files.Core.Storage/GlobalUsings.cs +++ b/src/Files.Core.Storage/GlobalUsings.cs @@ -2,25 +2,11 @@ // Licensed under the MIT License. // System -global using global::System; -global using global::System.Collections; -global using global::System.Collections.Generic; -global using global::System.Collections.ObjectModel; -global using global::System.Linq; -global using global::System.Threading; -global using global::System.Threading.Tasks; -global using global::System.ComponentModel; -global using global::System.Diagnostics; -global using global::System.Text.Json; -global using global::System.Text.Json.Serialization; -global using SystemIO = global::System.IO; - // Files.Core.Storage -global using global::Files.Core.Storage; -global using global::Files.Core.Storage.Contracts; -global using global::Files.Core.Storage.Storables; -global using global::Files.Core.Storage.Enums; global using global::Files.Core.Storage.EventArguments; -global using global::Files.Core.Storage.Extensions; global using global::OwlCore.Storage; +global using global::System; +global using global::System.Threading; +global using global::System.Threading.Tasks; +global using SystemIO = global::System.IO; diff --git a/src/Files.Core.Storage/Storables/DirectStorage/IDirectCopy.cs b/src/Files.Core.Storage/Storables/DirectStorage/IDirectCopy.cs index 97e91c075724..98231b9326c9 100644 --- a/src/Files.Core.Storage/Storables/DirectStorage/IDirectCopy.cs +++ b/src/Files.Core.Storage/Storables/DirectStorage/IDirectCopy.cs @@ -7,10 +7,10 @@ namespace Files.Core.Storage.Storables /// Provides direct copy operation of storage objects. /// public interface IDirectCopy : IModifiableFolder - { - /// - /// Creates a copy of the provided storable item in this folder. - /// - Task CreateCopyOfAsync(IStorableChild itemToCopy, bool overwrite = default, CancellationToken cancellationToken = default); - } + { + /// + /// Creates a copy of the provided storable item in this folder. + /// + Task CreateCopyOfAsync(IStorableChild itemToCopy, bool overwrite = default, CancellationToken cancellationToken = default); + } } diff --git a/src/Files.Core.Storage/Storables/DirectStorage/IDirectMove.cs b/src/Files.Core.Storage/Storables/DirectStorage/IDirectMove.cs index 9049a09cfb04..2b3a4e948441 100644 --- a/src/Files.Core.Storage/Storables/DirectStorage/IDirectMove.cs +++ b/src/Files.Core.Storage/Storables/DirectStorage/IDirectMove.cs @@ -7,10 +7,10 @@ namespace Files.Core.Storage.Storables /// Provides direct move operation of storage objects. /// public interface IDirectMove : IModifiableFolder - { - /// - /// Moves a storable item out of the provided folder, and into this folder. Returns the new item that resides in this folder. - /// - Task MoveFromAsync(IStorableChild itemToMove, IModifiableFolder source, bool overwrite = default, CancellationToken cancellationToken = default); - } + { + /// + /// Moves a storable item out of the provided folder, and into this folder. Returns the new item that resides in this folder. + /// + Task MoveFromAsync(IStorableChild itemToMove, IModifiableFolder source, bool overwrite = default, CancellationToken cancellationToken = default); + } } diff --git a/tests/Files.App.UITests/Views/MainPage.xaml.cs b/tests/Files.App.UITests/Views/MainPage.xaml.cs index 80cd478254bb..ca9b51c8b97d 100644 --- a/tests/Files.App.UITests/Views/MainPage.xaml.cs +++ b/tests/Files.App.UITests/Views/MainPage.xaml.cs @@ -1,7 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; namespace Files.App.UITests.Views diff --git a/tests/Files.App.UITests/Views/OmnibarPage.xaml.cs b/tests/Files.App.UITests/Views/OmnibarPage.xaml.cs index 0fd9bc89e01e..89cf603520c8 100644 --- a/tests/Files.App.UITests/Views/OmnibarPage.xaml.cs +++ b/tests/Files.App.UITests/Views/OmnibarPage.xaml.cs @@ -4,7 +4,6 @@ using CommunityToolkit.WinUI; using Files.App.Controls; using Files.App.UITests.Data; -using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; using System.Collections.ObjectModel; diff --git a/tests/Files.App.UITests/Views/StorageControlsPage.xaml.cs b/tests/Files.App.UITests/Views/StorageControlsPage.xaml.cs index 0bc51d7e6ac5..85aa38a0769a 100644 --- a/tests/Files.App.UITests/Views/StorageControlsPage.xaml.cs +++ b/tests/Files.App.UITests/Views/StorageControlsPage.xaml.cs @@ -1,7 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; namespace Files.App.UITests.Views diff --git a/tests/Files.App.UITests/Views/ThemedIconPage.xaml.cs b/tests/Files.App.UITests/Views/ThemedIconPage.xaml.cs index cfcee70e7791..c6a98f94af80 100644 --- a/tests/Files.App.UITests/Views/ThemedIconPage.xaml.cs +++ b/tests/Files.App.UITests/Views/ThemedIconPage.xaml.cs @@ -1,7 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; namespace Files.App.UITests.Views diff --git a/tests/Files.App.UITests/Views/ToolbarPage.xaml.cs b/tests/Files.App.UITests/Views/ToolbarPage.xaml.cs index ae8e5bdd48fa..f5aa6dbda7bd 100644 --- a/tests/Files.App.UITests/Views/ToolbarPage.xaml.cs +++ b/tests/Files.App.UITests/Views/ToolbarPage.xaml.cs @@ -1,7 +1,6 @@ // Copyright (c) Files Community // Licensed under the MIT License. -using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; namespace Files.App.UITests.Views diff --git a/tests/Files.InteractionTests/Tests/SettingsTests.cs b/tests/Files.InteractionTests/Tests/SettingsTests.cs index fc19e80971aa..1a9fae510cda 100644 --- a/tests/Files.InteractionTests/Tests/SettingsTests.cs +++ b/tests/Files.InteractionTests/Tests/SettingsTests.cs @@ -2,8 +2,6 @@ // Licensed under the MIT License. using OpenQA.Selenium.Interactions; -using System; -using System.Threading; namespace Files.InteractionTests.Tests { From 1d88e364eee7f7a2e48de3ae653fc3a8683ec95e Mon Sep 17 00:00:00 2001 From: Yair <39923744+yaira2@users.noreply.github.com> Date: Thu, 24 Jul 2025 19:09:17 -0400 Subject: [PATCH 3/3] Revert "CheckPathInputAsync" This reverts commit cfd9a664b3783d36b139da21910bf99249ad8400. --- .../NavigationToolbarViewModel.cs | 111 ++++++++++++++++++ 1 file changed, 111 insertions(+) diff --git a/src/Files.App/ViewModels/UserControls/NavigationToolbarViewModel.cs b/src/Files.App/ViewModels/UserControls/NavigationToolbarViewModel.cs index 88952dfa9af9..8c683fe71885 100644 --- a/src/Files.App/ViewModels/UserControls/NavigationToolbarViewModel.cs +++ b/src/Files.App/ViewModels/UserControls/NavigationToolbarViewModel.cs @@ -696,6 +696,117 @@ private static string NormalizePathInput(string currentInput, bool isFtp) return currentInput; } + [Obsolete("Superseded by Omnibar.")] + public async Task CheckPathInputAsync(string currentInput, string currentSelectedPath, IShellPage shellPage) + { + if (currentInput.StartsWith('>')) + { + var code = currentInput.Substring(1).Trim(); + var command = Commands[code]; + + if (command == Commands.None) + await DialogDisplayHelper.ShowDialogAsync(Strings.InvalidCommand.GetLocalizedResource(), + string.Format(Strings.InvalidCommandContent.GetLocalizedResource(), code)); + else if (!command.IsExecutable) + await DialogDisplayHelper.ShowDialogAsync(Strings.CommandNotExecutable.GetLocalizedResource(), + string.Format(Strings.CommandNotExecutableContent.GetLocalizedResource(), command.Code)); + else + await command.ExecuteAsync(); + + return; + } + + var isFtp = FtpHelpers.IsFtpPath(currentInput); + + var normalizedInput = NormalizePathInput(currentInput, isFtp); + + if (currentSelectedPath == normalizedInput || string.IsNullOrWhiteSpace(normalizedInput)) + return; + + if (normalizedInput != shellPage.ShellViewModel.WorkingDirectory || shellPage.CurrentPageType == typeof(HomePage)) + { + if (normalizedInput.Equals("Home", StringComparison.OrdinalIgnoreCase) || normalizedInput.Equals(Strings.Home.GetLocalizedResource(), StringComparison.OrdinalIgnoreCase)) + { + SavePathToHistory("Home"); + shellPage.NavigateHome(); + } + else if (normalizedInput.Equals("ReleaseNotes", StringComparison.OrdinalIgnoreCase) || normalizedInput.Equals(Strings.ReleaseNotes.GetLocalizedResource(), StringComparison.OrdinalIgnoreCase)) + { + SavePathToHistory("ReleaseNotes"); + shellPage.NavigateToReleaseNotes(); + } + // TODO add settings page + //else if (normalizedInput.Equals("Settings", StringComparison.OrdinalIgnoreCase) || normalizedInput.Equals(Strings.Settings.GetLocalizedResource(), StringComparison.OrdinalIgnoreCase)) + //{ + // SavePathToHistory("Settings"); + // shellPage.NavigateToReleaseNotes(); + //} + else + { + normalizedInput = StorageFileExtensions.GetResolvedPath(normalizedInput, isFtp); + if (currentSelectedPath == normalizedInput) + return; + + var item = await FilesystemTasks.Wrap(() => DriveHelpers.GetRootFromPathAsync(normalizedInput)); + + var resFolder = await FilesystemTasks.Wrap(() => StorageFileExtensions.DangerousGetFolderWithPathFromPathAsync(normalizedInput, item)); + if (resFolder || FolderHelpers.CheckFolderAccessWithWin32(normalizedInput)) + { + var matchingDrive = drivesViewModel.Drives.Cast().FirstOrDefault(x => PathNormalization.NormalizePath(normalizedInput).StartsWith(PathNormalization.NormalizePath(x.Path), StringComparison.Ordinal)); + if (matchingDrive is not null && matchingDrive.Type == Data.Items.DriveType.CDRom && matchingDrive.MaxSpace == ByteSizeLib.ByteSize.FromBytes(0)) + { + bool ejectButton = await DialogDisplayHelper.ShowDialogAsync(Strings.InsertDiscDialog_Title.GetLocalizedResource(), string.Format(Strings.InsertDiscDialog_Text.GetLocalizedResource(), matchingDrive.Path), Strings.InsertDiscDialog_OpenDriveButton.GetLocalizedResource(), Strings.Close.GetLocalizedResource()); + if (ejectButton) + DriveHelpers.EjectDeviceAsync(matchingDrive.Path); + return; + } + var pathToNavigate = resFolder.Result?.Path ?? normalizedInput; + SavePathToHistory(pathToNavigate); + shellPage.NavigateToPath(pathToNavigate); + } + else if (isFtp) + { + SavePathToHistory(normalizedInput); + shellPage.NavigateToPath(normalizedInput); + } + else // Not a folder or inaccessible + { + var resFile = await FilesystemTasks.Wrap(() => StorageFileExtensions.DangerousGetFileWithPathFromPathAsync(normalizedInput, item)); + if (resFile) + { + var pathToInvoke = resFile.Result.Path; + await Win32Helper.InvokeWin32ComponentAsync(pathToInvoke, shellPage); + } + else // Not a file or not accessible + { + var workingDir = + string.IsNullOrEmpty(shellPage.ShellViewModel.WorkingDirectory) || + shellPage.CurrentPageType == typeof(HomePage) ? + Constants.UserEnvironmentPaths.HomePath : + shellPage.ShellViewModel.WorkingDirectory; + + if (await LaunchApplicationFromPath(currentInput, workingDir)) + return; + + try + { + if (!await Windows.System.Launcher.LaunchUriAsync(new Uri(currentInput))) + await DialogDisplayHelper.ShowDialogAsync(Strings.InvalidItemDialogTitle.GetLocalizedResource(), + string.Format(Strings.InvalidItemDialogContent.GetLocalizedResource(), Environment.NewLine, resFolder.ErrorCode.ToString())); + } + catch (Exception ex) when (ex is UriFormatException || ex is ArgumentException) + { + await DialogDisplayHelper.ShowDialogAsync(Strings.InvalidItemDialogTitle.GetLocalizedResource(), + string.Format(Strings.InvalidItemDialogContent.GetLocalizedResource(), Environment.NewLine, resFolder.ErrorCode.ToString())); + } + } + } + } + + PathControlDisplayText = shellPage.ShellViewModel.WorkingDirectory; + } + } + private void SavePathToHistory(string path) { var pathHistoryList = UserSettingsService.GeneralSettingsService.PathHistoryList?.ToList() ?? [];