private void syncSecurityInfoFromSSE() { isRunning = true; syncSecurityInfoFromSSETask = Task.Factory.StartNew(() => { try { SecurityService securityService = new SecurityService(); securityService.SyncSecuritiesFromSSE(); SecurityDayQuotationService dayQuotationService = new SecurityDayQuotationService(); dayQuotationService.SyncSSEDayQuotationFromWangYI(); } catch (OperationCanceledException) { CancelTokenSingleton.GetInstance().BuildNewToken(); } catch (Exception ex) { this.Invoke(new Action <string, string>(ShowMessage), ex.Message, "Error"); } finally { isRunning = false; this.Invoke(new Action <string, string>(ShowMessage), "采集停止", ""); } }, CancelTokenSingleton.GetInstance().Token, TaskCreationOptions.LongRunning, TaskScheduler.Default); }
public void SyncSecurityDayQutationFromWangYI() { try { SecurityDayQuotationService service = new SecurityDayQuotationService(); service.SyncSSEDayQuotationFromWangYI(); } catch (Exception ex) { Assert.IsTrue(1 == 0, ex.Message); } }