예제 #1
0
        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>);
            }
        }
예제 #2
0
 public void Apply()
 {
     if (CurrentLayout is ProgramLayoutViewModel)
     {
         var layout = CurrentLayout as ProgramLayoutViewModel;
         WindowManager.ApplyLayout(layout.AssociatedObject);
     }
     else if (CurrentLayout is IconLayoutViewModel)
     {
         var layout = CurrentLayout as IconLayoutViewModel;
         IconManagerWrapper.ApplyLayout(layout.AssociatedObject);
     }
     else
     {
         throw new Exception();
     }
 }