private void OnKeyPressed(object sender, KeyPressedEventArgs args) { if (SuppressShortcuts) { return; } logger.Trace("Detected shortcut [{0} - {1}]", args.Modifier, args.GetWpfKey()); var layout = Layouts.SingleOrDefault(l => l.Shortcut.Match(args.Modifier, args.GetWpfKey())); if (layout == null) { return; } logger.Trace("Apply layout {0} [{1} - {2}]", layout.Name, layout.Shortcut, layout.GetType()); if (layout is Layout <Program> ) { WindowManager.ApplyLayout(layout as Layout <Program>); } if (layout is Layout <Icon> ) { IconManagerWrapper.ApplyLayout(layout as Layout <Icon>); } }