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))); }