public static TethysAvatar GetAvatar(MemberSession session, AvatarSize size) { return(new TethysAvatar { Id = session.Id, DisplayName = session.To.DisplayName, Background = AvatarHelper.GetColorBrush(session.To.DisplayName), DisplayNamePinyin = session.To.DisplayNamePinyin, Name = session.To.Name, Source = GetAvatarBitmap(session.To.Avatar, size, FromType.User) }); }
public static void SetAvatar(Message message) { message.From.TethysAvatar = new TethysAvatar { DisplayName = message.From.DisplayName, Source = AvatarHelper.GetAvatarBitmap(message.From.Avatar, AvatarSize.X80, message.From.Type) }; if (message.From.Avatar != "default.png" && Path.GetExtension(message.From.Avatar).ToLower() == ".png") { message.From.TethysAvatar.Background = new SolidColorBrush(Colors.White); } else { message.From.TethysAvatar.Background = AvatarHelper.GetColorBrush(message.From.DisplayName); } }