public EncryptionLegend(int maxWidth, int count, int x, int y) { elements = new List <EncryptionLegendElement>(); currentX = x; currentY = y; startX = x; this.maxWidth = maxWidth; this.count = count; foreach (KeyValuePair <int, char> pair in EncryptionTest.GetLegend()) { EncryptionLegendElement element = new EncryptionLegendElement(pair.Key.ToString(), pair.Value.ToString(), currentX, currentY); elements.Add(element); currentX += EncryptionTestElement.WIDTH; if (currentX > maxWidth + startX) { currentX = startX; currentY += EncryptionTestElement.HEIGHT + 20; } } }
public void AcceptAnswers() { var legend = EncryptionTest.GetLegend(); foreach (EncryptionTestElement element in elements) { EncryptionTest.answersCount += legend[element.GetInfo()] == element.GetValue() ? 1 : 0; } }