private void Compile(string source)
{
ThreadContext.Properties[Config.LogKey] = _logValue;
ThreadedDownloadTable.LogValue = _logValue;
DoInvoke(new Action(() =>
{
messagesTextBox.Clear();
statusLabel.Text = "Running...";
//var highlightingStrategy = textEditorControl1.Document.HighlightingStrategy as DefaultHighlightingStrategy;
//highlightingStrategy.SetColorFor("Selection", _executionHighlight);
}));
var compiler = new Compiler(source);
var generatedAssembly = compiler.ToAssembly();
if (compiler.Errors.Any())
ListErrors(compiler.Errors.Select(x => x.Message).ToArray());
if (!compiler.Errors.Any())
{
_runable = new Runable(generatedAssembly);
_runable.Select += OnSelectResults;
_runable.Progress += OnProgress;
_runable.Highlight += OnHighlight;
try
{
_runable.Run();
}
catch (ThreadAbortException)
{
Log.Info("Program aborted");
}
catch (Exception e)
{
Log.Fatal("Unexpected Exception", e);
}
}
ProgramFinished();
}