Пример #1
0
        private async void POEStash_OnStashUpdated(object sender, SnapShotEventArgs e)
        {
            //Save the last received snapshot ID
            LastReceivedSnapshotId = e.Snapshot.Id;

            TrainingCycleResult result;

            if (ContinuationEndpoint == null)
            {
                ContinuationEndpoint = Task.Run(() => PerformCycle(e.Snapshot));
                result = await ContinuationEndpoint;
            }
            else
            {
                //A task is already running, continue with the new task.
                ContinuationEndpoint = ContinuationEndpoint.ContinueWith((p) => PerformCycle(e.Snapshot));
                result = await ContinuationEndpoint;
            }

            //Check for aborted
            if (result == TrainingCycleResult.ABORTED)
            {
                return;
            }

            lastCycleResult = result;
        }
Пример #2
0
 public NetworkTrainer(ConversionTable table)
 {
     this.conversionTable     = table;
     this.lastCycleResult     = new TrainingCycleResult(SupportedItemTypes);
     POEStash.OnStashUpdated += POEStash_OnStashUpdated;
 }