Ejemplo n.º 1
0
        public static void Unlock(bool freezeExternalInputWhenInputNotLocked, ProtoInputOptions protoOptions)
        {
            if (isLocking)
            {
                return;
            }
            else
            {
                isLocking = true;
            }

            //System.Windows.Forms.Cursor.Show();
            System.Windows.Forms.Cursor.Clip = new System.Drawing.Rectangle();

            //InputInterceptor.InterceptEnabled = false;

            ProtoInput.ProtoInput.protoInput.LockInput(false);

            ProtoInput.ProtoInput.protoInput.RestartExplorer();

            Debug.WriteLine("Unlocked input");

            isLocking = false;
            IsLocked  = false;

            if (freezeExternalInputWhenInputNotLocked)
            {
                ProtoInputLauncher.NotifyInputLockChange();
            }

            protoOptions?.OnInputUnlocked?.Invoke();
        }
Ejemplo n.º 2
0
        public static void Lock(bool suspendExplorer, bool freezeExternalInputWhenInputNotLocked, ProtoInputOptions protoOptions)
        {
            if (isLocking)
            {
                return;
            }
            else
            {
                isLocking = true;
            }


            //InputInterceptor.InterceptEnabled = true;


            //System.Windows.Forms.Cursor.Hide();

            System.Windows.Forms.Cursor.Position = new System.Drawing.Point(0, 0);
            System.Windows.Forms.Cursor.Clip     = new System.Drawing.Rectangle(0, 0, 1, 1);

            //WinApi.SetForegroundWindow(WinApi.GetDesktopWindow());

            ProtoInput.ProtoInput.protoInput.LockInput(true);

            if (suspendExplorer)
            {
                ProtoInput.ProtoInput.protoInput.SuspendExplorer();
            }

            Debug.WriteLine("Locked input, suspended explorer = " + suspendExplorer);

            isLocking = false;
            IsLocked  = true;

            if (freezeExternalInputWhenInputNotLocked)
            {
                ProtoInputLauncher.NotifyInputLockChange();
            }


            protoOptions?.OnInputLocked?.Invoke();
        }