Beispiel #1
0
                public override BaseChatDataItem CreateDataItem(ChatMessage message)
                {
                    ChatTextMessage textMessage = message as ChatTextMessage;

                    if (textMessage != null)
                    {
                        return(new TextMessageDataItem(textMessage));
                    }
                    ChatMediaMessage mediaMessage = message as ChatMediaMessage;

                    if (mediaMessage != null)
                    {
                        return(new MediaMessageDataItem(mediaMessage));
                    }
                    ChatCardMessage cardMessage = message as ChatCardMessage;

                    if (cardMessage != null)
                    {
                        return(new CardMessageDataItem(cardMessage));
                    }
                    ChatCarouselMessage carouselMessage = message as ChatCarouselMessage;

                    if (carouselMessage != null)
                    {
                        return(new CarouselMessageDataItem(carouselMessage));
                    }
                    return(base.CreateDataItem(message));
                }
Beispiel #2
0
        private void AddBotMsg()
        {
            if ((_stageId == WorkFlowStage.CAR.ItemId &&
                 ((_auditCheck.Settings.IsApplicable.HasValue && _auditCheck.Settings.IsApplicable.Value) ||
                  (_auditCheck.Settings.IsSatisfactory.HasValue && _auditCheck.Settings.IsSatisfactory.Value))) ||
                _stageId == WorkFlowStage.Closed.ItemId || _stageId == WorkFlowStage.CAP.ItemId)
            {
                return;
            }


            if (_stageId > WorkFlowStage.View.ItemId && _stageId < WorkFlowStage.RCA.ItemId)
            {
                var actions = new List <ChatCardAction>
                {
                    new ChatCardAction("Accept")
                };
                var imageCard = new ChatImageCardDataItem(null, "", "", $"Move to next stage({WorkFlowStage.GetItemById(_stageId + 1).FullName})?", actions, null);
                var message   = new ChatCardMessage(imageCard, _author1, DateTime.Now);
                radChat2.AddMessage(message);
            }
            else if (_stageId >= WorkFlowStage.RCA.ItemId && _stageId < WorkFlowStage.Closed.ItemId)
            {
                var actions = new List <ChatCardAction>
                {
                    new ChatCardAction("Accept"),
                    new ChatCardAction("Reject")
                };
                var imageCard = new ChatImageCardDataItem(null, "", "", $"Move to next stage({WorkFlowStage.GetItemById(_stageId + 1).FullName}) press Accept. " +
                                                          $"Move to previous stage({WorkFlowStage.GetItemById(_stageId - 1).FullName}) press Reject. ", actions, null);
                var message = new ChatCardMessage(imageCard, _author1, DateTime.Now);
                radChat2.AddMessage(message);
            }
        }
Beispiel #3
0
        public virtual BaseChatDataItem CreateDataItem(ChatMessage message)
        {
            ChatTextMessage message1 = message as ChatTextMessage;

            if (message1 != null)
            {
                return((BaseChatDataItem) new TextMessageDataItem(message1));
            }
            ChatMediaMessage message2 = message as ChatMediaMessage;

            if (message2 != null)
            {
                return((BaseChatDataItem) new MediaMessageDataItem(message2));
            }
            ChatCardMessage message3 = message as ChatCardMessage;

            if (message3 != null)
            {
                return((BaseChatDataItem) new CardMessageDataItem(message3));
            }
            ChatCarouselMessage message4 = message as ChatCarouselMessage;

            if (message4 != null)
            {
                return((BaseChatDataItem) new CarouselMessageDataItem(message4));
            }
            return((BaseChatDataItem)null);
        }
Beispiel #4
0
            public void ChatWeatherCardElement(RadChat radchat)
            {
                ChatWeatherCardDataItem weatherCard = new ChatWeatherCardDataItem("Florence", Image3.ToImage(), "33°C", "Humidity: 76%", "Dew: 31°C",
                                                                                  "Pressure: 1031 mb", "Wind Speed: 15 km/h NW");

                Author          author  = new Author(adminImg3.ToImage(), "Nancy");
                ChatCardMessage message = new ChatCardMessage(weatherCard, author, DateTime.Now);

                radchat.AddMessage(message);
            }
Beispiel #5
0
            public void ChatProductCardElement(RadChat radchat)
            {
                ChatProductCardDataItem productCard = new ChatProductCardDataItem(Image2.ToImage(), "Arrive & Drive", "Rating 7/10",
                                                                                  "With our Arrive & Drive Packages, the only thing you will have to think about is driving. We make it simple for you to get more of what you love. We streamline the " +
                                                                                  "entire process and have everything ready for you when you arrive at the track so you can get straight to racing.", "Packages from $340", null, null);

                Author          author  = new Author(adminImg2.ToImage(), "Ben");
                ChatCardMessage message = new ChatCardMessage(productCard, author, DateTime.Now);

                radchat.AddMessage(message);
            }
Beispiel #6
0
            /// <summary>
            /// Add a ChatImageCardElement programmatically
            /// </summary>
            /// <param name="radchat">RadChat Control To Populate</param>
            public void ChatImageCardElement(RadChat radchat)
            {
                Telerik.WinControls.UI.ChatImageCardDataItem imageCard = new ChatImageCardDataItem(Image1.ToImage(), "Benjamin Vilanders", "Senior Architect",
                                                                                                   "As a Senior Architect his experience in the industry allows him to take on increased responsibility. Like other architects, he design buildings " +
                                                                                                   "and makes sure they are structurally sound. Due to his track record of quality performance, Benjamin also serves as a manager, a mentor, an advisor and coordinator.",
                                                                                                   null, null);

                Author          author  = new Author(adminImg2.ToImage(), "Ben");
                ChatCardMessage message = new ChatCardMessage(imageCard, author, DateTime.Now);

                radchat.AddMessage(message);
            }
Beispiel #7
0
            public void ChatFlightCardElement(RadChat radchat)
            {
                List <FlightInfo> flights = new List <FlightInfo>();

                flights.Add(new FlightInfo("Los Angelis", "LAX", DateTime.Now.AddDays(7), "New York", "JFK", DateTime.Now.AddDays(7).AddHours(5.5)));
                flights.Add(new FlightInfo("New York", "JFK", DateTime.Now.AddDays(14).AddHours(3), "Los Angelis", "LAX", DateTime.Now.AddDays(14).AddHours(9.1)));
                ChatFlightCardDataItem flightCard = new ChatFlightCardDataItem("Andrew Fuller", flights, Image4.ToImage(), "$341", null);

                Author          author  = new Author(adminImg3.ToImage(), "Nancy");
                ChatCardMessage message = new ChatCardMessage(flightCard, author, DateTime.Now);

                radchat.AddMessage(message);
            }
 public CardMessageDataItem(ChatCardMessage message)
     : base((ChatMessage)message)
 {
     this.message = message;
 }
        public void AddMessageHistory()
        {
            var me = Util.Instance.CurrentUser.Email;

            foreach (var item in AllMessage)
            {
                if (item.ImageMessageDriveID != "")
                {
                    var image        = GoogleDriveFilesRepository.DownloadFile(item.ImageMessageDriveID);
                    var displayImage = ResizeImagePercentage(Image.FromStream(image));
                    if (item.Sender == me)
                    {
                        ChatMediaMessage message = new ChatMediaMessage(displayImage, displayImage.Size, null, authorMe, item.TimeSend);
                        _rcChatlog.AddMessage(message);
                    }
                    else
                    {
                        ChatMediaMessage message = new ChatMediaMessage(displayImage, displayImage.Size, null, authorFriend, item.TimeSend);
                        _rcChatlog.AddMessage(message);
                    }
                }
                else if (item.Message != "")
                {
                    if (item.Sender == me)
                    {
                        ChatTextMessage message = new ChatTextMessage(item.Message, authorMe, item.TimeSend);
                        _rcChatlog.AddMessage(message);
                    }
                    else
                    {
                        ChatTextMessage message = new ChatTextMessage(item.Message, authorFriend, item.TimeSend);
                        _rcChatlog.AddMessage(message);
                    }
                }
                else if (item.Call != null)
                {
                    var tittle = "";
                    if (item.Call.Called)
                    {
                        tittle = "Cuộc gọi";
                    }
                    else
                    {
                        tittle = "Cuộc gọi nhỡ";
                    }
                    List <ChatCardAction> actions = new List <ChatCardAction>();
                    actions.Add(new ChatCardAction("Call"));
                    if (item.Sender == me)
                    {
                        ChatImageCardDataItem card    = new ChatImageCardDataItem(null, tittle, "bạn & " + authorFriend.Name, TimeSpan.FromSeconds(item.Call.Duration).ToString(@"mm\:ss"), actions, item.Receiver);
                        ChatCardMessage       message = new ChatCardMessage(card, authorMe, item.TimeSend);
                        _rcChatlog.AddMessage(message);
                    }
                    else
                    {
                        ChatImageCardDataItem card    = new ChatImageCardDataItem(null, tittle, "bạn & " + authorFriend.Name, TimeSpan.FromSeconds(item.Call.Duration).ToString(@"mm\:ss"), actions, item.Sender);
                        ChatCardMessage       message = new ChatCardMessage(card, authorFriend, item.TimeSend);
                        _rcChatlog.AddMessage(message);
                    }
                }
            }
        }