public static async Task <JObject> Create_Group(List <User> users, string name, Local_Group.GroupTypes type) { var serverAddress = new Uri("http://192.168.1.7:15006/api/auth/CreateGroup"); Local_Group requestObject = new Local_Group() { Title = name, Users = users, GroupType = type }; var body = JsonConvert.SerializeObject(requestObject); using (var httpClient = new HttpClient()) { var request = new HttpRequestMessage(); request.Headers.Accept.TryParseAdd("application/json"); request.Method = HttpMethod.Post; request.RequestUri = serverAddress; request.Content = new StringContent(body); var response = await httpClient.SendAsync(request); var responseAsString = await response.Content.ReadAsStringAsync(); var parsed = JObject.Parse(responseAsString); return(parsed); } }
//opens group chat private async void GroupList_MouseDoubleClick(object sender, MouseButtonEventArgs e) { string id; Local_Group model = ((sender as ListView).SelectedItems[0]) as Local_Group; id = model.GroupId; await Dispatcher.BeginInvoke(new Action(() => { Chats.Items.Add(new TabItem() { Content = new Frame() { Content = new ChatPage(username, id, url) }, Header = model.Title }); })); }