private PoolVariable GetMatch(List <PoolVariable> list, PoolVariable target) { foreach (PoolVariable pv in list) { if (pv.Name == target.Name) { return(pv); } } return(null); }
private void UpdateApplicationManagerPoolVarList(int poolNumber) { List <Pool> poolStatuses = ApplicationManager.Current.PoolStatuses; int x = poolNumber - 1; // index adjustment List <PoolVariable> updatedList = new List <PoolVariable>(); // if x == 0, do pool1; if x == 1, do pool2. foreach (PoolVariable pv in (x == 0 ? pool1VarNames : pool2VarNames)) { PoolVariable match = GetMatch(poolStatuses[x].PoolVars, pv); if (match != null) // pv is in AppearanceManager PoolStatuses list { updatedList.Add(new PoolVariable(match.Name, match.Value)); } else // pv is not in AppearanceManager PoolStatuses list { updatedList.Add(new PoolVariable(pv.Name)); } } poolStatuses[x].PoolVars = updatedList; // poolStatuses[x] = new Pool(poolStatuses[x].PoolName, updatedList); }