private void instantiateClient(String cUserName, String cClientURL, String cURL, String cScriptFile) { var args = cUserName + " " + cClientURL + " " + cURL + " " + cScriptFile; var creationResult = serviceCreator.createClientInstance(args); logs.Text += (creationResult + "\n"); IClient c = (IClient)Activator.GetObject( typeof(IClient), cClientURL ); clients.TryGetValue(cUserName, out IClient clientInstance); if (clientInstance != null) { appendMessage("Client " + cUserName + " already exists, replacing by new instance"); clients[cUserName] = clientInstance; return; } else { clients.Add(cUserName, c); } }