ToString() 공개 메소드

Returns a System.String representing this KeyboardDevice.
public ToString ( ) : string
리턴 string
예제 #1
0
        internal void RegisterKeyboardDevice(KeyboardDevice kb)
        {
            RawInputDevice[] rid = new RawInputDevice[1];
            // Keyboard is 1/6 (page/id). See http://www.microsoft.com/whdc/device/input/HID_HWID.mspx
            rid[0] = new RawInputDevice();
            rid[0].UsagePage = 1;
            rid[0].Usage = 6;
            rid[0].Flags = RawInputDeviceFlags.INPUTSINK;
            rid[0].Target = window;

            if (!Functions.RegisterRawInputDevices(rid, 1, API.RawInputDeviceSize))
            {
                throw new ApplicationException(
                    String.Format(
                        "Raw input registration failed with error: {0}. Device: {1}",
                        Marshal.GetLastWin32Error(),
                        rid[0].ToString())
                );
            }
            else
            {
                Debug.Print("Registered keyboard {0}", kb.ToString());
            }
        }
예제 #2
0
        internal X11Keyboard(WindowInfo window)
        {
            if (window == null)
                throw new ArgumentNullException("window");

            this.window = window;
            Initialize();

            //Debug.Print("Info: {0}", window.ToString());

            API.DisplayKeycodes(window.Display, ref firstKeyCode, ref lastKeyCode);
            Debug.Print("First keycode: {0}, last {1}", firstKeyCode, lastKeyCode);

            IntPtr keysym_ptr = API.GetKeyboardMapping(window.Display, (byte)firstKeyCode,
                lastKeyCode - firstKeyCode + 1, ref keysyms_per_keycode);
            Debug.Print("{0} keysyms per keycode.", keysyms_per_keycode);

            keysyms = new IntPtr[(lastKeyCode - firstKeyCode + 1) * keysyms_per_keycode];
            Marshal.PtrToStructure(keysym_ptr, keysyms);
            //keysyms = (IntPtr[])Marshal.PtrToStructure(keysym_ptr, typeof(IntPtr[]));

            API.Free(keysym_ptr);
            
            KeyboardDevice kb = new KeyboardDevice();
            kb.Description = "Default X11 keyboard";
            kb.NumberOfKeys = lastKeyCode - firstKeyCode + 1;
            kb.DeviceID = IntPtr.Zero;
            keyboards.Add(kb);
            Debug.Print("Keyboard added: {0}", kb.ToString());
        }