-1
我这个代码:如何在单击按钮时调用方法并传递参数?
correctButton.Clicked += (sender, e) =>
{
App.DB.IncrementScore(AS.cfs, AS.phrase);
correctAns++;
AS.pointsCount[(int)AS.cfs]++;
scoreCountLabel.Text = FontAwesome.FAStop.Repeat(correctAns);
Device.StartTimer(TimeSpan.FromSeconds(0.5),() =>
{
switch (AS.cardOrder)
{
case CardOrder.FirstToLast:
AS.orderPhraseIndex++;
AS.phraseIndexList.Add(AS.orderPhraseIndex);
getPhraseFirstToLast();
break;
case CardOrder.Random:
getRandomNumber();
getRandomPhrase();
break;
}
return false;
});
};
我想动议的运行成一个方法的代码,并传递参数也。但是如何在单击correctButton时调用该方法?
使一个方法'空隙的MyMethod(对象发件人,EventArgs的)'并将其附加事件:'correctButton.Clicked + =的MyMethod;' – ASh
有https://msdn.microsoft.com/en的读-us/library/0s21cwxk.aspx。 – mjwills