Using RunScript in c# component - GH canvas stalled

Hi there,

I need some help with using RhinoApp.RunScript in a c# component.

I am importing severall .dwgs from various windows folders as Blocks into Rhino

Code as following:

private void RunScript(DataTree<string> _files, bool _activate, ref object BlockName)
  {

DataTree<string> nameTree = new DataTree<string>();

if(_activate)
{
  for(int i = 0; i < _files.BranchCount; i++)
  {
    GH_Path path = new GH_Path(i);

    for(int j = 0; j < _files.Branches[i].Count; j++)
    {
      string importFileName = _files.Branches[i][j];
      var script = string.Format("_-Insert _File " + importFileName + " _Block _Enter 0 1 0", false);

      RhinoApp.RunScript(script, false);

      nameTree.Add(importFileName, path);
    }
  }
  BlockName = nameTree;

  return;
}
  }

It does the job as it should, but after the import of all files, the GH canvas stalls, means I can zoom in and out, but no more editing is possible.

Any thoughts?

AddOn:
I would like to do delete the imported BlockInstance right afterwards, cause I just need the Block to work with.

Thx, Udo

EDIT:
If I use the BooleanToggle, instead of the Button, it works !?!