Fix RootDriveInfo not show every drive

This commit is contained in:
2023-09-06 09:29:29 +02:00
parent 0e6c0c5cd5
commit 67484ba56b
9 changed files with 82 additions and 70 deletions

View File

@@ -7,7 +7,6 @@ namespace FileTime.GuiApp.App.ViewModels;
public interface IGuiAppState : IAppState
{
ObservableCollection<RootDriveInfo> RootDriveInfos { get; set; }
IReadOnlyList<PlaceInfo> Places { get; set; }
ObservableCollection<string> PopupTexts { get; }
IObservable<GuiPanel> ActivePanel { get; }

View File

@@ -6,6 +6,7 @@ using FileTime.App.Core.ViewModels.Timeline;
using FileTime.App.FrequencyNavigation.Services;
using FileTime.GuiApp.App.CloudDrives;
using FileTime.GuiApp.App.Services;
using FileTime.Providers.Local;
using FileTime.Providers.LocalAdmin;
namespace FileTime.GuiApp.App.ViewModels;
@@ -23,6 +24,7 @@ public interface IMainWindowViewModel : IMainWindowViewModelBase
ITimelineViewModel TimelineViewModel { get; }
IPossibleCommandsViewModel PossibleCommands { get; }
ICloudDriveService CloudDriveService { get; }
IRootDriveInfoService RootDriveInfoService { get; }
Action? ShowWindow { get; set; }
Thickness IconStatusPanelMargin { get; }
Task RunOrOpenItem(IItemViewModel itemViewModel);

View File

@@ -45,6 +45,7 @@ namespace FileTime.GuiApp.App.ViewModels;
[Inject(typeof(IPossibleCommandsViewModel), PropertyName = "PossibleCommands", PropertyAccessModifier = AccessModifier.Public)]
[Inject(typeof(IInstanceMessageHandler), PropertyName = "_instanceMessageHandler")]
[Inject(typeof(ICloudDriveService), PropertyAccessModifier = AccessModifier.Public)]
[Inject(typeof(IRootDriveInfoService), PropertyAccessModifier = AccessModifier.Public)]
public partial class MainWindowViewModel : IMainWindowViewModel
{
public bool Loading => false;

View File

@@ -128,12 +128,13 @@
<ItemsRepeater
Grid.Row="1"
ItemsSource="{Binding AppState.RootDriveInfos}">
ItemsSource="{Binding RootDriveInfoService.RootDriveInfos}">
<ItemsRepeater.ItemTemplate>
<DataTemplate x:DataType="local1:RootDriveInfo">
<Grid
Classes="SidebarContainerPresenter"
PointerPressed="OnHasContainerPointerPressed">
PointerPressed="OnHasContainerPointerPressed"
ToolTip.Tip="{Binding FullName}">
<Grid
Margin="10,5"
ColumnDefinitions="Auto,*,Auto"
@@ -147,6 +148,7 @@
Source="{SvgImage /Assets/material/folder.svg}" />
<StackPanel
Grid.Row="0"
Grid.Column="1"
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
@@ -155,7 +157,7 @@
<TextBlock
Margin="5,0,0,0"
VerticalAlignment="Center"
Text="{Binding FullName}" />
Text="{Binding Name}" />
<TextBlock
Margin="5,0,0,0"

View File

@@ -13,17 +13,14 @@ public partial class GuiAppState : AppStateBase, IGuiAppState, IDisposable
{
private readonly BehaviorSubject<GuiPanel> _activePanel = new(GuiPanel.FileBrowser);
[Notify] private ObservableCollection<RootDriveInfo> _rootDriveInfos;
[Notify] private IReadOnlyList<PlaceInfo> _places = new List<PlaceInfo>();
public ObservableCollection<string> PopupTexts { get; } = new();
public IObservable<GuiPanel> ActivePanel { get; }
public GuiAppState(IRootDriveInfoService rootDriveInfoService)
public GuiAppState()
{
ActivePanel = _activePanel.AsObservable();
_rootDriveInfos = rootDriveInfoService.RootDriveInfos;
}
public void SetActivePanel(GuiPanel newPanel)