Example #1
0
        public MainWindow()
        {
            InitializeComponent();

            // HotKeyの登録
            this._hotkey = new HotKeyHelper(this);
            this._hotkey.Register(ModifierKeys.Control | ModifierKeys.Shift,
                                  Key.Z,
                                  (_, __) => { this.OnHotKeyPressed(); });
            TabletModeController.SetTabletMode(false);
            Display.Rotate(1, Display.Orientations.DEGREES_CW_90); // 90:横 0:縦

            var deviceList = HidDevices.Enumerate().ToArray();

            _device = Array.Find(deviceList, dev => dev.DevicePath == "xxx");

            if (_device != null)
            {
                if (_device.IsConnected)
                {
                    _device.OpenDevice();
                }

                _device.MonitorDeviceEvents = true;
                _device.ReadReport(OnReport);
            }
        }
Example #2
0
        protected override void OnClosed(EventArgs e)
        {
            TabletModeController.SetTabletMode(false);
            Display.Rotate(1, Display.Orientations.DEGREES_CW_90); // 90:横 0:縦

            // HotKeyの登録解除
            this._hotkey.Dispose();

            base.OnClosed(e);
        }
Example #3
0
        private void OnReport(HidReport report)
        {
            TabletModeController.SetTabletMode(true);
            Display.Rotate(1, Display.Orientations.DEGREES_CW_0); // 90:横 0:縦

            isRotate = true;

            // we need to start listening again for more data
            _device.ReadReport(OnReport);
        }
Example #4
0
        private void OnHotKeyPressed()
        {
            if (isRotate)
            {
                TabletModeController.SetTabletMode(false);
                Display.Rotate(1, Display.Orientations.DEGREES_CW_90); // 90:横 0:縦
            }
            else
            {
                TabletModeController.SetTabletMode(true);
                Display.Rotate(1, Display.Orientations.DEGREES_CW_0); // 90:横 0:縦
            }

            isRotate = !isRotate;
        }
Example #5
0
 private void VerticallMode_Click(object sender, RoutedEventArgs e)
 {
     this.isRotate = true;
     TabletModeController.SetTabletMode(true);
     Display.Rotate(1, Display.Orientations.DEGREES_CW_0); // 90:横 0:縦
 }
Example #6
0
 private void HorizontalMode_Click(object sender, RoutedEventArgs e)
 {
     this.isRotate = false;
     TabletModeController.SetTabletMode(false);
     Display.Rotate(1, Display.Orientations.DEGREES_CW_90); // 90:横 0:縦
 }