public static Keys Convert (swi.Key key, swi.ModifierKeys modifier) { Keys ret = Find(key); if (modifier.HasFlag (swi.ModifierKeys.Alt)) ret |= Keys.Alt; if (modifier.HasFlag (swi.ModifierKeys.Control)) ret |= Keys.Control; if (modifier.HasFlag (swi.ModifierKeys.Shift)) ret |= Keys.Shift; if (modifier.HasFlag (swi.ModifierKeys.Windows)) ret |= Keys.Application; return ret; }
public static Key Convert (swi.Key key, swi.ModifierKeys modifier) { var keys = key.ToString () .Split (new[] { ", " }, StringSplitOptions.None) .Select (v => (swi.Key)Enum.Parse (typeof (swi.Key), v)); Key ret = Key.None; foreach (var val in keys) { ret |= Find (val); } if (modifier.HasFlag (swi.ModifierKeys.Alt)) ret |= Key.Alt; if (modifier.HasFlag (swi.ModifierKeys.Control)) ret |= Key.Control; if (modifier.HasFlag (swi.ModifierKeys.Shift)) ret |= Key.Shift; if (modifier.HasFlag (swi.ModifierKeys.Windows)) ret |= Key.Application; return ret; }