InputHandler, CreateContainer user command
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
xmlns:vm="using:FileTime.GuiApp.ViewModels"
|
||||
xmlns:config="using:FileTime.GuiApp.Configuration"
|
||||
xmlns:appCoreModels="using:FileTime.App.Core.Models"
|
||||
xmlns:interactions="using:FileTime.Core.Interactions"
|
||||
Title="FileTime"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
@@ -416,9 +417,12 @@
|
||||
</Grid>
|
||||
<Grid
|
||||
IsVisible="{Binding ItemPreviewService.ItemPreview^,Converter={x:Static ObjectConverters.IsNotNull}}">
|
||||
<TextBlock HorizontalAlignment="Center" Text="Don't know how to preview this item." IsVisible="{Binding ItemPreviewService.ItemPreview^.Mode, Converter={StaticResource EqualityConverter}, ConverterParameter={x:Static appCoreModels:ItemPreviewMode.Unknown}}"/>
|
||||
<TextBlock HorizontalAlignment="Center" Text="Empty" IsVisible="{Binding ItemPreviewService.ItemPreview^.Mode, Converter={StaticResource EqualityConverter}, ConverterParameter={x:Static appCoreModels:ItemPreviewMode.Empty}}"/>
|
||||
<ScrollViewer IsVisible="{Binding ItemPreviewService.ItemPreview^.Mode, Converter={StaticResource EqualityConverter}, ConverterParameter={x:Static appCoreModels:ItemPreviewMode.Text}}">
|
||||
<TextBlock HorizontalAlignment="Center" Text="Don't know how to preview this item."
|
||||
IsVisible="{Binding ItemPreviewService.ItemPreview^.Mode, Converter={StaticResource EqualityConverter}, ConverterParameter={x:Static appCoreModels:ItemPreviewMode.Unknown}}" />
|
||||
<TextBlock HorizontalAlignment="Center" Text="Empty"
|
||||
IsVisible="{Binding ItemPreviewService.ItemPreview^.Mode, Converter={StaticResource EqualityConverter}, ConverterParameter={x:Static appCoreModels:ItemPreviewMode.Empty}}" />
|
||||
<ScrollViewer
|
||||
IsVisible="{Binding ItemPreviewService.ItemPreview^.Mode, Converter={StaticResource EqualityConverter}, ConverterParameter={x:Static appCoreModels:ItemPreviewMode.Text}}">
|
||||
<TextBox
|
||||
IsReadOnly="True"
|
||||
x:CompileBindings="False"
|
||||
@@ -495,7 +499,72 @@
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<!-- Borders -->
|
||||
|
||||
<Border
|
||||
Background="{DynamicResource BarelyTransparentBackgroundColor}"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
IsVisible="{Binding DialogService.ReadInput^, Converter={x:Static ObjectConverters.IsNotNull}}">
|
||||
<Border
|
||||
Background="{DynamicResource ContainerBackgroundBrush}"
|
||||
Padding="20"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center">
|
||||
<Grid RowDefinitions="Auto,Auto">
|
||||
|
||||
<ItemsControl
|
||||
x:Name="InputList"
|
||||
Items="{Binding DialogService.ReadInput^.Inputs}">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Grid MinWidth="500" ColumnDefinitions="250,*" Margin="10,5" x:Name="ItemRoot">
|
||||
<TextBlock
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Top"
|
||||
Text="{Binding Label}" />
|
||||
<Grid Grid.Column="1">
|
||||
<TextBox
|
||||
x:DataType="interactions:TextInputElement"
|
||||
IsVisible="{Binding Type, Converter={StaticResource EqualityConverter}, ConverterParameter={x:Static interactions:InputType.Text}}"
|
||||
VerticalAlignment="Top"
|
||||
Text="{Binding Value, Mode=TwoWay}" />
|
||||
<TextBox
|
||||
x:DataType="interactions:PasswordInputElement"
|
||||
IsVisible="{Binding Type, Converter={StaticResource EqualityConverter}, ConverterParameter={x:Static interactions:InputType.Password}}"
|
||||
PasswordChar="{Binding PasswordChar}"
|
||||
VerticalAlignment="Top"
|
||||
Text="{Binding Value, Mode=TwoWay}" />
|
||||
<ListBox
|
||||
x:DataType="interactions:IOptionsInputElement"
|
||||
Classes="RadioButtonListBox"
|
||||
IsVisible="{Binding Type, Converter={StaticResource EqualityConverter}, ConverterParameter={x:Static interactions:InputType.Options}}"
|
||||
Items="{Binding Options}"
|
||||
SelectedItem="{Binding Value}" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
<StackPanel
|
||||
DataContext="{Binding DialogService.ReadInput^}"
|
||||
Grid.Row="1"
|
||||
Orientation="Horizontal"
|
||||
Margin="0,10,0,0">
|
||||
<Button
|
||||
HorizontalContentAlignment="Center"
|
||||
Width="80"
|
||||
Command="{Binding ProcessCommand}"
|
||||
Content="Ok" />
|
||||
<Button
|
||||
HorizontalContentAlignment="Center"
|
||||
Width="80"
|
||||
Margin="10,0,0,0"
|
||||
Command="{Binding CancelCommand}"
|
||||
Content="Cancel" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Border>
|
||||
|
||||
</Grid>
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@ namespace FileTime.GuiApp.Views;
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
private readonly ILogger<MainWindow>? _logger;
|
||||
private InputElementWrapper? _inputElementWrapper;
|
||||
|
||||
public MainWindowViewModel? ViewModel
|
||||
{
|
||||
@@ -38,17 +37,15 @@ public partial class MainWindow : Window
|
||||
{
|
||||
if (DataContext is not MainWindowViewModel)
|
||||
{
|
||||
_logger?.LogInformation($"{nameof(MainWindow)} opened, starting {nameof(MainWindowViewModel)} initialization...");
|
||||
_logger?.LogInformation(
|
||||
$"{nameof(MainWindow)} opened, starting {nameof(MainWindowViewModel)} initialization...");
|
||||
ViewModel = DI.ServiceProvider.GetRequiredService<MainWindowViewModel>();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (_inputElementWrapper == null)
|
||||
{
|
||||
ViewModel?.ProcessKeyDown(e.Key, e.KeyModifiers, h => e.Handled = h);
|
||||
}
|
||||
ViewModel?.ProcessKeyDown(e.Key, e.KeyModifiers, h => e.Handled = h);
|
||||
}
|
||||
|
||||
private void HeaderPointerPressed(object sender, PointerPressedEventArgs e)
|
||||
@@ -78,7 +75,7 @@ public partial class MainWindow : Window
|
||||
&& sender is StyledElement control)
|
||||
{
|
||||
IAbsolutePath? path = null;
|
||||
if (control.DataContext is IHaveAbsolutePath {Path: { }} haveAbsolutePath)
|
||||
if (control.DataContext is IHaveAbsolutePath { Path: { } } haveAbsolutePath)
|
||||
{
|
||||
path = haveAbsolutePath.Path;
|
||||
}
|
||||
@@ -102,7 +99,8 @@ public partial class MainWindow : Window
|
||||
|
||||
var resolvedItem = await path.ResolveAsync();
|
||||
if (resolvedItem is not IContainer resolvedContainer) return;
|
||||
await ViewModel.UserCommandHandlerService.HandleCommandAsync(new OpenContainerCommand(new AbsolutePath(resolvedContainer)));
|
||||
await ViewModel.UserCommandHandlerService.HandleCommandAsync(
|
||||
new OpenContainerCommand(new AbsolutePath(resolvedContainer)));
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user