public static BaseTeamFoundationServer Create(ServerType serverType, BaseServerInfo serverInfo, ServerAuthentication auth, bool isPasswordSavedInXml) { if (serverType == ServerType.TFS) { return new TeamFoundationServer(serverInfo.Uri, serverInfo.Name, auth.Domain, auth.UserName, auth.Password, isPasswordSavedInXml); } else { var vsServerInfo = (VisualStudioServerInfo)serverInfo; return new VisualStudioOnlineTFS(vsServerInfo.Uri, vsServerInfo.Name, vsServerInfo.TFSUserName, auth.AuthUser, auth.Password, isPasswordSavedInXml); } }