public static async void LikeInsta(InstaSharp.Models.Media selectedPost) { if (selectedPost != null) { var authInfo = new OAuth(_config); var authResponse = new InstaSharp.Models.Responses.OAuthResponse(); var response = await _user.GetSelf(); authResponse.AccessToken = Access; authResponse.User = response.Data; var likes = new Likes(_config, authResponse); if (selectedPost.UserHasLiked == true) { await likes.Delete(selectedPost.Id); selectedPost.UserHasLiked = false; await _metroWindow.ShowMessageAsync("Instagram", "Cofnięto Like'a!"); } else { await likes.Post(selectedPost.Id); selectedPost.UserHasLiked = true; await _metroWindow.ShowMessageAsync("Instagram", "Dodano Like'a!"); } } else { await _metroWindow.ShowMessageAsync("", "Nie wybrano posta"); } }
public static async void Comment(InstaSharp.Models.Media selectedPost, string comentText) { if (selectedPost != null) { var authInfo = new OAuth(_config); var thing = new InstaSharp.Models.Responses.OAuthResponse(); var response = await _user.GetSelf(); thing.AccessToken = Access; thing.User = response.Data; var comments = new Comments(_config, thing); await comments.Post(selectedPost.Id, comentText); await _metroWindow.ShowMessageAsync("Instagram", "Opublikowano komentarz!"); } else { await _metroWindow.ShowMessageAsync("", "Nie wybrano posta"); } }