Frequency navigation WIP
This commit is contained in:
@@ -59,6 +59,7 @@ public static class MainConfiguration
|
||||
new(EnterRapidTravelCommand.CommandName,new KeyConfig(Key.OemQuestion, shift: true)),
|
||||
//new CommandBindingConfiguration(ConfigCommand.FindByName, new[] { Key.F, Key.N }),
|
||||
//new CommandBindingConfiguration(ConfigCommand.FindByNameRegex, new[] { Key.F, Key.R }),
|
||||
new(GoByFrequencyCommand.CommandName, Key.Z),
|
||||
new(GoToHomeCommand.CommandName, new[] { Key.G, Key.H }),
|
||||
new(GoToPathCommand.CommandName, new KeyConfig(Key.L, ctrl: true)),
|
||||
new(GoToPathCommand.CommandName, new[] { Key.G, Key.P }),
|
||||
|
||||
@@ -2,6 +2,7 @@ using Avalonia;
|
||||
using Avalonia.Controls.ApplicationLifetimes;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using FileTime.App.DependencyInjection;
|
||||
using FileTime.App.FrequencyNavigation;
|
||||
using FileTime.GuiApp.Font;
|
||||
using FileTime.GuiApp.ViewModels;
|
||||
using FileTime.GuiApp.Views;
|
||||
@@ -17,6 +18,7 @@ public partial class App : Application
|
||||
var configuration = Startup.CreateConfiguration();
|
||||
DI.ServiceProvider = DependencyInjection
|
||||
.RegisterDefaultServices()
|
||||
.AddFrequencyNavigation()
|
||||
.AddConfiguration(configuration)
|
||||
.ConfigureFont(configuration)
|
||||
.RegisterLogging()
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\AppCommon\FileTime.App.Core\FileTime.App.Core.csproj" />
|
||||
<ProjectReference Include="..\..\..\AppCommon\FileTime.App.DependencyInjection\FileTime.App.DependencyInjection.csproj" />
|
||||
<ProjectReference Include="..\..\..\AppCommon\FileTime.App.FrequencyNavigation\FileTime.App.FrequencyNavigation.csproj" />
|
||||
<ProjectReference Include="..\FileTime.GuiApp.CustomImpl\FileTime.GuiApp.CustomImpl.csproj" />
|
||||
<ProjectReference Include="..\FileTime.GuiApp.Font\FileTime.GuiApp.Font.csproj" />
|
||||
<ProjectReference Include="..\FileTime.GuiApp\FileTime.GuiApp.csproj" />
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\AppCommon\FileTime.App.Core.Abstraction\FileTime.App.Core.Abstraction.csproj" />
|
||||
<ProjectReference Include="..\..\..\AppCommon\FileTime.App.FrequencyNavigation.Abstractions\FileTime.App.FrequencyNavigation.Abstractions.csproj" />
|
||||
<ProjectReference Include="..\..\..\Providers\FileTime.Providers.Local.Abstractions\FileTime.Providers.Local.Abstractions.csproj" />
|
||||
<ProjectReference Include="..\FileTime.GuiApp.Abstractions\FileTime.GuiApp.Abstractions.csproj" />
|
||||
<ProjectReference Include="..\FileTime.GuiApp.Font.Abstractions\FileTime.GuiApp.Font.Abstractions.csproj" />
|
||||
|
||||
@@ -1,20 +1,31 @@
|
||||
using DynamicData;
|
||||
using FileTime.App.Core.Services;
|
||||
using FileTime.App.Core.ViewModels;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace FileTime.GuiApp.Services;
|
||||
|
||||
public class ModalService : IModalService
|
||||
{
|
||||
private readonly IServiceProvider _serviceProvider;
|
||||
private readonly SourceList<IModalViewModel> _openModals = new();
|
||||
public IObservable<IChangeSet<IModalViewModel>> OpenModals { get; }
|
||||
|
||||
public ModalService()
|
||||
public ModalService(IServiceProvider serviceProvider)
|
||||
{
|
||||
_serviceProvider = serviceProvider;
|
||||
OpenModals = _openModals.Connect().StartWithEmpty();
|
||||
}
|
||||
|
||||
public void OpenModal(IModalViewModel modalToOpen) => _openModals.Add(modalToOpen);
|
||||
|
||||
public void CloseModal(IModalViewModel modalToClose) => _openModals.Remove(modalToClose);
|
||||
|
||||
public T OpenModal<T>() where T : IModalViewModel
|
||||
{
|
||||
var modal = _serviceProvider.GetRequiredService<T>();
|
||||
OpenModal(modal);
|
||||
|
||||
return modal;
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,8 @@ using System.Reflection;
|
||||
using Avalonia.Input;
|
||||
using FileTime.App.Core.Services;
|
||||
using FileTime.App.Core.UserCommand;
|
||||
using FileTime.App.FrequencyNavigation.Services;
|
||||
using FileTime.App.FrequencyNavigation.ViewModels;
|
||||
using FileTime.Core.Models;
|
||||
using FileTime.Core.Timeline;
|
||||
using FileTime.GuiApp.Services;
|
||||
@@ -24,6 +26,7 @@ namespace FileTime.GuiApp.ViewModels;
|
||||
[Inject(typeof(IDialogService), PropertyAccessModifier = AccessModifier.Public)]
|
||||
[Inject(typeof(ITimelessContentProvider), PropertyName = "_timelessContentProvider")]
|
||||
[Inject(typeof(IFontService), "_fontService")]
|
||||
[Inject(typeof(IFrequencyNavigationService), PropertyAccessModifier = AccessModifier.Public)]
|
||||
public partial class MainWindowViewModel : IMainWindowViewModelBase
|
||||
{
|
||||
public bool Loading => false;
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
<UserControl
|
||||
x:Class="FileTime.GuiApp.Views.FrequencyNavigation"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:viewModels="clr-namespace:FileTime.App.FrequencyNavigation.ViewModels;assembly=FileTime.App.FrequencyNavigation.Abstractions"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
x:CompileBindings="True"
|
||||
x:DataType="viewModels:IFrequencyNavigationViewModel"
|
||||
mc:Ignorable="d">
|
||||
<Grid RowDefinitions="Auto,*">
|
||||
<TextBox
|
||||
KeyDown="Search_OnKeyDown"
|
||||
Text="{Binding SearchText, Mode=TwoWay}" />
|
||||
<ItemsRepeater
|
||||
Grid.Row="1"
|
||||
Items="{Binding FilteredMatches}">
|
||||
<ItemsRepeater.ItemTemplate>
|
||||
<DataTemplate x:DataType="x:String">
|
||||
<Grid Margin="5">
|
||||
<TextBlock Text="{Binding}" />
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ItemsRepeater.ItemTemplate>
|
||||
</ItemsRepeater>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,30 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using FileTime.App.FrequencyNavigation.ViewModels;
|
||||
|
||||
namespace FileTime.GuiApp.Views;
|
||||
|
||||
public partial class FrequencyNavigation : UserControl
|
||||
{
|
||||
public FrequencyNavigation()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
AvaloniaXamlLoader.Load(this);
|
||||
}
|
||||
|
||||
private void Search_OnKeyDown(object? sender, KeyEventArgs e)
|
||||
{
|
||||
if (DataContext is not IFrequencyNavigationViewModel viewModel) return;
|
||||
|
||||
if (e.Key == Key.Escape)
|
||||
{
|
||||
viewModel.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -709,6 +709,15 @@
|
||||
</Border>
|
||||
</Border>
|
||||
|
||||
<Border
|
||||
DataContext="{Binding FrequencyNavigationService.CurrentModal}"
|
||||
Margin="100"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
Background="{DynamicResource BarelyTransparentBackgroundColor}"
|
||||
IsVisible="{Binding ShowWindow^, FallbackValue=False}">
|
||||
<local:FrequencyNavigation />
|
||||
</Border>
|
||||
</Grid>
|
||||
|
||||
<Grid IsVisible="{Binding Loading}">
|
||||
|
||||
Reference in New Issue
Block a user