예제 #1
0
        async void IMSession_UserJoined(object sender, UserEventArgs e)
        {

            var imSession = (IMSession)sender;

            using (ConsoleExt.WithColor(eventColor))
                Console.WriteLine("{0} joined an IM session", e.User.Nickname ?? e.User.LoginName);

            Message message = new Message();

            MessageFormatter mf = new MessageFormatter();
            mf.Color = Color.Purple;
            mf.Bold = true;
            mf.ApplyFormat(message);

            message.Body = UTF8Encoding.UTF8.GetBytes(String.Format("Hey, you joined {0}", e.User.LoginName ?? e.User.Nickname));

            await imSession.SendMessageAsync(message);
        }
예제 #2
0
 void IMSession_UserParted(object sender, UserEventArgs e)
 {
     using (ConsoleExt.WithColor(eventColor))
         Console.WriteLine("{0} left an IM session", e.User.Nickname ?? e.User.LoginName);
 }