public void Abort() { if (asyncHandle != null) { asyncHandle.Abort(); } }
public void Abort() { try { _handle.Abort(); } catch (Exception) { } }
public void Stop() { m_Running = false; ClearTexture(); if (m_Handle != null) { m_Handle.Abort(); } }
private void SynchronizedCancel() { if (!Cancelled) { Cancelled = true; if (_killSwitch != null) { _killSwitch.Abort(); } } }
private void SynchronizedCancel() { if (!Cancelled) { Cancelled = true; if (_killSwitch != null) { System.Console.WriteLine("FLIPPING KILL SWITCH RIGHT MEOW."); _killSwitch.Abort(); System.Console.WriteLine("FLIPPED."); } } }
private void HttpGetResponse(IRestResponse resp, RestRequestAsyncHandle handle) { if (resp.StatusCode == HttpStatusCode.OK) { DocParser doc = new DocParser(); var sinfo = doc.GetStackInfo(resp.Content); if (sinfo != null) { stock = new Stock() { Num = Sno, Info = sinfo }; IsSuccess = true; } } handle.Abort(); }
public static async Task <IRestResponse <T> > ExecuteTaskAsync <T>(this RestClient client, IRestRequest request, CancellationToken token) { if (request == null) { throw new ArgumentNullException("request"); } TaskCompletionSource <IRestResponse <T> > taskCompletionSource = new TaskCompletionSource <IRestResponse <T> >(); try { RestRequestAsyncHandle async = client.ExecuteAsync <T>( request, (response, _) => { if (token.IsCancellationRequested) { taskCompletionSource.TrySetCanceled(); } // Don't run TrySetException, since we should set Error properties and swallow exceptions // to be consistent with sync methods else { taskCompletionSource.TrySetResult(response); } }); CancellationTokenRegistration registration = token.Register(() => { async.Abort(); taskCompletionSource.TrySetCanceled(); }); taskCompletionSource.Task.ContinueWith(t => registration.Dispose(), token); } catch (Exception ex) { taskCompletionSource.TrySetException(ex); } return(await taskCompletionSource.Task); }
/// <summary> /// 重新读取数据 /// </summary> private void LoadDnsRecord() { if (null == mTenCloudDns) { return; } //如果有未完成的请求, 先中止 AsyncHandle?.Abort(); AsyncHandle = mTenCloudDns.queryRecordList <DnsRecordResult>(null, null, response => { Dispatcher.Invoke(() => { //更新表格数据 if (null != response.Data.data) { DnsRecordList = response.Data.data.records; DnsRecordDataGrid.ItemsSource = DnsRecordList; } }); }); }
public void OnNavigatedFrom(NavigationContext navigationContext) { _serverUpdateActionHandle?.Abort(); }
private void Button_Click(object sender, RoutedEventArgs e) { _asyncHandle.Abort(); }
public void Abort() { handle.Abort(); }
private void HandleFailure(Action <Error> onFailure, RestRequestAsyncHandle handle, Error error) { handle.Abort(); CleanUp(); onFailure(error); }