Timeline view animation
This commit is contained in:
@@ -16,6 +16,7 @@ public class ParallelCommands : IDisposable
|
||||
public IObservable<IChangeSet<CommandTimeState>> Commands { get; }
|
||||
|
||||
public BindedCollection<CommandTimeState> CommandsCollection { get; }
|
||||
public int CommandCount => _commands.Count;
|
||||
|
||||
public PointInTime? Result { get; private set; }
|
||||
|
||||
|
||||
@@ -114,6 +114,8 @@ public class CommandScheduler : ICommandScheduler
|
||||
}
|
||||
|
||||
private async void ExecutorOnCommandFinished(object? sender, ICommand command)
|
||||
{
|
||||
await RunWithLockAsync(async () =>
|
||||
{
|
||||
var firstCommandBlock = _commandsToRun
|
||||
.Items
|
||||
@@ -126,7 +128,15 @@ public class CommandScheduler : ICommandScheduler
|
||||
if (state is null) return;
|
||||
|
||||
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()
|
||||
|
||||
@@ -25,8 +25,9 @@
|
||||
<!--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 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.Xaml.Behaviors" Version="11.0.0.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0" />
|
||||
<PackageReference Include="MvvmGen" Version="1.2.1" />
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<Window
|
||||
<Window
|
||||
Background="Transparent"
|
||||
Closed="OnWindowClosed"
|
||||
ExtendClientAreaToDecorationsHint="True"
|
||||
@@ -23,6 +23,8 @@
|
||||
xmlns:config="using:FileTime.GuiApp.Configuration"
|
||||
xmlns:corevm="using:FileTime.App.Core.ViewModels"
|
||||
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:local="using:FileTime.GuiApp.Views"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
@@ -258,8 +260,37 @@
|
||||
Grid.Row="1"
|
||||
RowDefinitions="Auto,40,*,Auto">
|
||||
|
||||
<Grid>
|
||||
<ItemsControl ItemsSource="{Binding AppState.TimelineViewModel.ParallelCommandsGroups.Collection}">
|
||||
<Grid x:Name="CommandGroupsContainer">
|
||||
<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>
|
||||
<ItemsPanelTemplate>
|
||||
<StackPanel Orientation="Horizontal" />
|
||||
@@ -270,8 +301,8 @@
|
||||
<Border
|
||||
Background="{DynamicResource ContainerBackgroundColor}"
|
||||
CornerRadius="10"
|
||||
Height="50"
|
||||
Margin="0,0,10,0"
|
||||
MaxHeight="200"
|
||||
Padding="5">
|
||||
<ScrollViewer>
|
||||
<ItemsControl ItemsSource="{Binding Commands.Collection}">
|
||||
@@ -298,6 +329,15 @@
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
|
||||
<Rectangle
|
||||
Fill="{DynamicResource ContentSeparatorBrush}"
|
||||
Grid.Column="1"
|
||||
HorizontalAlignment="Center"
|
||||
Margin="0,10,0,10"
|
||||
VerticalAlignment="Stretch"
|
||||
Width="1" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
<ItemsControl Grid.Row="1" ItemsSource="{Binding AppState.Tabs}">
|
||||
|
||||
Reference in New Issue
Block a user