public EngineInstance ReplaceInLast(string title, MultiComponentFunction func) { EngineInstance target = null; lock (_Instances) { if (_Instances.Count > 0) { target = _Instances[_Instances.Count - 1]; } } if (target == null) { return(OpenInNew(title, func)); } target.ReplaceComponents(func); target.SetTitle(title); return(target); }