Benglin/Dynamo — pull request #152 by marimano (2014-10-29 09:11:23+00:00)
Title: Correct determining of end of computations

1) DynamoWebServer needs to know when all computations are done and only after that send ComputationResponse to Flood;
2) For correct work in headless mode it needs to do all computations (even if they are related to graphical data) in model part of Dynamo rather than view one.

Old scheme was next:
1) Receive `RunCancelCommand`;
2) Execute `RunCancelCommand`: try add `UpdateGraphAsyncTask` to the scheduler
3) send `ComputationResponse` to Flood

"2)" can't guarantee that all proper computations are done in time - it just add task to the scheduler or not if nothing was changed after previous running.
In another thread after `UpdateGraphAsyncTask` is completed it triggers `OnEvaluationCompleted` event, and `VisualizationManager` is subscribed on it. `VisualizationManager` computes render packages (add `UpdateRenderPackageAsyncTask`s to scheduler for all graphical nodes), then puts them together and sends to View to draw. `VisualizationManager` belongs to view part of Dynamo, so render packages will never be computed in headless mode.

Current scheme is next:
1) Receive `RunCancelCommand`;
2) Execute `RunCancelCommand`: try add `UpdateGraphAsyncTask` to the scheduler
3) Wait for run completes (1 - if there was no Run (`UpdateGraphAsyncTask` wasn't added to scheduler) it triggers `FullRunCompleted` event with info about no run; 2 - if `UpdateGraphAsyncTask` was added it adds `NotifyRenderDataReadyAsyncTask` right after adding `UpdateRenderPackageAsyncTask`s and it will trigger `FullRunCompleted` with info that run executed)
4) send `ComputationResponse` to Flood if run executed