Exemplo n.º 1
0
 /// <summary>
 /// Called by the host application to raise the
 /// GuessReceived event
 /// </summary>
 /// <param name="args"></param>
 public void OnGuessReceived(GuessReceivedEventArgs args)
 {
     if (GuessReceived != null)
     {
         //must pass null as the sender otherwise
         //the correct workflow won't receive the event.
         GuessReceived(null, args);
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// The event was received
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        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;
                }
            }
        }