我有一個處理多個影片的代碼。我想等到或知道多個影片是否完成。我目前正在使用await Task.Delay(1000);并將其設定為其中一個影片的最大持續時間。
這是我背后的 C# 代碼:
new Animation()
{
{ 0, 1, new Animation(a => dialogControl.FadeTo(1, 1000)) },
{ 0, 1, new Animation(a => dialogControl.ScaleTo(1, 1000)) },
}.Commit(this, "Animation1");
await Task.Delay(1000);
Debug.WriteLine("Do some task after multiple animations are completed");
無論如何它會等到所有影片完成然后才繼續?
uj5u.com熱心網友回復:
await Task.WhenAll(
dialogControl.FadeTo(1, 1000),
dialogControl.ScaleTo(1, 1000)
);
Debug.WriteLine("Do some task after multiple animations are completed");
uj5u.com熱心網友回復:
來自Commit上的檔案
public void Commit (Xamarin.Forms.IAnimatable owner,
string name, uint rate = 16, uint length = 250,
Xamarin.Forms.Easing easing = default,
Action<double,bool> finished = default,
Func<bool> repeat = default);
完成的
Action<Double,Boolean>影片完成時呼叫的動作。
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/456547.html
標籤:C# xml xamarin xamarin.forms
