void UserProfileReceived(object sender, UserProfileEventArgs e) { List <ChatNode> nodesToAdd = new List <ChatNode>() { new ChatNode("User Profile received for ", CssClasses.UserProfileReceivedNotification), new ChatNode(e.Profile.UserName, CssClasses.UsernameOther) }; foreach (UserProfileKey key in e.Profile) { nodesToAdd.Add(ChatNode.NewLine); nodesToAdd.Add(new ChatNode(string.Concat(key.ToString(), ":"), CssClasses.UserProfileKey)); if (key.Equals(UserProfileKey.TotalTimeLogged)) { int totalSeconds; if (int.TryParse(e.Profile[key], out totalSeconds)) { TimeSpan ts = TimeSpan.FromSeconds(totalSeconds); nodesToAdd.Add(new ChatNode(string.Format("{0} day{4}, {1} hour{5}, {2} minute{6}, {3} second{7}.", (int)ts.TotalDays, ts.Hours, ts.Minutes, ts.Seconds, ((int)ts.TotalDays == 1) ? string.Empty : "s", ts.Hours == 1 ? string.Empty : "s", ts.Minutes == 1 ? string.Empty : "s", ts.Seconds == 1 ? string.Empty : "s"), CssClasses.UserProfileValue)); } else { nodesToAdd.Add(new ChatNode(e.Profile[key], CssClasses.UserProfileValue)); } } else { nodesToAdd.Add(new ChatNode(e.Profile[key], CssClasses.UserProfileValue)); } } chat.AddChat(nodesToAdd); }
void Client_UserProfileReceived(object sender, UserProfileEventArgs e) { if (__userProfileReceived != null) { __userProfileReceived.Call(_host.ClientHost, ConvObj(e)); } }