У меня есть следующее в C #:
public static void StartAnimation(UIElement animatableElement, DependencyProperty dependencyProperty, double toValue, double animationDurationSeconds, EventHandler completedEvent)
{
double fromValue = (double)animatableElement.GetValue(dependencyProperty);
DoubleAnimation animation = new DoubleAnimation();
animation.From = fromValue;
animation.To = toValue;
animation.Duration = TimeSpan.FromSeconds(animationDurationSeconds);
//// HERE ----------------------------------------------------
animation.Completed += delegate(object sender, EventArgs e)
{
//
// When the animation has completed bake final value of the animation
// into the property.
//
animatableElement.SetValue(dependencyProperty,
animatableElement.GetValue(dependencyProperty));
CancelAnimation(animatableElement, dependencyProperty);
if (completedEvent != null)
{
completedEvent(sender, e);
}
};
У меня есть некоторые проблемы для преобразования анонимного метода в VB.NET.
Мой вариант будет
AddHandler animation.Completed,
Function(sender As Object, e As EventArgs) As Boolean
' '
' When the animation has completed bake final value of the animation '
' into the property. '
'
animatableElement.SetValue(dependencyProperty, animatableElement.GetValue(dependencyProperty))
CancelAnimation(animatableElement, dependencyProperty)
completedEvent(sender, e)
Return True
End Function
Я добавил Function As Boolean
, потому что без возвращаемого типа это не функция, а создание "Sub", я не знаю, как ...
Несколько советов?