Example #1
0
        public SelectDevicePopupWindow()
        {
            InitializeComponent();
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
            _rawinput = new RawInput(Process.GetCurrentProcess().MainWindowHandle, CaptureOnlyInForeground);
            _rawinput.AddMessageFilter();   // Adding a message filter will cause keypresses to be handled
            Win32.DeviceAudit();

            DataTable table = new DataTable();

            table.Columns.Add("DeviceType", typeof(string));
            table.Columns.Add("DeviceName", typeof(string));
            table.Columns.Add("etc", typeof(string));

            Dictionary <IntPtr, KeyPressEvent> devices = RawInput.GetKeyboardDriver().GetDeviceList();

            foreach (var item in devices.Keys)
            {
                if (Win32.GetDeviceType(devices[item].DeviceType) != DeviceType.RimTypekeyboard)
                {
                    continue;
                }

                table.Rows.Add(new string[] { devices[item].DeviceType, devices[item].DeviceName, devices[item].ToString() });
            }

            DeviceGrid.ItemsSource = table.DefaultView;
        }
Example #2
0
        private enum MusicKeys { Previous = 177, Next = 176, Stop = 178, PlayPause = 179, VolumeDown = 174, VolumeUp = 175 } // Key input numbers for expanded keyboards

        public frmKodiMediaKeys()
        {
            Application.ThreadException += new ThreadExceptionEventHandler(Application_ThreadException); // Catch specific errors
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

            InitializeComponent();

            _rawinput = new RawInput(Handle);
            _rawinput.CaptureOnlyIfTopMostWindow = false;   // Setting that will determine whether to capture keys all the time or just when in focus
            _rawinput.AddMessageFilter();                   // Adding a message filter will cause keypresses to be handled
            _rawinput.KeyPressed += OnKeyPressed;

            //Win32.DeviceAudit();                            // Writes a file DeviceAudit.txt to the current directory

            if (ProcessAlreadyRunning())                       // Determines whether or not Kodi is currently running or not.
            {
                lDisplay.Initialize(niKodi_MediaKeys, pbLCD);  // Initializes the keyboard
                eWatcher = WatchForProcessEnd(processToWatch); // Will exit the application when Kodi is exited.
            }
            else
            {
                sWatcher = WatchForProcessStart(processToWatch); // Will start the application when Kodi is started
            }

            EventLogSetup();
        }
        protected override void OnSourceInitialized(EventArgs e)
        {
            // I am new to WPF and I don't know where else to call this function.
            // It has to be called after the window is created or the handle won't
            // exist yet and the function will throw an exception.
            IntPtr hwnd  = IntPtr.Zero;
            Window myWin = Application.Current.MainWindow;

            try
            {
                hwnd = new WindowInteropHelper(myWin).Handle;
            }
            catch (Exception ex)
            {
                Debug.WriteLine("Initialized Exception: " + ex.Message);
            }

            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;

            _rawinput = new RawInput(hwnd, CaptureOnlyInForeground);
            _rawinput.AddMessageFilter();   // Adding a message filter will cause keypresses to be handled
            Win32.DeviceAudit();

            _rawinput.KeyPressed += OnKeyPressed;
            keyNames.Clear();
            base.OnSourceInitialized(e);
        }
Example #4
0
        public Multiplayer()
        {
            InitializeComponent();
            //For Keyboard
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;

            _rawinput = new RawInput(Handle, true);

            _rawinput.AddMessageFilter();   // Adding a message filter will cause keypresses to be handled
            Win32.DeviceAudit();            // Writes a file DeviceAudit.txt to the current directory

            _rawinput.KeyPressed += OnKeyPressed;
            //Keyboard End

            wr = new WordsReader();
            Timelimit.Start();
            Gameflow.Start();
            NextLevel();

            /*
             * THREAD TEST
             *
             *
             */
        }
Example #5
0
 /// <summary>
 /// constructor
 /// </summary>
 public Keyboard()
 {
     InitializeComponent();
     AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
     _rawinput = new RawInput(Handle, CaptureOnlyInForeground);
     _rawinput.AddMessageFilter();   // Adding a message filter will cause keypresses to be handled
     Win32.DeviceAudit();            // Writes a file DeviceAudit.txt to the current directory
     _rawinput.KeyPressed += OnKeyPressed;
 }
Example #6
0
        public Settings()
        {
            InitializeComponent();

            _rawinput = new RawInput(Handle, true);

            _rawinput.AddMessageFilter();   // Adding a message filter will cause keypresses to be handled
            Win32.DeviceAudit();            // Writes a file DeviceAudit.txt to the current directory

            _rawinput.KeyPressed += OnKeyPressed;
        }
 public MainWindow()
 {
     InitializeComponent();
     input = new RawInput(this.Handle, false);
     input.AddMessageFilter();
     input.KeyPressed += OnKeyPressed;
     if (!virtualJoy.vJoyEnabled())
     {
         MessageBox.Show("vJoy is not installed. Exiting program...");
         Close();
     }
 }
 public ImplementBarCode(Form form)
 {
     form.KeyPreview   = true;
     BarcodeReadEvent += BarcodeRead_Event;
     form.FormClosing += Keyboard_FormClosing;
     _rawinput         = new RawInput(form.Handle);
     _rawinput.CaptureOnlyIfTopMostWindow = true; // Otherwise default behavior is to capture always
     _rawinput.AddMessageFilter();                // Adding a message filter will cause keypresses to be handled
     _rawinput.KeyPressed    += OnKeyPressed;
     BarCodeReadStartedEvent += bc_BarCodeReadStartedEvent;
     //  Win32.DeviceAudit();
 }
Example #9
0
        public Mouse()
        {
            InitializeComponent();
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;

            _rawinput = new RawInput(Handle, CaptureOnlyInForeground);

            _rawinput.AddMessageFilter();
            Win32.DeviceAudit();

            _rawinput.KeyPressed += OnKeyPressed;
        }
Example #10
0
        public Keyboard()
        {
            InitializeComponent();
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;

            _rawinput = new RawInput(Handle);
            _rawinput.CaptureOnlyIfTopMostWindow = true;    // Otherwise default behavior is to capture always
            _rawinput.AddMessageFilter();                   // Adding a message filter will cause keypresses to be handled
            _rawinput.KeyPressed += OnKeyPressed;

            Win32.DeviceAudit();                            // Writes a file DeviceAudit.txt to the current directory
        }
Example #11
0
        public Form1()
        {
            InitializeComponent();
            rawinput             = new RawInput(Handle, false);
            rawinput.KeyPressed += Rawinput_KeyPressed;
            rawinput.AddMessageFilter();

            hook             = new KeyboardHook();
            hook.KeyEvented += Hook_KeyEvented;
            hook.HookStart();

            this.FormClosed += (s, e) => hook.HookEnd();
        }
Example #12
0
 private void Manual_Load(object sender, EventArgs e)
 {
     _rawinput.KeyPressed += OnKeyPressed;
     _rawinput.AddMessageFilter();
     config                 = sqlite.getConfig(lblUserId.Text);
     hidscanner             = config["hidscanner"];
     hidscanner2            = config["hidscanner2"];
     dataGridView1.Enabled  = false;
     dataGridView2.Enabled  = false;
     tbCarton1.Enabled      = false;
     tbBatchnumber1.Enabled = false;
     tbBatchnumber2.Enabled = false;
     tbCarton2.Enabled      = false;
     btEnd2.Enabled         = false;
     btStart2.Enabled       = false;
     btStart1.Enabled       = false;
     btEnd1.Enabled         = false;
 }
Example #13
0
        public MakeConfigurationWindow()
        {
            InitializeComponent();

            Button[] arrayButton = { B_A, B_B, B_X, B_Y, B_LB, B_RB, B_ST, B_BK, B_RC, B_LC, T_LT, T_RT, D_U, D_D, D_L, D_R, S_LU, S_LD, S_LL, S_LR, S_RU, S_RD, S_RL, S_RR };

            for (int i = 0; i < 24; i++)
            {
                arrayButton[i].Click += new EventHandler(SetKey_Click);
                for (int j = 0; j < 2; j++)
                {
                    RecordBook[i, j] = new StringCollection();
                }
            }

            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;

            _rawinput = new RawInput(Handle, CaptureOnlyInForeground);

            _rawinput.AddMessageFilter();

            _rawinput.KeyPressed += OnKeyPressed;
        }
 private void CartonVialValidation_Load(object sender, EventArgs e)
 {
     _rawinput.KeyPressed += OnKeyPressed;
     _rawinput.AddMessageFilter();
     dataGridView1.Enabled = false;
     dataGridView2.Enabled = false;
     config                 = sqlite.getConfig(lblUserId.Text);
     hidscanner             = config["hidscanner"];
     hidscanner2            = config["hidscanner2"];
     lblQty1.Text           = table.Rows.Count.ToString();
     lblQty2.Text           = table2.Rows.Count.ToString();
     tbCarton1.Enabled      = false;
     tbBatchnumber1.Enabled = false;
     tbVial1.Enabled        = false;
     btStart1.Enabled       = false;
     btEnd1.Enabled         = false;
     tbBatchnumber2.Enabled = false;
     tbCarton2.Enabled      = false;
     tbVial2.Enabled        = false;
     btStart2.Enabled       = false;
     btEnd2.Enabled         = false;
     backgroundWorker1.RunWorkerAsync();
 }
Example #15
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            RawKeyboard rk = new RawKeyboard();

            kbList             = rk.DeviceNameList();
            SelectedDeviceName = kbList[0];

            //Init Keyboard
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;

            _rawinput = new RawInput(Process.GetCurrentProcess().MainWindowHandle, CaptureOnlyInForeground);
            _rawinput.AddMessageFilter();   // Adding a message filter will cause keypresses to be handled
            Win32.DeviceAudit();            // Writes a file DeviceAudit.txt to the current directory
            _rawinput.KeyPressed += OnKeyPressed;


            // 이미지 백그라운드 설정
            this.Background = new ImageBrush(new BitmapImage(new Uri(BaseUriHelper.GetBaseUri(this), System.AppDomain.CurrentDomain.BaseDirectory + @"\skin.jpg")));

            // 창 사이즈 조절용
            orginalWidth   = this.Width;
            originalHeight = this.Height;
            if (this.WindowState == WindowState.Maximized)
            {
                ChangeSize(this.ActualWidth, this.ActualHeight);
            }
            this.SizeChanged += new SizeChangedEventHandler(Window_SizeChanged);

            //바코드파일 읽어서 리스트로 가지고 있기
            string path = System.AppDomain.CurrentDomain.BaseDirectory + @"\barcode.txt";

            using (FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read))
            {
                using (StreamReader sr = new StreamReader(fs, Encoding.Default))
                {
                    string line;
                    while ((line = sr.ReadLine()) != null)
                    {
                        if (!string.IsNullOrEmpty(line.Trim()))
                        {
                            //객체 생성해서 넣기
                            string[] data = line.Split(';');
                            if (!list.ContainsKey(data[0]))
                            {
                                list.Add(data[0], new Item {
                                    Barcode = data[0], Name = data[1], Amount = Convert.ToInt32(data[2].Replace(",", string.Empty)), Count = 1
                                });
                            }
                        }
                    }
                }
            }


            //샘플 데이터 삽입
            //int cnt = 0;
            //foreach (KeyValuePair<string, Item> i in list)
            //{
            //    if (cnt > 50)
            //    {
            //        break;
            //    }
            //    cartItems.Add(i.Value.Barcode, new Item { Barcode = i.Value.Barcode, Amount = i.Value.Amount, Name = i.Value.Name, Count = 1 });
            //    cnt++;
            //}



            lvCart.ItemsSource = cartItems;
            UpdateTotalAmount();


            //버튼 텍스트 변경
            Label lbAdd = (Label)btnADD.Template.FindName("Content", btnADD);

            lbAdd.Content = "추가+";
            Label lbRemove = (Label)btnREMOVE.Template.FindName("Content", btnREMOVE);

            lbRemove.Content = "제거-";
            Label lbInit = (Label)btnInit.Template.FindName("Content", btnInit);

            lbInit.Content = "초기화";
            Label lbCard = (Label)btnCard.Template.FindName("Content", btnCard);

            lbCard.Content = "카드결제";
            Label lbCash = (Label)btnCash.Template.FindName("Content", btnCash);

            lbCash.Content = "현금결제";

            btnADD.IsEnabled = false;
        }
Example #16
0
        private void InitializationSniffer(bool iscmd = false)
        {
            this.Visible = false;

            if (!iscmd) AppDomain.CurrentDomain.UnhandledException += CurrentDomainUnhandledException;
            input = new RawInput(Handle);
            if (!iscmd) input.AddMessageFilter();                   // Adding a message filter will cause keypresses to be handled
            if (!iscmd) input.KeyPressed += OnKeyPressed;

            this.CollectionHidDeviceInfo = input.CollectionHidDeviceInfo;

            if (!iscmd) notifyIcon1.Icon = (System.Drawing.Icon)resources.GetObject("Connected");
            if (!iscmd) notifyIcon1.ShowBalloonTip(1, "Connected", "Start scanning.", ToolTipIcon.Info);
        }
Example #17
0
 private void SubscribeRawInput()
 {
     rawinput             = new RawInput(Handle, false, true);
     rawinput.KeyPressed += RawInput_KeyPressed;
     rawinput.AddMessageFilter();
 }
Example #18
0
 /// <summary>
 /// handle keypresses when go back to main form
 /// </summary>
 public void AddMessageFilter()
 {
     _rawinput.AddMessageFilter();
 }
Example #19
0
        public MainWindow()
        {
            InitializeComponent();

            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;

            #region "Set up RawInput & vXbox"
            _rawinput = new RawInput(Handle, false);

            _rawinput.AddMessageFilter();   // Adding a message filter will cause keypresses to be handled

            _rawinput.KeyPressed += OnKeyPressed;

            // Check if vBus exists?
            if (isVBusExists() == false)
            {
                LogNExit("vBus for xBox controller not enabled...\n");
            }
            else
            {
                LogW("vBus found...\n");
            }

            //Check for avaiable devices
            bool findID = true;
            for (vxbID = 1; vxbID <= 4; vxbID++)
            {
                findID = isControllerExists(vxbID);
                if (findID == false)
                {
                    break;
                }
            }
            if (findID == true)
            {
                LogNExit("No available vJoy Device found :( \n");
            }

            // Acquire the target
            if (PlugIn(vxbID) != true)
            {
                LogNExit("Failed to acquire vJoy device\n");
            }
            else
            {
                //GetLedNumber(vxbID, out Led);
                LogW("Acquired :: vXbox ID : " + vxbID.ToString() + "\n");
            }

            this.Text = " :: K2XB :: ID " + vxbID.ToString() + " :: Blank";

            if (forceSD == true)
            {
                LogW("Close this application");
            }

            Btn1.Text = "One-to-One Controller";
            Btn2.Text = "Usiversal Controller";

            #endregion
        }
Example #20
-4
 public Form1()
 {
     InitializeComponent();
       rawInput = new RawInput(Handle);
       rawInput.AddMessageFilter();
       rawInput.Keyboard.DevicesChanged += Keyboards_DevicesChanged;
       rawInput.Keyboard.EnumerateDevices();
 }