コード例 #1
0
        public async void UsuallyLoadAsync()
        {
            Messages = new ObservableCollection <Message>();
            List <Message> chatMessagesClient = MessagesContainer.GetMessages();

            foreach (var message in chatMessagesClient)
            {
                if (message.IsItMe && message.SenderName != Name)
                {
                    message.SenderName = Name;
                }
                message.DateSend = Day.GetParsedDate(message.DateSend);
                Messages.Add(message);
            }

            if (Messages.Count > 0)
            {
                await Task.Run(() => _serverWorker.GetMessages(Messages[Messages.Count - 1].Id, "New messages"));
            }
        }