Timeline view animation

This commit is contained in:
2023-07-11 17:59:29 +02:00
parent b1898e1120
commit b11fd13913
4 changed files with 104 additions and 52 deletions

View File

@@ -16,6 +16,7 @@ public class ParallelCommands : IDisposable
public IObservable<IChangeSet<CommandTimeState>> Commands { get; } public IObservable<IChangeSet<CommandTimeState>> Commands { get; }
public BindedCollection<CommandTimeState> CommandsCollection { get; } public BindedCollection<CommandTimeState> CommandsCollection { get; }
public int CommandCount => _commands.Count;
public PointInTime? Result { get; private set; } public PointInTime? Result { get; private set; }

View File

@@ -114,6 +114,8 @@ public class CommandScheduler : ICommandScheduler
} }
private async void ExecutorOnCommandFinished(object? sender, ICommand command) private async void ExecutorOnCommandFinished(object? sender, ICommand command)
{
await RunWithLockAsync(async () =>
{ {
var firstCommandBlock = _commandsToRun var firstCommandBlock = _commandsToRun
.Items .Items
@@ -126,7 +128,15 @@ public class CommandScheduler : ICommandScheduler
if (state is null) return; if (state is null) return;
state.ExecutionState = ExecutionState.Finished; state.ExecutionState = ExecutionState.Finished;
if (firstCommandBlock is not null) await firstCommandBlock.RemoveCommand(command); if (firstCommandBlock is not null)
{
await firstCommandBlock.RemoveCommand(command);
if (firstCommandBlock.CommandCount == 0)
{
_commandsToRun.Remove(firstCommandBlock);
}
}
});
} }
private async Task RefreshCommands() private async Task RefreshCommands()

View File

@@ -25,8 +25,9 @@
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.--> <!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.0.0" /> <PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.0.0" />
<PackageReference Include="Avalonia.ReactiveUI" Version="11.0.0" /> <PackageReference Include="Avalonia.ReactiveUI" Version="11.0.0" />
<PackageReference Include="Avalonia.Svg.Skia" Version="11.0.0-rc1.1" /> <PackageReference Include="Avalonia.Svg.Skia" Version="11.0.0" />
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.0.0" /> <PackageReference Include="Avalonia.Themes.Fluent" Version="11.0.0" />
<PackageReference Include="Avalonia.Xaml.Behaviors" Version="11.0.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="7.0.0" /> <PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0" /> <PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0" />
<PackageReference Include="MvvmGen" Version="1.2.1" /> <PackageReference Include="MvvmGen" Version="1.2.1" />

View File

@@ -1,4 +1,4 @@
<Window <Window
Background="Transparent" Background="Transparent"
Closed="OnWindowClosed" Closed="OnWindowClosed"
ExtendClientAreaToDecorationsHint="True" ExtendClientAreaToDecorationsHint="True"
@@ -23,6 +23,8 @@
xmlns:config="using:FileTime.GuiApp.Configuration" xmlns:config="using:FileTime.GuiApp.Configuration"
xmlns:corevm="using:FileTime.App.Core.ViewModels" xmlns:corevm="using:FileTime.App.Core.ViewModels"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:i="clr-namespace:Avalonia.Xaml.Interactivity;assembly=Avalonia.Xaml.Interactivity"
xmlns:ia="clr-namespace:Avalonia.Xaml.Interactions.Core;assembly=Avalonia.Xaml.Interactions"
xmlns:interactions="using:FileTime.Core.Interactions" xmlns:interactions="using:FileTime.Core.Interactions"
xmlns:local="using:FileTime.GuiApp.Views" xmlns:local="using:FileTime.GuiApp.Views"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
@@ -258,8 +260,37 @@
Grid.Row="1" Grid.Row="1"
RowDefinitions="Auto,40,*,Auto"> RowDefinitions="Auto,40,*,Auto">
<Grid> <Grid x:Name="CommandGroupsContainer">
<ItemsControl ItemsSource="{Binding AppState.TimelineViewModel.ParallelCommandsGroups.Collection}"> <Grid.Transitions>
<Transitions>
<DoubleTransition Duration="0:0:.2" Property="Height" />
</Transitions>
</Grid.Transitions>
<i:Interaction.Behaviors>
<ia:DataTriggerBehavior
Binding="{Binding #CommandGroups.ItemCount}"
ComparisonCondition="GreaterThan"
Value="0">
<ia:ChangePropertyAction
PropertyName="Height"
TargetObject="CommandGroupsContainer"
Value="180" />
</ia:DataTriggerBehavior>
<ia:DataTriggerBehavior
Binding="{Binding #CommandGroups.ItemCount}"
ComparisonCondition="LessThanOrEqual"
Value="0">
<ia:ChangePropertyAction
PropertyName="Height"
TargetObject="CommandGroupsContainer"
Value="0" />
</ia:DataTriggerBehavior>
</i:Interaction.Behaviors>
<Grid ColumnDefinitions="Auto,10">
<ItemsControl
ItemsSource="{Binding AppState.TimelineViewModel.ParallelCommandsGroups.Collection}"
VerticalAlignment="Top"
x:Name="CommandGroups">
<ItemsControl.ItemsPanel> <ItemsControl.ItemsPanel>
<ItemsPanelTemplate> <ItemsPanelTemplate>
<StackPanel Orientation="Horizontal" /> <StackPanel Orientation="Horizontal" />
@@ -270,8 +301,8 @@
<Border <Border
Background="{DynamicResource ContainerBackgroundColor}" Background="{DynamicResource ContainerBackgroundColor}"
CornerRadius="10" CornerRadius="10"
Height="50"
Margin="0,0,10,0" Margin="0,0,10,0"
MaxHeight="200"
Padding="5"> Padding="5">
<ScrollViewer> <ScrollViewer>
<ItemsControl ItemsSource="{Binding Commands.Collection}"> <ItemsControl ItemsSource="{Binding Commands.Collection}">
@@ -298,6 +329,15 @@
</DataTemplate> </DataTemplate>
</ItemsControl.ItemTemplate> </ItemsControl.ItemTemplate>
</ItemsControl> </ItemsControl>
<Rectangle
Fill="{DynamicResource ContentSeparatorBrush}"
Grid.Column="1"
HorizontalAlignment="Center"
Margin="0,10,0,10"
VerticalAlignment="Stretch"
Width="1" />
</Grid>
</Grid> </Grid>
<ItemsControl Grid.Row="1" ItemsSource="{Binding AppState.Tabs}"> <ItemsControl Grid.Row="1" ItemsSource="{Binding AppState.Tabs}">