Пример #1
0
        public Desktop()
        {
            windowToBody      = new Dictionary <Window, Body>();
            contactJoints     = new Dictionary <int, FixedHingeJoint>();
            engine            = new PhysicsEngine();
            engine.BroadPhase = new SweepAndPruneDetector();
            engine.Solver     = new SequentialImpulsesSolver();
            timer             = new PhysicsTimer(PhysicsTimerCallback, 0.01);
            timer.IsRunning   = true;

            injectorClass = new DWMInjectorClass();
            if (!injectorClass.IsInjected)
            {
                injectorClass.Inject();
            }
            injectorClass.GetDWMExObject(out dwm);
            Debug.Assert(dwm != null, "DWM is NULL");

            windowManager = new WindowManager();
            windowManager.WindowCreated   += windowManager_WindowCreated;
            windowManager.WindowDestroyed += windowManager_WindowDestroyed;
            windowManager.Register(MessageEvents.Handle);

            ThreadPool.QueueUserWorkItem(delegate
            {
                hook = new LowLevelMouseHook(MouseHook);
                hook.StartHook();
                Application.Run();
            });
        }
Пример #2
0
 private void AppConfig_ConfigChanged(object sender, System.EventArgs e)
 {
     if (AppConfig.DrawingButton != MouseActions.None)
     {
         LowLevelMouseHook.StartHook();
     }
     else
     {
         LowLevelMouseHook.Unhook();
     }
 }
Пример #3
0
        public InputProvider()
        {
            RunPipeServer();

            AppConfig.ConfigChanged += AppConfig_ConfigChanged;
            LowLevelMouseHook        = new LowLevelMouseHook();

            if (AppConfig.DrawingButton != MouseActions.None)
            {
                LowLevelMouseHook.StartHook();
            }
        }
Пример #4
0
        public InputProvider()
        {
            _messageWindow = new MessageWindow();
            _messageWindow.PointsIntercepted += MessageWindow_PointsIntercepted;

            AppConfig.ConfigChanged += AppConfig_ConfigChanged;
            LowLevelMouseHook        = new LowLevelMouseHook();
            if (AppConfig.DrawingButton != MouseActions.None)
            {
                Task.Delay(1000).ContinueWith((t) =>
                {
                    LowLevelMouseHook.StartHook();
                }, TaskScheduler.FromCurrentSynchronizationContext());
            }
        }
Пример #5
0
 private void timer1_Tick(object sender, EventArgs e)
 {
     timer1.Enabled = false;
     if (llhook)
     {
         kbd   = new LowLevelKeyboardHook();
         mouse = new LowLevelMouseHook();
         kbd.MessageIntercepted   += new LowLevelMessageCallback(ll_MessageIntercepted);
         mouse.MessageIntercepted += new LowLevelMessageCallback(ll_MessageIntercepted);
         kbd.StartHook();
         mouse.StartHook();
     }
     else
     {
         rec              = new JournalRecordHook();
         rec.RecordEvent += new EventHandler <JournalRecordEventArgs>(rec_RecordEvent);
         rec.StartHook();
     }
 }
Пример #6
0
        public InputProvider()
        {
            _messageWindow = new MessageWindow();
            _messageWindow.PointsIntercepted += MessageWindow_PointsIntercepted;

            AppConfig.ConfigChanged += AppConfig_ConfigChanged;
            LowLevelMouseHook        = new LowLevelMouseHook();
            if (AppConfig.DrawingButton != MouseActions.None)
            {
                Task.Delay(1000).ContinueWith((t) =>
                {
                    LowLevelMouseHook.StartHook();
                }, TaskScheduler.FromCurrentSynchronizationContext());
            }


            SystemEvents.SessionSwitch    += new SessionSwitchEventHandler(OnSessionSwitch);
            SystemEvents.PowerModeChanged += new PowerModeChangedEventHandler(OnPowerModeChanged);

            _deviceStateServer = new CustomNamedPipeServer(Common.Constants.Daemon + "DeviceState", IpcCommands.SynDeviceState,
                                                           () => HidDevice.EnumerateDevices());
        }