/
githubmirror
/
Files
Обзор
Документация
Войти
/
githubmirror
/
Files
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/Files.App/Data/Contexts/SideBar/SideBarContext.cs
46 строк
1 KB
Steve
Code Quality: Upgrade dependencies (#16741)
09 фев 2025, 05:02
Не верифицирован
09 фев 2025, 05:02
273c947
Код
Авторство
О чём код?
// Copyright (c) Files Community // Licensed under the MIT License. namespace Files.App.Data.Contexts { /// <inheritdoc cref="ISidebarContext"/> internal sealed partial class SidebarContext : ObservableObject, ISidebarContext { private readonly PinnedFoldersManager favoriteModel = App.QuickAccessManager.Model; private int PinnedFolderItemIndex => IsItemRightClicked ? favoriteModel.IndexOfItem(_RightClickedItem!) : -1; private INavigationControlItem? _RightClickedItem = null; public INavigationControlItem? RightClickedItem => _RightClickedItem; public bool IsItemRightClicked => _RightClickedItem is not null; public bool IsPinnedFolderItem => IsItemRightClicked && _RightClickedItem!.Section is SectionType.Pinned && PinnedFolderItemIndex is not -1; public DriveItem? OpenDriveItem => _RightClickedItem as DriveItem; public SidebarContext() { SidebarViewModel.RightClickedItemChanged += SidebarControl_RightClickedItemChanged; } public void SidebarControl_RightClickedItemChanged(object? sender, INavigationControlItem? e) { if (SetProperty(ref _RightClickedItem, e, nameof(RightClickedItem))) { OnPropertyChanged(nameof(IsItemRightClicked)); OnPropertyChanged(nameof(PinnedFolderItemIndex)); OnPropertyChanged(nameof(IsPinnedFolderItem)); OnPropertyChanged(nameof(OpenDriveItem)); } } } }