public void Recompile()
{
if (_compiling)
{
return;
}
_host.Reset();
Commands.Clear();
_script = null;
_compiling = true;
Send("Compiling...");
ThreadPool.QueueUserWorkItem(a =>
{
try
{
var type = Compile();
if (type == null)
{
return;
}
Send("Done!");
SafeInvoke(() =>
{
_script = (IScript)Activator.CreateInstance(type);
_script.Initialize(_host);
});
}
finally
{
_compiling = false;
}
});
}