ConsoleUI container size text
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
using FileTime.App.CommandPalette.ViewModels;
|
||||
using DeclarativeProperty;
|
||||
using FileTime.App.CommandPalette.ViewModels;
|
||||
using FileTime.App.Core.ViewModels;
|
||||
using FileTime.App.Core.ViewModels.Timeline;
|
||||
using FileTime.ConsoleUI.App.Services;
|
||||
using FileTime.Core.Interactions;
|
||||
using FileTime.Core.Models;
|
||||
|
||||
namespace FileTime.ConsoleUI.App;
|
||||
|
||||
@@ -15,5 +17,6 @@ public interface IRootViewModel
|
||||
ICommandPaletteViewModel CommandPalette { get; }
|
||||
IDialogService DialogService { get; }
|
||||
ITimelineViewModel TimelineViewModel { get; }
|
||||
IDeclarativeProperty<VolumeSizeInfo?> VolumeSizeInfo { get; }
|
||||
event Action<IInputElement>? FocusReadInputElement;
|
||||
}
|
||||
@@ -79,7 +79,7 @@ public class MainWindow
|
||||
private Grid<IRootViewModel> MainContent() =>
|
||||
new()
|
||||
{
|
||||
RowDefinitionsObject = "Auto * Auto Auto Auto",
|
||||
RowDefinitionsObject = "Auto * Auto Auto Auto Auto",
|
||||
ChildInitializer =
|
||||
{
|
||||
new Grid<IRootViewModel>
|
||||
@@ -176,6 +176,38 @@ public class MainWindow
|
||||
}
|
||||
},
|
||||
_timeline.View().WithExtension(new GridPositionExtension(0, 4)),
|
||||
new Grid<IRootViewModel>
|
||||
{
|
||||
ColumnDefinitionsObject = "* Auto",
|
||||
Extensions =
|
||||
{
|
||||
new GridPositionExtension(0, 5)
|
||||
},
|
||||
ChildInitializer =
|
||||
{
|
||||
new TextBlock<IRootViewModel>
|
||||
{
|
||||
Extensions = {new GridPositionExtension(1, 0)}
|
||||
}
|
||||
.Setup(t =>
|
||||
{
|
||||
t.Bind(
|
||||
t,
|
||||
dc => dc.VolumeSizeInfo.Value,
|
||||
t => t.IsVisible,
|
||||
v => v is null ? false : v.HasValue
|
||||
);
|
||||
t.Bind(
|
||||
t,
|
||||
dc => dc.VolumeSizeInfo.Value,
|
||||
tb => tb.Text,
|
||||
v => v.HasValue
|
||||
? $"{ByteSize.FromBytes(v.Value.FreeSize)} / {ByteSize.FromBytes(v.Value.TotalSize)} free"
|
||||
: string.Empty
|
||||
);
|
||||
})
|
||||
}
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
using FileTime.App.CommandPalette.ViewModels;
|
||||
using DeclarativeProperty;
|
||||
using FileTime.App.CommandPalette.ViewModels;
|
||||
using FileTime.App.Core.ViewModels;
|
||||
using FileTime.App.Core.ViewModels.Timeline;
|
||||
using FileTime.ConsoleUI.App.Services;
|
||||
using FileTime.Core.Interactions;
|
||||
using FileTime.Core.Models;
|
||||
|
||||
namespace FileTime.ConsoleUI.App;
|
||||
|
||||
@@ -15,6 +17,8 @@ public class RootViewModel : IRootViewModel
|
||||
public ICommandPaletteViewModel CommandPalette { get; }
|
||||
public IDialogService DialogService { get; }
|
||||
public ITimelineViewModel TimelineViewModel { get; }
|
||||
public IDeclarativeProperty<VolumeSizeInfo?> VolumeSizeInfo { get;}
|
||||
|
||||
public event Action<IInputElement>? FocusReadInputElement;
|
||||
|
||||
public RootViewModel(
|
||||
@@ -40,5 +44,10 @@ public class RootViewModel : IRootViewModel
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
VolumeSizeInfo = appState.SelectedTab
|
||||
.Map(t => t?.CurrentLocation)
|
||||
.Switch()
|
||||
.Map(l => l?.Provider.GetVolumeSizeInfo(l.FullName!));
|
||||
}
|
||||
}
|
||||
@@ -32,7 +32,7 @@ public record Theme(
|
||||
public static class DefaultThemes
|
||||
{
|
||||
public static Theme Color256Theme => new(
|
||||
DefaultForegroundColor: Color256Colors.Foregrounds.Gray,
|
||||
DefaultForegroundColor: null,
|
||||
DefaultForegroundAccentColor: Color256Colors.Foregrounds.Red,
|
||||
DefaultBackgroundColor: null,
|
||||
ElementColor: Color256Colors.Foregrounds.Gray,
|
||||
@@ -67,7 +67,7 @@ public static class DefaultThemes
|
||||
);
|
||||
|
||||
public static Theme ConsoleColorTheme => new(
|
||||
DefaultForegroundColor: ConsoleColors.Foregrounds.Gray,
|
||||
DefaultForegroundColor: null,
|
||||
DefaultForegroundAccentColor: ConsoleColors.Foregrounds.Red,
|
||||
DefaultBackgroundColor: null,
|
||||
ElementColor: ConsoleColors.Foregrounds.Gray,
|
||||
|
||||
Reference in New Issue
Block a user