async Task CreateButton(ConversationModelType type, string id) { if (type != ConversationModelType.Profile) { listHeaderHeight.HeightRequest = 50; conversationInfo.IsVisible = true; if (type == ConversationModelType.Event) { Event eve = await _dataManager.EventApiManager.GetEventById(id); conversationInfoImage.Source = eve.ImageSource; conversationInfoModelLabel.Text = eve.Title; } else if (type == ConversationModelType.Group) { Group grp = await _dataManager.GroupApiManager.GetGroup(id); conversationInfoImage.Source = grp.ImageSource; conversationInfoModelLabel.Text = grp.Name; } } }
public async Task<List<Conversation>> GetConversations(string modelId, ConversationModelType modelType) { List<Conversation> conversations = new List<Conversation>(); string uri = App.serverUri + "message/conversation/"; if (modelType != ConversationModelType.Profile) uri += modelId + "?modelType=" + modelType; else uri += "getAll"; try { var response = await httpClient.GetAsync(new Uri(uri)); if (response.IsSuccessStatusCode) { var recievedContent = await response.Content.ReadAsStringAsync(); return conversations = JsonConvert.DeserializeObject<List<Conversation>>(recievedContent); } } catch (Exception ex) { await App.coreView.displayAlertMessage("Connection Error", "Trouble Connecting To Server", "OK"); System.Diagnostics.Debug.WriteLine(@" ERROR {0}", ex.Message); await App.coreView.displayAlertMessage("Connection Error", "Trouble Connecting To Server", "OK"); } return null; }
public YourConversations(ConversationModelType type, string id, int clt) { InitializeComponent(); _dataManager = new DataManager(); modelType = type; modelId = id; conversationListType = clt; UpdateConversations(true); updateList.ItemSelected += OnListItemSelected; updateList.Refreshing += async (sender, e) => { await UpdateConversations(true); }; if (conversationListType != 2) { CreateButton(type, id); } else { createNewConversation.IsVisible = false; } createNewConversation.Clicked += (sender, e) => { App.coreView.setContentViewWithQueue(new InviteListView(new Conversation() { ModelId = modelId, ModelType = modelType }, true)); }; }
public async Task<Conversation> CreateConversations(ConversationModelType modelType, List<Profile> profiles, string modelTypeId, string title) { var uri = "?modelType="+modelType; for (int i = 0; i < profiles.Count; i++) { uri += "&profileIds=" + profiles[i].ProfileId; } if (!string.IsNullOrWhiteSpace(modelTypeId) && modelType != ConversationModelType.Profile) uri += "&modelTypeId=" + modelTypeId; if (!string.IsNullOrWhiteSpace(title)) uri += "&title=" + title; try { var response = await httpClient.PostAsync(new Uri(App.serverUri + "message/conversation" + uri), new StringContent("")); if (response.IsSuccessStatusCode) { var recievedContent = await response.Content.ReadAsStringAsync(); return JsonConvert.DeserializeObject<Conversation>(recievedContent); } else { await App.coreView.displayAlertMessage("Connection Error", "Trouble Connecting To Server", "OK"); } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(@" ERROR {0}", ex.Message); } return null; }
void addWallElement(View element, string Title, string conversationID, ConversationModelType conversationtype) { Grid grid = new Grid() { RowSpacing = 0, BackgroundColor = Color.White }; element.BackgroundColor = App.HowlOutBackground; grid.RowDefinitions.Add(new RowDefinition { Height = 1 }); grid.RowDefinitions.Add(new RowDefinition { Height = 40 }); grid.RowDefinitions.Add(new RowDefinition { Height = 1 }); grid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto }); grid.Children.Add(new Line(), 0, 0); StackLayout sl = new StackLayout() { Orientation = StackOrientation.Horizontal }; sl.Children.Add(new Label() { Text = " " + Title + " ", VerticalTextAlignment = TextAlignment.Center, TranslationY = 5, HorizontalOptions = LayoutOptions.StartAndExpand }); Button b = new Button() { TextColor = App.HowlOut, Text = "View conversations ", HorizontalOptions = LayoutOptions.EndAndExpand, VerticalOptions = LayoutOptions.EndAndExpand }; b.Clicked += (sender, e) => { App.coreView.setContentViewWithQueue(new YourConversations(conversationtype, conversationID, 0)); }; sl.Children.Add(b); grid.Children.Add(sl, 0, 1); grid.Children.Add(new Line(), 0, 2); grid.Children.Add(element, 0, 3); infoLayout.IsVisible = true; infoLayout.Children.Add(grid); }
public async Task setConversationSeen(string modelId, ConversationModelType mType) { NotificationModelType modelType = NotificationModelType.ProfileConversation; if (mType == ConversationModelType.Event) modelType = NotificationModelType.EventConversation; if (mType == ConversationModelType.Group) modelType = NotificationModelType.GroupConversation; List<Notification> notiToRemove = new List<Notification>();; foreach (Notification n in App.coreView.notifications.unseenNotifications) { System.Diagnostics.Debug.WriteLine(n.ModelId + ", " + n.ModelType); if (((n.SecondModelId == modelId && modelType != NotificationModelType.ProfileConversation) || (n.ModelId == modelId && modelType == NotificationModelType.ProfileConversation)) && !n.Seen && n.ModelType == modelType) { n.Seen = true; notiToRemove.Add(n); await MessageApiManager.SetNotificationSeen(n.InAppNotificationId); } } foreach (Notification n in notiToRemove) App.coreView.notifications.unseenNotifications.Remove(n); //await App.coreView.notifications.UpdateNotifications(false); await App.coreView.profileConversatios.UpdateConversations(false); await App.coreView.otherConversatios.UpdateConversations(false); }
public bool chechIfConversationUnseen(ConversationModelType cType, string cId) { NotificationModelType modelType = NotificationModelType.ProfileConversation; if(cType == ConversationModelType.Event ) modelType = NotificationModelType.EventConversation; if (cType == ConversationModelType.Group) modelType = NotificationModelType.GroupConversation; foreach (Notification n in App.coreView.notifications.unseenNotifications) { if (modelType == NotificationModelType.ProfileConversation) { if (n.ModelId == cId && !n.Seen && n.ModelType == modelType) { return true; } } else { if (n.SecondModelId == cId && !n.Seen && n.ModelType == modelType) { return true; } } } return false; }