Beispiel #1
0
        protected override void Execute(CodeActivityContext context)
        {
            var h = WindowHandle.Get(context);

            if (h == null)
            {
                throw new ArgumentException(Resource.WindowHandleArgumentValidationError);
            }
            int state = 0;
            int mask  = 0;

            if (KeyboardOpenClose.Expression != null)
            {
                if (ConversionMode.Expression != null)
                {
                    throw new ArgumentException(Resource.SetStateInputArgumentValidationError);
                }
                state |= (KeyboardOpenClose.Get(context) ? 1 : 0) << 15;
                mask  |= Bridge.OPENCLOSE;
            }
            else if (ConversionMode.Expression != null)
            {
                state |= (ConversionMode.Get(context) & 0x7fff) << 0;
                mask  |= Bridge.CONVERSION;
            }
            var value = Bridge.SetState(Bridge.ToWin32Handle(h), state, mask);

            PreviousKeyboardOpenClose.Set(context, ((value >> 15) & 1) == 1);
            PreviousConversionMode.Set(context, (value >> 0) & 0x7fff);
        }
        protected override void Execute(CodeActivityContext context)
        {
            var h = WindowHandle.Get(context);

            if (h == null)
            {
                throw new ArgumentException(Resource.WindowHandleArgumentValidationError);
            }
            var value = Bridge.SetState(Bridge.ToWin32Handle(h), 0, 0);

            KeyboardLayout.Set(context, (value >> 16) & 0xffff);
            KeyboardOpenClose.Set(context, ((value >> 15) & 1) == 1);
            ConversionMode.Set(context, (value >> 0) & 0x7fff);
        }