예제 #1
0
        public void AddUser(string name)
        {
            bool userIsBanned = false;

            foreach (string user in BannedUsers)
            {
                if (name == user)
                {
                    userIsBanned = true;
                }
            }

            if (!userIsBanned)
            {
                UserAddedEventArgs args = new UserAddedEventArgs();
                args.Name = name;
                UserAdded(this, args);
                User newUser = new User();
                newUser.Name = name;
                Users.Add(newUser);
            }
            else
            {
                UserBannedEventArgs args = new UserBannedEventArgs();
                args.Name = name;
                UserBanned(this, args);
            }
        }
예제 #2
0
 static void UserBannedEmail(object sender, UserBannedEventArgs args)
 {
     Console.WriteLine($"Email: {args.Name} is banned, and is attempting to join the organization!");
 }
예제 #3
0
 static void UserBannedAlarm(object sender, UserBannedEventArgs args)
 {
     SystemSounds.Beep.Play();
 }