public async Task <ChadderMessage> SendMessage(string txt, ChadderConversation conversation) { var msg = ChadderMessage.Create(conversation, db.LocalUser, ChadderMessage.MESSAGE_TYPE.TEXT); msg.Body = txt; await db.AddMessage(msg, conversation); AddPendingMessage(msg); return(msg); }
public async void SendPicture(byte[] data, ChadderConversation conversation) { var record = new ChadderSQLPicture() { ToBeUploaded = true, Bin = data, PictureId = Guid.NewGuid().ToString()// Temporary }; await sqlDB.InsertAsync(record); var picture = await db.LoadPicture(record, true); var msg = ChadderMessage.Create(conversation, db.LocalUser, ChadderMessage.MESSAGE_TYPE.PICTURE); msg.PictureId = record.PictureId; msg.Picture = picture; await db.AddMessage(msg, conversation); AddPendingMessage(msg); }