Last active
April 7, 2020 10:47
-
-
Save mrtank/d14a354f4835502267a1ba347b34842a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
while (!quit) | |
{ | |
var uiThreadScheduler = TaskScheduler.FromCurrentSynchronizationContext(); | |
Task<decimal> backgroundTask = Task.Run (() => { | |
var lastPrice = (decimal)NTClient.MarketData(inst, 0); | |
Interlocked.Increment(ref this.theCounter); | |
return lastPrice; | |
}; | |
backgroundTask.ContinueWith((t) => { | |
<handle t.IsFaulter> | |
textBoxLastPrice.Text = t.Result.ToString(); | |
tbBoundaryPrice.Text = boundaryPrice.ToString(); | |
investmentTypeBox.Text = investmentType; | |
positionSizeBox.Text = positionCounter.ToString(); | |
tbsboundaryPrice.Text = sboundaryPrice.ToString(); | |
debugBox.Text = theCounter.ToString(); | |
}, uiThreadScheduler); | |
Run4(NTClient); // same logic in there. | |
Run5(NTClient); // same logic in there. | |
}//while.... end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment