本文整理汇总了C#中Command.?.Execute方法的典型用法代码示例。如果您正苦于以下问题:C# Command.?.Execute方法的具体用法?C# Command.?.Execute怎么用?C# Command.?.Execute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Command
的用法示例。
在下文中一共展示了Command.?.Execute方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AnimateWithAction
public static void AnimateWithAction(this Label label, Command command = null, ScaleType type = ScaleType.After)
{
var tapGesture = new TapGestureRecognizer ();
tapGesture.Tapped += async (sender, args) => {
switch (type) {
case ScaleType.First:
command?.Execute (null);
await label.ScaleTo (0.75, 100, Easing.CubicOut);
await label.ScaleTo (1, 100, Easing.CubicIn);
break;
case ScaleType.Midle:
await label.ScaleTo (0.75, 100, Easing.CubicOut);
command?.Execute (null);
await label.ScaleTo (1, 100, Easing.CubicIn);
break;
case ScaleType.After:
await label.ScaleTo (0.75, 100, Easing.CubicOut);
await label.ScaleTo (1, 100, Easing.CubicIn);
command?.Execute (null);
break;
default:
break;
}
};
label.GestureRecognizers.Add (tapGesture);
}
示例2: AnimateAsyncWithAction
public static Task AnimateAsyncWithAction(this Button button, Command command = null)
{
button.Clicked += async (sender, args) => {
await button.ScaleTo (0.75, 50, Easing.CubicOut);
await button.ScaleTo (1, 50, Easing.CubicIn);
command?.Execute (null);
};
return Task.FromResult (Type.Missing);
}