/// <summary> /// Resolves the service. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="provider">The provider.</param> /// <returns>T.</returns> public static List <T> ResolveService <T>(this string[] provider) where T : class, IParameter { if (provider == null) { return(new List <T>()); } return(ParameterLine.Parse <T>(provider)); }
public PersonalityResultsPage(Layout layout, string[] results, string[] types, string[] flipRating) { // Fix layout this.layout = new Layout(layout); int startX = this.layout.startX; int startY = this.layout.startY; this.layout.startX -= (startX / 2); this.layout.elementWidth += (startX / 3); this.layout.startY -= (startY / 2); this.layout.elementHeight += (startY / 3); int nO = 0, nC = 0, nE = 0, nA = 0, nN = 0; for (int i = 0; i < results.Length; i++) { int val; if (!Int32.TryParse(results[i], out val)) { continue; } if (flipRating[i] == "y") { val = 4 - val; } switch (types[i]) { case "O": case "o": o += val; nO++; break; case "C": case "c": c += val; nC++; break; case "E": case "e": e += val; nE++; break; case "A": case "a": a += val; nA++; break; case "N": case "n": n += val; nN++; break; } } o /= nO; c /= nC; e /= nE; a /= nA; n /= nN; int y = 0; lines = new ParameterLine[5]; lines[0] = new ParameterLine(this.layout, y++, loO, hiO, o); lines[1] = new ParameterLine(this.layout, y++, loC, hiC, c); lines[2] = new ParameterLine(this.layout, y++, loE, hiE, e); lines[3] = new ParameterLine(this.layout, y++, loA, hiA, a); lines[4] = new ParameterLine(this.layout, y++, loN, hiN, n); }