There is a method
private void Generate(int xMax, int yMax, int categoryCount, int elementCount) { elementList = generator.GenerateSample( new Interval(0, xMax), new Interval(0, yMax), categoryCount, elementCount ); ElementsGenerated(); } With its usual execution:
Generate(xMax, yMax, categoryCount, elementCount); , the program runs ~ 8,9770973 with
Using:
await Task.Factory.StartNew(() => Generate(xMax, yMax, categoryCount, elementCount)); runtime goes as much as ~ 42,6324051 s
I need exactly the second method, because the progress bar is updated and the information labels on the label are displayed, and in the first case only the progress bar changes are visible, the inscriptions do not change, and the whole window is also inactive.
StopWatcheach of the pieces in synchronous and asynchronous modes. How do you update the progress bar and label? Provide more code, for example, the relevant part of the procedure callingawait. - VladDIObservable, and let the UI code cluster it as it wants. - VladDIObservable. The UI will subscribe to it via [Distinct(value / maxValue * pixelWidth)] (msdn.microsoft.com/en-us/library/hh211630.aspx), and then the VM does not have to worry about the presence of a UI at all. - VladD