void LoadProfile() { if (File.Exists(Constants.userProfile)) { Profile = Message.FromJson(File.ReadAllText(Constants.userProfile)) as ChatUser; NewlyCreatedUser = false; } else { Guid chatID = Guid.NewGuid(); //BitmapImage img = new BitmapImage(new Uri(constants.profilePhoto)); //JpegBitmapEncoder jbe = new JpegBitmapEncoder(); //JpegBitmapEncoder. Profile = new ChatUser() { Sender = chatID, Kind = MessageKindType.USER, Name = "Name", LastName = "LastName", ProfilePicture = new ChatImageContent() { Format = ImageKindType.JPG, RawFile = new ChatFileContent() { Content = File.ReadAllBytes(Constants.profilePhoto), Compression = CompressionKindType.UNCOMPRESSED, } }, StringContent = "Hello everybody I present myself!!", }; File.WriteAllText(Constants.userProfile, Profile.ToJson()); } }
private void HelloMessage(ChatUser cu = null) { if (cu != null) { UserProfile.Destination = cu.Sender; } SignedMessage signedUserProfileMessage = new SignedMessage(UserProfile.ToJson()); userModule.SendMessage <string>(signedUserProfileMessage.ToJson(), messageModule.Id.ToString()); }