/// <summary> /// Notify if roulette set is odd /// </summary> /// <param name="sender">Calling member</param> /// <param name="e">Transferred parameters</param> protected virtual void OnNewRouletteOddSet(object sender, RouletteSetEventArgs e) { if (NewRouletteOddSet != null) { NewRouletteOddSet.Invoke(sender, e); } }
/// <summary> /// Spin roulette! /// </summary> public void Spin() { int value = _rand.Next(1, 37); Color color = (Color)_rand.Next(0, 2); DateTime dateTime = DateTime.Now; RouletteSetEventArgs args = new RouletteSetEventArgs(color, value, dateTime); if (value % 2 == 0) { OnNewRouletteEvenSet(this, args); } else { OnNewRouletteOddSet(this, args); } if (color == Color.Red) { OnNewRouletteRedSet(this, args); } else { OnNewRouletteBlackSet(this, args); } try { _streamWriter.WriteLine(args.ToString()); } catch (Exception e) { throw e; } }