private Key GetKeyFromListboxValue() { if (KeysByGroupListbox.SelectedIndex < 0) { return(new Key()); } // Need to know the scanCode and extended of the chosen key. string keyName = KeysByGroupListbox.Text; int hash; if (currentgroupmembers.ContainsKey(keyName)) { hash = currentgroupmembers[keyName]; } else { // As this is a lookup on an internal list we really should know what they are. return(new Key()); } return(new Key(KeyHasher.GetScanCodeFromHash(hash), KeyHasher.GetExtendedFromHash(hash))); }