Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
CompositeViewAnimation.cs
1using System;
3using System.Threading;
4using System.Threading.Tasks;
5using Microsoft.Maui.Controls;
6
8{
13 {
14 private readonly IReadOnlyList<IViewAnimation> children;
15 private readonly AnimationCompositionMode mode;
16
22 public CompositeViewAnimation(AnimationCompositionMode Mode, IReadOnlyList<IViewAnimation> Children)
23 {
24 this.mode = Mode;
25 this.children = Children ?? throw new ArgumentNullException(nameof(Children));
26 }
27
29 public async Task RunAsync(VisualElement Target, IAnimationContext Context, AnimationOptions? Options, CancellationToken Token)
30 {
31 ArgumentNullException.ThrowIfNull(Target);
32 ArgumentNullException.ThrowIfNull(Context);
33
34 if (this.children.Count == 0)
35 return;
36
37 if (this.mode == AnimationCompositionMode.Parallel)
38 {
39 List<Task> Tasks = new List<Task>(this.children.Count);
40 foreach (IViewAnimation Child in this.children)
41 {
42 Task Execution = Child.RunAsync(Target, Context, Options, Token);
43 Tasks.Add(Execution);
44 }
45 await Task.WhenAll(Tasks).ConfigureAwait(false);
46 }
47 else
48 {
49 foreach (IViewAnimation Child in this.children)
50 {
51 await Child.RunAsync(Target, Context, Options, Token).ConfigureAwait(false);
52 }
53 }
54 }
55 }
56}
Options applied for an individual animation execution.
Represents an animation composed of child animations.
async Task RunAsync(VisualElement Target, IAnimationContext Context, AnimationOptions? Options, CancellationToken Token)
Executes the animation against the specified target. Task tracking execution.
CompositeViewAnimation(AnimationCompositionMode Mode, IReadOnlyList< IViewAnimation > Children)
Initializes a new instance of the CompositeViewAnimation class.
Represents contextual information required when executing an animation.
Defines a view-based animation executor.
Task RunAsync(VisualElement Target, IAnimationContext Context, AnimationOptions? Options, CancellationToken Token)
Executes the animation against the specified target.
AnimationCompositionMode
Defines how composite animations should execute child animations.