public void CallRetweet(Service service, string id, Action successCallback, Action failureCallback) { var request = new RestRequest("{service}/{verb}.json", Method.POST); request.AddUrlSegment("service", service.Name); request.AddUrlSegment("verb", "retweet"); request.AddParameter("access_token", this.AccessToken); request.AddParameter("id", id); this.client.ExecuteAsync(request, (response) => { if (response.ResponseStatus == ResponseStatus.Completed && response.StatusCode == HttpStatusCode.OK) { System.Diagnostics.Debug.WriteLine(response.Content); successCallback(); } else { System.Diagnostics.Debug.WriteLine("Failure: " + response.ResponseStatus); failureCallback(); } }); }
public void Deauth(Service service, Action onComplete) { // Show authentication MessageBox.Show("This will disable this service.", service.DisplayName, MessageBoxButton.OK); this.RefreshServices = true; var client = new RestClient(service.Url); client.ExecuteAsync(new RestRequest(), (resp) => { onComplete(); }); }
public void Authenticate(Service service, Action onComplete) { // Show authentication var res = MessageBox.Show("You need to sign in to use this service.", service.DisplayName, MessageBoxButton.OK); if (res == MessageBoxResult.OK) { this.RefreshServices = true; if (this.AuthenticationRequired != null) { this.AuthenticationRequired(service.Url); } else { var webBrowserTask = new WebBrowserTask { Uri = new Uri(service.Url) }; webBrowserTask.Show(); } } }