トップ通知アニメーションを作成していますが、アニメーションが終了するまでアニメーションを同期させる方法がわかりません。ここに私が持っているコードです:Windowsの電話アニメーションのコードブロックが終了するまで他のスレッドを無効にする方法
public Storyboard prepareShowStory(int count, NotificationControl notifyControl)
{
notifyControl.textBlock1.Text = "Got" + count.ToString() + "Message";
notifyControl.RenderTransform = new CompositeTransform();
Storyboard story = new Storyboard();
//From here until the annimation finish and remove LayoutRoot.Resources.Clear();
LayoutRoot.Resources.Add("unique_id", story);
story.Completed += (object sender, EventArgs e) =>
{
story.Stop();
story.Children.Clear();
App.ViewModel.myAction -= CompletedRefresh;
LayoutRoot.Resources.Clear();
//To here.
};
story.Begin();
DoubleAnimation animation;
animation = new DoubleAnimation();
animation.AutoReverse = true;
animation.From = -64;
animation.To = 60;
animation.Duration = new Duration(TimeSpan.FromMilliseconds(1600));
animation.EasingFunction = _EasingFunction;
Storyboard.SetTargetName(animation, notifyControl.Name);
Storyboard.SetTargetProperty(animation, new PropertyPath("(UIElement.RenderTransform).(CompositeTransform.TranslateY)"));
story.Children.Add(animation);
return story;
}
「story.begin」の終了後に「story」を返すことを意味しますか? – keyboardP
LayoutRoot.Resources.Clear()をクリアしたい。アニメーションが終了したとき、そうでなければ、別のスレッドがLayoutRoot.Resources.Add( "unique_id"、story)に来たとき。 agianが、仕上げが完了していない場合、システムはエラー「2回追加」を報告します。 –