public void BroadCastNotification(int toNumber, OperatorNotification opNotif) { if (NewNotif != null) { NewNotif.Invoke(toNumber, opNotif); } }
public void HandleNotification(int toNumber, OperatorNotification opNotif) { // Authorization can be much more complicated if (toNumber != Number) { return; } OperatorMessage[] MyAttributes = (OperatorMessage[])Attribute.GetCustomAttributes(opNotif.GetType(), typeof(OperatorMessage)); switch (MyAttributes[0].Type) { case OperatorMessage.msgType.Info: { // Do nothing break; } case OperatorMessage.msgType.Warn: { ConsoleColor old = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine(String.Format("Account with number {0} received the following notification: {1}", toNumber, opNotif.Message)); Console.ForegroundColor = old; break; } } }