Exemple #1
0
 void DoButtonPressed(Location location, ButtonEvent buttonEvent)
 {
     using (_drawingEngine.PauseDrawing())
         if (_globalContext.DeviceHooks.Values.All(h => !h.OnKeyEventHook(location, buttonEvent, _layout, _layoutContext)))
         {
             _layout?.ButtonPressed(location, buttonEvent);
         }
 }
Exemple #2
0
        public DeviceManager(GlobalContext globalContext, IDevice device)
        {
            _globalContext = globalContext;
            _globalContext.LayoutRemoved += OnLayoutRemoved;

            _layouts        = new Stack <ILayout>();
            _pressedButtons = new LazyDictionary <Location, ITimerToken>();

            device.ButtonEvent += DeviceOnKeyEvent;

            device.Init();
            _drawingEngine = new DrawingEngine(device, _globalContext.Options.Theme, globalContext.Services.ModulesService.GetModules <IVisualTransitionFactory>().First());
            _layoutContext = new LayoutContext(device, globalContext, SetLayout, () => SetPreviousLayout(), () => _drawingEngine.PauseDrawing(), GetAvailableLayouts);
        }