Beispiel #1
0
        private void Load(UnsentMessageModel model)
        {
            if (model != null)
            {
                Model = new KeyValuePair <string, MessageModel>(null, model.ConvertToMessageModel());

                if (!string.IsNullOrEmpty(model.Sticker))
                {
                    MessageEmojiContainer.Children.Add(new MessageStickerControl(model.Sticker));
                }
                else
                {
                    if (model.Images != null)
                    {
                        foreach (MessageUploadFileModel file in model.Images)
                        {
                            this.MessageImagesContainer.Children.Add(new MessageImageControl(file));
                        }
                    }

                    if (model.Files != null)
                    {
                        foreach (MessageUploadFileModel file in model.Files)
                        {
                            this.MessageFilesContainer.Children.Add(new MessageFileControl(file));
                        }
                    }

                    if (!string.IsNullOrEmpty(model.Text))
                    {
                        MessageTextContainer.Child = new TextBox()
                        {
                            Text = Model.Value.Text
                        };
                    }
                }
            }
        }
Beispiel #2
0
        public static async Task <string> SendMessageToConversationAsync(UnsentMessageModel model)
        {
            if (model != null)
            {
                var rsp = await Client.PushAsync("Conversations/" + model.ConversationID + "/Messages", model.ConvertToMessageModel());

                if (rsp.StatusCode == System.Net.HttpStatusCode.OK)
                {
                    Changed(model.ConversationID);
                    return(rsp.Result.name);
                }
            }

            return(null);
        }