async private void friendDecline(object sender, EventArgs e)
        {
            var button = sender as Button;

            Models.FriendsCredentials item = new Models.FriendsCredentials();

            foreach (Models.FriendsCredentials i in requests.ItemsSource)
            {
                if (button.CommandParameter == i.username)
                {
                    item = i;
                }
            }

            var result = await DisplayAlert("Message", "Do you want to report this person for spam?", "Yes", "No");

            if (result)
            {
                //Voeg het spamalert toe
                try
                {
                    string              webadres   = "http://good-lookz.com/API/friends/friendReportSpam.php?";
                    string              parameters = "friend_id=" + item.id;
                    HttpClient          connect    = new HttpClient();
                    HttpResponseMessage get        = await connect.GetAsync(webadres + parameters);

                    get.EnsureSuccessStatusCode();

                    string resultspam = await get.Content.ReadAsStringAsync();
                }
                catch (Exception)
                {
                    throw;
                }
            }

            //Verwijder het verzoek alsnog
            string url_accepted = "http://www.good-lookz.com/API/friends/friendsAcceptReq.php";

            var values = new Dictionary <string, string>
            {
                { "accepted", "false" },
                { "friends_id", item.friends_id }
            };

            var content     = new FormUrlEncodedContent(values);
            var responseDel = await client.PostAsync(url_accepted, content);

            var responseString = await responseDel.Content.ReadAsStringAsync();

            var postMethod = JsonConvert.DeserializeObject <List <accepted> >(responseString);

            foreach (var items in _gets.ToList())
            {
                if (items.friends_id == item.friends_id)
                {
                    _gets.Remove(items);
                }
            }
        }
Example #2
0
        async void FriendsList_Tapped(object sender, ItemTappedEventArgs e)
        {
            Models.FriendsCredentials item = (Models.FriendsCredentials)e.Item;

            Models.SelectedFriendsCredentials.id         = item.id;
            Models.SelectedFriendsCredentials.fullName   = item.fullName;
            Models.SelectedFriendsCredentials.friends_id = item.friends_id;

            await Navigation.PushAsync(new WardrobeFriendSelected(), true);
        }
        void FriendsList_Tapped(object sender, ItemTappedEventArgs e)
        {
            Models.FriendsCredentials item = (Models.FriendsCredentials)e.Item;

            Models.SelectedFriendsCredentials.id          = item.id;
            Models.SelectedFriendsCredentials.picture     = item.picture;
            Models.SelectedFriendsCredentials.username    = item.username;
            Models.SelectedFriendsCredentials.description = item.description;
            Models.SelectedFriendsCredentials.fullName    = item.fullName;
            Models.SelectedFriendsCredentials.friends_id  = item.friends_id;

            Navigation.PushAsync(new FriendsPages.FriendsProfilePage(), true);
        }
        async private void friendAccept(object sender, EventArgs e)
        {
            var button = sender as Button;

            Models.FriendsCredentials item = new Models.FriendsCredentials();

            foreach (Models.FriendsCredentials i in requests.ItemsSource)
            {
                if (button.CommandParameter == i.username)
                {
                    item = i;
                }
            }

            string url_accepted = "http://www.good-lookz.com/API/friends/friendsAcceptReq.php";
            var    friends_id   = item.friends_id;

            var values = new Dictionary <string, string>
            {
                { "accepted", "true" },
                { "friends_id", friends_id }
            };

            var content  = new FormUrlEncodedContent(values);
            var response = await client.PostAsync(url_accepted, content);

            var responseString = await response.Content.ReadAsStringAsync();

            var postMethod = JsonConvert.DeserializeObject <List <accepted> >(responseString);

            foreach (var items in _gets.ToList())
            {
                if (items.friends_id == friends_id)
                {
                    _gets.Remove(items);
                }
            }
        }