Skip to content

Instantly share code, notes, and snippets.

@brunoss brunoss/testaRadios.cs
Last active May 19, 2016

Embed
What would you like to do?
public static class Parse{
public static int? ParseInt(this string num){
int val;
if (int.TryParse(num, out val)) {
return val;
}
return null;
}
}
_Igual.Tag = (Func<bool>)() => _TextValPalite.Text.Parse() == _ValSorteado.Text.Parse();
_Maior.Tag = (Func<bool>)() => _TextValPalite.Text.Parse() > _ValSorteado.Text.Parse();
_Menor.Tag = (Func<bool>)() => _TextValPalite.Text.Parse() < _ValSorteado.Text.Parse();
var radios = new[]{_Igual, _Maior, _Menor};
for(int i = 0; i < radios.Length; ++i){
if(radios[i].Checked){
var testa = radios[i].Tag as Func<bool>;
if(testa()){
_adicionar++;
_Acerto.Text = Convert.ToString(_adicionar);
}else{
_retirar++;
_Errou.Text = Convert.ToString(_retirar);
}
break;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.