Example #1
0
        private async void WriteMessageInChat()
        {
            var saveChats = await _connectionManager.SavedChats(UserId);

            var getUserToWrite = await _connectionManager.GetUserInfoAsync(new UsersInfoModel { Id = PatientIdToWrite });

            if (saveChats.SavedPrivateChats == null)
            {
                saveChats.SavedPrivateChats = new List <PrivateChat>();
            }

            saveChats.SavedPrivateChats.Add(
                new PrivateChat()
            {
                Id            = Guid.NewGuid(),
                Name          = getUserToWrite.FullName,
                Messages      = new ObservableCollection <ChatMessage>(),
                UserIdToWrite = Guid.Parse(PatientIdToWrite),
                OwnUserId     = Guid.Parse(UserId)
            });

            var chatPage = new ChatPage(saveChats, getUserToWrite);

            chatPage.Show();
        }
        private async void WriteMessageInChat()
        {
            try
            {
                var saveChats = await _connectionManager.SavedChats(UserId);

                var chatPage = new ChatPage(saveChats, null);
                chatPage.Show();
            }
            catch (Exception)
            { return; }
        }