I want to write a function like so,
public System.Windows.Input.Key ResolveKey(char charToResolve)
{
// Code goes here, that resolves the charToResolve
// in to the Key enumerated value
// (For example with '.' as the character for Key.OemPeriod)
}
I know I can write a huge Switch-case to match the character, but is there any other way?
The thing with this is the Key enum's string may not match with the character so Enum.IsDefined will not work
Any ideas?
Update: This is in Windows environment
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…