private void RecreateBackAndMoreKeys() { voiceKeys[VoiceKeyCount - 1] = new VoiceKey { Text = Resources.BACK, KeyValue = KeyValues.BackFromKeyboardKey, }; if (remainingVoices.Any()) { voiceKeys[VoiceKeyCount - 2] = new VoiceKey { Text = Resources.MORE, KeyValue = KeyValues.MoreKey, }; } }
public Voice(Action backAction, List <string> voices) : base(backAction) { int displayedVoiceCount = (voices.Count < VoiceKeyCount) ? voices.Count // We have enough room to display keys for all the voices as well as a key for "Back". : VoiceKeyCount - 2; // Display as much as we can. Reserve a key for "More" in addition to "Back". remainingVoices = voices.Skip(displayedVoiceCount).ToList(); for (int i = 0; i < displayedVoiceCount; i++) { voiceKeys[i] = new VoiceKey { Text = voices[i], KeyValue = new KeyValue(FunctionKeys.SelectVoice, voices[i]), }; } RecreateBackAndMoreKeys(); }