protected override void OnNavigatedTo(NavigationEventArgs eventArgs) { base.OnNavigatedTo(eventArgs); currentIconSize = FolderSettings.GetIconSize(); FolderSettings.LayoutModeChangeRequested -= FolderSettings_LayoutModeChangeRequested; FolderSettings.LayoutModeChangeRequested += FolderSettings_LayoutModeChangeRequested; ParentShellPageInstance.FilesystemViewModel.FilesAndFolders.CollectionChanged += FilesAndFolders_CollectionChanged; if (FileList.ItemsSource == null) { FileList.ItemsSource = ParentShellPageInstance.FilesystemViewModel.FilesAndFolders; } var parameters = (NavigationArguments)eventArgs.Parameter; if (parameters.IsLayoutSwitch) { ReloadItemIcons(); UpdateItemColumnViewModels(); } UpdateSortOptionsCommand = new RelayCommand <string>(x => { var val = Enum.Parse <SortOption>(x); if (ParentShellPageInstance.FilesystemViewModel.folderSettings.DirectorySortOption == val) { ParentShellPageInstance.FilesystemViewModel.folderSettings.DirectorySortDirection = (SortDirection)(((int)ParentShellPageInstance.FilesystemViewModel.folderSettings.DirectorySortDirection + 1) % 2); } else { ParentShellPageInstance.FilesystemViewModel.folderSettings.DirectorySortOption = val; ParentShellPageInstance.FilesystemViewModel.folderSettings.DirectorySortDirection = SortDirection.Ascending; } }); }
private void FolderSettings_GridViewSizeChangeRequested(object sender, EventArgs e) { var requestedIconSize = FolderSettings.GetIconSize(); // Get new icon size // Prevents reloading icons when the icon size hasn't changed if (requestedIconSize != currentIconSize) { currentIconSize = requestedIconSize; // Update icon size before refreshing ReloadItemIcons(); } }
private void FolderSettings_LayoutModeChangeRequested(object sender, LayoutModeEventArgs e) { if (FolderSettings.LayoutMode == FolderLayoutModes.GridView || FolderSettings.LayoutMode == FolderLayoutModes.TilesView) { SetItemTemplate(); // Set ItemTemplate var requestedIconSize = FolderSettings.GetIconSize(); if (requestedIconSize != currentIconSize) { currentIconSize = requestedIconSize; ReloadItemIcons(); } } }
protected override void OnNavigatedTo(NavigationEventArgs eventArgs) { base.OnNavigatedTo(eventArgs); currentIconSize = FolderSettings.GetIconSize(); FolderSettings.LayoutModeChangeRequested -= FolderSettings_LayoutModeChangeRequested; FolderSettings.LayoutModeChangeRequested += FolderSettings_LayoutModeChangeRequested; SetItemTemplate(); // Set ItemTemplate if (FileList.ItemsSource == null) { FileList.ItemsSource = ParentShellPageInstance.FilesystemViewModel.FilesAndFolders; } var parameters = (NavigationArguments)eventArgs.Parameter; if (parameters.IsLayoutSwitch) { ReloadItemIcons(); } }