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();
        }
Example #2
0
        // Todo: add checkbox to form when checked/uncheck create method to call that does the same as Keyboard ctor

        public Keyboard()
        {
            InitializeComponent();
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;

            _rawinput = new RawInput(Handle, CaptureOnlyInForeground);

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


            _rawinput.TouchActivated += OnKeyPressed;
        }
Example #3
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;

            WindowInteropHelper wndHelper = new WindowInteropHelper(this);
            IntPtr wpfHwnd = wndHelper.Handle;

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

            _rawinput.KeyPressed += new RawKeyboard.DeviceEventHandler(OnKeyPressed);

            Win32.DeviceAudit();                            // Writes a file DeviceAudit.txt to the current directory
        }
Example #4
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;
        }