private void StartParallelCompile() { if (!CodeChanged) { return; } string text = CodeEditor.Text; var ctxStruct = new ParallelCompilationState { CodeText = text, Sync = SynchronizationContext.Current }; ThreadPool.QueueUserWorkItem(s => PerformParallelCompile((ParallelCompilationState)s), ctxStruct); }
private void PerformParallelCompile(ParallelCompilationState s) { ParallelCompilationDoneState state = new ParallelCompilationDoneState(); try { Code code = DiagramParserHelper.ParseCode(s.CodeText); state.CodeObject = code; } catch (Exception exc) { state.Error = exc; } s.Sync.Post(s_ => FinishParallelCompilation((ParallelCompilationDoneState)s_), state); }