public void Clear()
        {
            // Clear text: as consequence this component's size will be changed and eventually we ask parent to update layout
            EntryMessage.SetEditorText("");

            // Clear attachment
            MessageInputAttachments.Clear();
        }
Esempio n. 2
0
        private void ProcessEntry(Message msg)
        {
            EntryMessage emsg = msg as EntryMessage;

            InfoLog.WriteInfo(string.Format(ProcessStringFormat, "Entry", msg.SenderId), EPrefix.ServerProcessInfo);
            switch ((ServerRoom)emsg.ServerRoom)
            {
            case ServerRoom.Chat:
                ProcessChatEntry(emsg);
                break;

            case ServerRoom.GameChoose:
                ProcessGameChooseEntry(emsg);
                break;
            }
        }
        public void StartEditionMode(String messageId, String messageBody)
        {
            // Store message Id
            editMessageId = messageId;

            ButtonUrgency.IsVisible = false;
            // Attachment is used to stop edition mode
            FrameBeforeButtonAttachment.IsVisible = true;
            ButtonAttachment.IsVisible            = true;
            ButtonAttachment.ImageSourceId        = "Font_Times|ColorButtonForeground";

            Color  backgroundColor = Helper.GetResourceDictionaryById <Color>("ColorConversationStreamMessageCurrentUserBackGround");;
            Color  textColor       = Helper.GetResourceDictionaryById <Color>("ColorConversationStreamMessageCurrentUserFont");
            String text            = Helper.SdkWrapper.GetLabel("edit");

            EntryMessage.SetEditorText(messageBody);

            SetContext(text, textColor, backgroundColor, true);
        }
        private void SetContext(String text, Color textColor, Color backgroundColor, Boolean setFocus)
        {
            if (String.IsNullOrEmpty(text))
            {
                StackLayoutUrgency.Padding = new Thickness(0);
            }
            else
            {
                StackLayoutUrgency.Padding = new Thickness(2);
            }

            LabelUrgency.Text            = text;
            LabelUrgency.TextColor       = textColor;
            FrameUrgency.BackgroundColor = backgroundColor;

            if (setFocus)
            {
                EntryMessage.SetFocus();
            }
        }
        public void StopEditionMode()
        {
            // Remove message Id
            editMessageId = null;

            ButtonUrgency.IsVisible = true;

            // Attachments are now available
            FrameBeforeButtonAttachment.IsVisible = capabilityFileSharing;
            ButtonAttachment.IsVisible            = capabilityFileSharing;
            ButtonAttachment.ImageSourceId        = "Font_PaperClip|ColorButtonForeground";

            Color  backgroundColor = Helper.GetResourceDictionaryById <Color>("ColorConversationStreamMessageOtherUserBackGround");
            Color  textColor       = Helper.GetResourceDictionaryById <Color>("ColorConversationStreamMessageOtherUserFont");
            String text            = "";

            EntryMessage.SetEditorText("");

            SetContext(text, textColor, backgroundColor, false);
        }
 public String GetMessageContent()
 {
     return(EntryMessage.GetEditorText());
 }
Esempio n. 7
0
        public async Task <ReplyMessage> ExecuteAsync(IConversationContext conversationContext, FormReplyMessage reply)
        {
            EntryMessage entry = null;

            for (var i = 0; i < reply.Properties.Count(); i++)
            {
                conversationContext.StateAction = StateAction.Keep;
                var property     = reply.Properties.ElementAt(i);
                var propertyName = property.PropertyName.ToLower();
                if (!conversationContext.Route.RouteData.ContainsKey(propertyName))
                {
                    var validationMessage = await this.CheckValid(conversationContext, reply, property);

                    if (validationMessage != null)
                    {
                        return(validationMessage);
                    }

                    //TODO: add confirmation propperty

                    if (conversationContext.Reply != null && conversationContext.Entry?.Message?.Message != null)
                    {
                        if (property.ReplyItem.Routes != null && property.ReplyItem.Routes.Any())
                        {
                            foreach (var router in this.routers)
                            {
                                var routeData = await router.FindRouteData(conversationContext.Entry.Message.Message.Text, property.ReplyItem.Routes);

                                if (routeData != null && routeData.ContainsKey(propertyName))
                                {
                                    conversationContext.Route.RouteData[propertyName] = routeData[propertyName];
                                }
                            }
                        }
                        else
                        {
                            conversationContext.Route.RouteData[propertyName] = conversationContext.Entry.Message.Message.Text;
                        }

                        entry = conversationContext.Entry.Message.Message;
                        conversationContext.Entry.Message.Message = null;
                        continue;
                    }

                    if (!await this.CheckActive(conversationContext, reply, property))
                    {
                        continue;
                    }

                    var createdReply = (await this.replyFactory.CreateReplyAsync(conversationContext, property.ReplyItem)).Message;
                    if (createdReply == null)
                    {
                        continue;
                    }

                    return(createdReply);
                }
            }

            conversationContext.Entry.Message.Message = entry;
            conversationContext.StateAction           = StateAction.Clear;
            return(await this.Complete(conversationContext, reply));
        }