Possible commands, IsAlternative fix
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
using System.Globalization;
|
||||
using Avalonia.Data.Converters;
|
||||
using FileTime.App.Core.Command;
|
||||
|
||||
namespace FileTime.GuiApp.Converters;
|
||||
|
||||
public class CommandToCommandNameConverter : IValueConverter
|
||||
{
|
||||
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||
{
|
||||
if(value is not Commands command) return value;
|
||||
|
||||
//TODO: implement
|
||||
return command.ToString();
|
||||
}
|
||||
|
||||
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,7 @@ using MvvmGen;
|
||||
namespace FileTime.GuiApp.ViewModels;
|
||||
|
||||
[ViewModel]
|
||||
[Inject(typeof(IAppState), "_appState")]
|
||||
[Inject(typeof(IGuiAppState), "_appState")]
|
||||
[Inject(typeof(ILocalContentProvider), "_localContentProvider")]
|
||||
[Inject(typeof(IServiceProvider), PropertyName = "_serviceProvider")]
|
||||
[Inject(typeof(ILogger<MainWindowViewModel>), PropertyName = "_logger")]
|
||||
@@ -22,7 +22,7 @@ namespace FileTime.GuiApp.ViewModels;
|
||||
public partial class MainWindowViewModel : IMainWindowViewModelBase
|
||||
{
|
||||
public bool Loading => false;
|
||||
public IAppState AppState => _appState;
|
||||
public IGuiAppState AppState => _appState;
|
||||
public string Title { get; private set; }
|
||||
|
||||
partial void OnInitialize()
|
||||
@@ -30,7 +30,7 @@ public partial class MainWindowViewModel : IMainWindowViewModelBase
|
||||
_logger?.LogInformation($"Starting {nameof(MainWindowViewModel)} initialization...");
|
||||
|
||||
var version = Assembly.GetEntryAssembly()!.GetName().Version;
|
||||
var versionString = "Unknwon version";
|
||||
var versionString = "Unknown version";
|
||||
if (version != null)
|
||||
{
|
||||
versionString = $"{version.Major}.{version.Minor}.{version.Build}";
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
xmlns:local="using:FileTime.GuiApp.Views"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:vm="using:FileTime.GuiApp.ViewModels"
|
||||
xmlns:config="using:FileTime.GuiApp.Configuration"
|
||||
Title="FileTime"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
@@ -180,7 +181,8 @@
|
||||
Fill="{DynamicResource ContentSeparatorBrush}" />
|
||||
|
||||
<Grid Grid.Column="4">
|
||||
<Grid IsVisible="{Binding AppState.SelectedTab^.SelectedsChildrenCollection.Collection, Converter={x:Static ObjectConverters.IsNotNull}}">
|
||||
<Grid
|
||||
IsVisible="{Binding AppState.SelectedTab^.SelectedsChildrenCollection.Collection, Converter={x:Static ObjectConverters.IsNotNull}}">
|
||||
<ListBox
|
||||
x:Name="ChildItems"
|
||||
x:CompileBindings="False"
|
||||
@@ -232,6 +234,42 @@
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
<Grid Grid.Row="3">
|
||||
<Grid
|
||||
IsVisible="{Binding AppState.PossibleCommands.Count, Converter={StaticResource NotEqualsConverter}, ConverterParameter=0}">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="1" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Rectangle
|
||||
Height="1"
|
||||
Margin="10,0"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Center"
|
||||
Fill="{DynamicResource ContentSeparatorBrush}" />
|
||||
|
||||
<ItemsRepeater
|
||||
Grid.Row="1"
|
||||
Items="{Binding AppState.PossibleCommands}">
|
||||
<ItemsRepeater.ItemTemplate>
|
||||
<DataTemplate x:DataType="config:CommandBindingConfiguration">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="200" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock Text="{Binding KeysDisplayText}" />
|
||||
<TextBlock Grid.Column="1"
|
||||
Text="{Binding Command, Converter={StaticResource CommandToCommandNameConverter}}" />
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ItemsRepeater.ItemTemplate>
|
||||
</ItemsRepeater>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<!-- Borders -->
|
||||
|
||||
Reference in New Issue
Block a user