public void RaiseItemExportedException(ImportItem item, Exception ee) { if (this.ItemExportException != null) { Application.Current.Dispatcher.BeginInvoke(new Action(() => { this.ItemExportException.Invoke(item, ee); })); } }
private void ExportItem(ImportItem item) { try { this.RegisterExportItem(item); this.TheManager.SyncExportItem(item); this.UnRegisterExportItem(item); } catch (Exception ee) { Trace.WriteLine("### Exception [" + ee.Message + "]; Source = " + ee.Source); Trace.WriteLine("###" + ee.StackTrace); this.ShowErrorInfo("Exception : " + ee.Message); this.Log.E(this, ee); } }
public void RaiseItemExportedEvent(ImportItem item) { if (this.ItemExportedEvent != null) this.ItemExportedEvent.Invoke(this, item); }
/// <summary> /// 在当前线程中直接进行数据采集操作。 /// </summary> public void SyncExportItem(ImportItem item) { item.ImportState = EImportStatus.Importing; item.SyncImportState2Remote(); item.WriteLine("Start to Export"); this.RaiseItemExportingEvent(item); item.DoExport(); this.RaiseItemExportedEvent(item); if (item.ImportState == EImportStatus.Interrupt) { item.WriteLine("Export Interrupt;"); } else if (item.ImportState == EImportStatus.Importing) { item.ImportState = EImportStatus.Imported; item.WriteLine("Export over;"); } item.WriteLine("TotalCount = " + item.TotalCount); item.WriteLine("ValidCount = " + item.ValidIndex); item.SyncImportState2Remote(); }
/// <summary> /// 开启子线程,进行数据的采集操作。 /// </summary> public void AsyncExportItem(ImportItem item) { new Thread(new ParameterizedThreadStart(this.OnImportThreadStart)).Start(item); }
public void SyncExportItem(DateTime targetDate, ImportItem item) { this.TargetDate = targetDate; this.SyncExportItem(item); }
private void RegisterExportItem(ImportItem item) { if (item == null) return; item.PropertyChanged += OnExportItemPropertyChanged; }
/// <summary> /// 结束进度条。 /// </summary> private void OnItemEndExporting(object sender, ImportItem item) { if (this.PBBar != null) this.PBBar.Close(); }
/// <summary> /// 显示进度条。 /// </summary> private void OnItemStartExporting(object sender, ImportItem item) { if (this.PBBar == null) { this.PBBar = new MyProgressBar(); } this.PBBar.Show(item.TotalCount); }