public void OnGuessReceived(GuessReceivedEventArgs args) { if (GuessReceived != null) { //don't pass 'this' as the sender otherwise //the event cannot be delivered. Every part of //the event must be serializable, including the sender. GuessReceived(null, args); } }
private void guessReceived1_Invoked(object sender, ExternalDataEventArgs e) { GuessReceivedEventArgs eventArgs = e as GuessReceivedEventArgs; if (eventArgs != null) { if (eventArgs.NextGuess < _theNumber) { Message = "Try a higher number."; } else if (eventArgs.NextGuess > _theNumber) { Message = "Try a lower number."; } else { Message = String.Format( "Congratulations! You correctly guessed {0}.", _theNumber); IsComplete = true; } } }