TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
parmendra kumar
NA
113
5k
How to receive photo to all device in chat app
Mar 28 2018 4:27 AM
I am working a chat application and when I upload a image with button click then image doesn't received to another device only sender device showing it.
MyButton click code:
public
async
void
Image_Clicked(
object
sender, EventArgs e)
{
try
{
file = await CrossMedia.Current.PickPhotoAsync(
new
Plugin.Media.Abstractions.PickMediaOptions
{
CompressionQuality = 50, PhotoSize = Plugin.Media.Abstractions.PhotoSize.Medium });
FileName = file.Path;
FileName = FileName.Substring(FileName.LastIndexOf(
"/"
) + 1);
var content =
new
MultipartFormDataContent();
//IFolder rootFolder = await FileSystem.Current.GetFolderFromPathAsync(FileName);
//var filee = await rootFolder.GetFileAsync(filename2);
//Stream stream = await filee.OpenAsync(FileAccess.Read);
content.Add(
new
StreamContent(file.GetStream()),
"\"file\""
, $
"\"{file.Path}\""
);
byteData = Model.Convert.ToByteArray(FileName);
var im = ImageSource.FromStream(
this
.file.GetStream);
using
(var memoryStream =
new
MemoryStream())
{
activityIndicator.IsRunning =
true
;
file.GetStream().CopyTo(memoryStream);
file.Dispose();
//
return
memoryStream.ToArray();
uploadedFilename = await AzureStorage.UploadFileAsync(ContainerType.Image,
new
MemoryStream(memoryStream.ToArray()));
}
if
(!
string
.IsNullOrWhiteSpace(uploadedFilename))
{
var imageData = await AzureStorage.GetFileAsync(ContainerType.Image, uploadedFilename);
var img = ImageSource.FromStream(() =>
new
MemoryStream(imageData));
TextContainer.Add(
new
MessageText { imgsource = img });
activityIndicator.IsRunning =
false
;
}
}
catch
( Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex);
}
}
Reply
Answers (
1
)
Unable to Bind server side data if I have bind list locally.
Unable to deploy my android app in xamarin