Beispiel #1
0
 public void BeginSync(SyncThread behavior)
 {
     if (OnSyncStart != null)
         OnSyncStart(this, EventArgs.Empty);
     if (behavior == SyncThread.BackgroundThread)
     {
         bgThreadState = BackgroundThreadState.Running;
         worker.RunWorkerAsync();
     }
     else
     {
         List<ProductInfo> products = GetNewData();
         MergeNewData(products);
     }
 }
Beispiel #2
0
 public PMSubject(ISynchronizeInvoke syncInvoker)
 {
     InitializeComponent();
     this.syncInvoker = syncInvoker;
     bgThreadState = BackgroundThreadState.None;
 }
Beispiel #3
0
 private void MergeNewData(List<ProductInfo> products)
 {
     if (products != null && products.Count > 0)
     {
         if (OnNewData != null)
             OnNewData(this, new NewDataEventArgs(products));
     }
     bgThreadState = BackgroundThreadState.Stop;
     if (OnSyncCompleted != null)
         OnSyncCompleted(this, EventArgs.Empty);
 }