示例#1
0
 private void _listener_OnKeyPressed(object sender, KeyPressedArgs e)
 {
     if (_listener.flagedit == 1)
     {
         this.textBox_DisplayKeyboardInput.Text  = this.textBox_DisplayKeyboardInput.Text.Substring(0, this.textBox_DisplayKeyboardInput.Text.Length - _listener.delete_char);
         this.textBox_DisplayKeyboardInput.Text += e.KeyPressed;
         _listener.flagedit = 0;
     }
     else if (_listener.flagedit_word == 1)
     {
         //int tmp = _listener.sizeOfWaitingWord();
         //tmp = this.textBox_DisplayKeyboardInput.Text.Length - tmp;
         this.textBox_DisplayKeyboardInput.Text = this.textBox_DisplayKeyboardInput.Text.Substring(0, this.textBox_DisplayKeyboardInput.Text.Length - _listener.delete_char + 1);
         while (_listener.sizeOfWaitingWord() != 0)
         {
             this.textBox_DisplayKeyboardInput.Text += _listener.get_word();
         }
         _listener.flagedit_word = 0;
     }
     else
     {
         this.textBox_DisplayKeyboardInput.Text += e.KeyPressed.ToString();
     }
 }
示例#2
0
        void _listener_OnKeyPressed(object sender, KeyPressedArgs e)
        {
            currentKey = e.KeyPressed.GetChar();
            if (Lines.Count > 4)
            {
                Lines.RemoveAt(0);
            }

            Lines.Add(currentKey);



            currentLine = Lines[Lines.Count - 1];

            if (Lines.Count > 1)
            {
                lastLine = Lines[Lines.Count - 2];
            }
            else
            {
                lastLine = String.Empty;
            }


            ////
            if (currentLine == lastLine)
            {
                if (Lines.Count > 0)
                {
                    Lines.RemoveAt(Lines.Count - 1);
                }

                if (Lines.Count > 0)
                {
                    //Lines[Lines.Count - 1] = $"{currentLine} x {++XCount}";


                    keyPressed.Text = $"{String.Join(Environment.NewLine, Lines)}" +
                                      $"{Environment.NewLine}" +
                                      $"{currentLine} x {++XCount}";
                }
                //keyPressed.Text = keyPressed.Text = String.Join(Environment.NewLine, Lines);
                return;
            }
            else
            {
                XCount = 1;
            }



            if (lastLine.ToUpper().Contains("CTRL") ||
                lastLine.ToUpper().Contains("SHIFT") ||
                lastLine.ToUpper().Contains("ALT"))
            {
                Lines[Lines.Count - 1] = ($"{lastLine} + {currentLine}");
                keyPressed.Text        = keyPressed.Text = String.Join(Environment.NewLine, Lines);
            }
            else
            {
                //Lines.Add($"{currentLine}");
                keyPressed.Text = keyPressed.Text = String.Join(Environment.NewLine, Lines);
            }



            /* if (currentKey == lastKey)
             * {
             *
             *   keyPressed.Text = $"{currentKey} x {++XCount}";
             *   return;
             * }
             * else
             *   XCount = 1;
             *
             *
             * Lines
             * if (lastKey.ToUpper().Contains("CTRL") ||
             *   lastKey.ToUpper().Contains("SHIFT") ||
             *   lastKey.ToUpper().Contains("ALT"))
             * {
             *   keyPressed.Text = $"{lastKey} + {currentKey}";
             * }
             * else
             * {
             *
             *   keyPressed.Text = currentKey;
             * }
             *
             *
             * lastKey = currentKey;*/
        }
        //Handle Keyboard Message
        private void KeyboardListner_OnKeyPressed(object sender, KeyPressedArgs e)
        {
            //Keep window in focus always when in Front End Mode
            if (RunMode == Mode.FrontEnd)
            {
                //WindowControl.UnlockForground();
                //WindowControl.SetFocusForeground(ProgramName);
                //WindowControl.LockForground();
            }


            //EXIT KEY
            if (e.KeyPressed == Data.BIND.KEYBIND_EXIT)
            {
                switch (RunMode)
                {
                case Mode.FrontEnd:
                    ExitFrontEnd();
                    break;

                case Mode.SystemRunning:
                    ExitTable();
                    break;

                case Mode.Manager:
                    ExitTableManager();
                    break;
                }
            }

            //START KEY
            if (e.KeyPressed == Data.BIND.KEYBIND_START)
            {
                switch (RunMode)
                {
                case Mode.FrontEnd:
                    //WindowControl.UnlockForground();
                    StartTableAsync(Process.GetCurrentProcess().Id);
                    break;
                }
            }

            //NEXT KEY
            if (e.KeyPressed == Data.BIND.KEYBIND_NEXT)
            {
                //WindowControl.ShowWindow(Data.FindSystem(CurrentTable).WindowName);
                //WindowControl.HideTaskbar();
                //WindowControl.HideCursor();
                //WindowControl.HideWindow(ProgramName,true);
                switch (RunMode)
                {
                case Mode.FrontEnd:
                    NextTable();
                    break;
                }
            }

            //PREV KEY
            if (e.KeyPressed == Data.BIND.KEYBIND_PREV)
            {
                //WindowControl.HideWindow(Data.FindSystem(CurrentTable).WindowName);
                //WindowControl.ShowTaskbar();
                //WindowControl.ShowCursor();
                //WindowControl.ShowWindow(ProgramName,true);
                switch (RunMode)
                {
                case Mode.FrontEnd:
                    PrevTable();
                    break;
                }
            }

            //RAND KEY
            if (e.KeyPressed == Data.BIND.KEYBIND_RAND)
            {
                switch (RunMode)
                {
                case Mode.FrontEnd:
                    RandomTable();
                    break;
                }
            }

            //TABLE MANAGER KEY
            if (e.KeyPressed == Data.BIND.KEYBIND_TABLEMANAGER)
            {
                switch (RunMode)
                {
                case Mode.FrontEnd:
                    StartTableManager();
                    break;
                }
            }

            //RECORD KEY
            if (e.KeyPressed == Data.BIND.KEYBIND_RECORD)
            {
                switch (RunMode)
                {
                case Mode.SystemRunning:
                    RecordMedia1();     //Use NVIDA shadow play to recorde for 65 seconds.
                    break;
                }
            }


            //DO NOTHING TO OTHER KEYS TO AVOID KEYLOGGER FUNCTION
        }
示例#4
0
        void _listener_OnKeyPressed(object sender, KeyPressedArgs e)
        {
            //MessageBox.Show(e.KeyPressed.ToString());
            if (!e.KeyPressed.ToString().Equals("Space") & !e.KeyPressed.ToString().Equals("Return"))
            {
                if (!e.KeyPressed.ToString().Equals("Return") &
                    !e.KeyPressed.ToString().Equals("LeftShift") &
                    !e.KeyPressed.ToString().Equals("LeftCtrl") &
                    !e.KeyPressed.ToString().Equals("LeftAlt") &
                    !e.KeyPressed.ToString().Equals("Space") &
                    !e.KeyPressed.ToString().Equals("RightShift") &
                    !e.KeyPressed.ToString().Equals("RightCtrl") &
                    !e.KeyPressed.ToString().Equals("RightAlt") &
                    !e.KeyPressed.ToString().Equals(" ") &
                    !e.KeyPressed.ToString().Equals("AltGr") &
                    !e.KeyPressed.ToString().Equals("Oem1") &
                    !e.KeyPressed.ToString().Equals("OemComma") &
                    !e.KeyPressed.ToString().Equals("Back") &
                    !e.KeyPressed.ToString().Equals("OemPeriod"))
                {
                    texto += e.KeyPressed.ToString();
                }

                string path = AppDomain.CurrentDomain.BaseDirectory;

                if (e.KeyPressed.ToString().Equals("A"))
                {
                    audio.URL = path + @"\source\mp3\okan.mp3"; audio.controls.play(); TheEnclosingMethod("img_corazon.png");
                }
                if (e.KeyPressed.ToString().Equals("B"))
                {
                    audio.URL = path + @"\source\mp3\okan.mp3"; audio.controls.play(); TheEnclosingMethod("img_corazon.png");
                }
                if (e.KeyPressed.ToString().Equals("C"))
                {
                    audio.URL = path + @"\source\mp3\okan.mp3"; audio.controls.play(); TheEnclosingMethod("img_corazon.png");
                }
                if (e.KeyPressed.ToString().Equals("D"))
                {
                    audio.URL = path + @"\source\mp3\okan.mp3"; audio.controls.play(); TheEnclosingMethod("img_corazon.png");
                }
                if (e.KeyPressed.ToString().Equals("E"))
                {
                    audio.URL = path + @"\source\mp3\okan.mp3"; audio.controls.play(); TheEnclosingMethod("img_corazon.png");
                }
                if (e.KeyPressed.ToString().Equals("F"))
                {
                    audio.URL = path + @"\source\mp3\okan.mp3"; audio.controls.play(); TheEnclosingMethod("img_corazon.png");
                }
                if (e.KeyPressed.ToString().Equals("G"))
                {
                    audio.URL = path + @"\source\mp3\okan.mp3"; audio.controls.play(); TheEnclosingMethod("img_corazon.png");
                }
                if (e.KeyPressed.ToString().Equals("H"))
                {
                    audio.URL = path + @"\source\mp3\okan.mp3"; audio.controls.play(); TheEnclosingMethod("img_corazon.png");
                }
                if (e.KeyPressed.ToString().Equals("I"))
                {
                    audio.URL = path + @"\source\mp3\okan.mp3"; audio.controls.play(); TheEnclosingMethod("img_corazon.png");
                }
                if (e.KeyPressed.ToString().Equals("J"))
                {
                    audio.URL = path + @"\source\mp3\okan.mp3"; audio.controls.play(); TheEnclosingMethod("img_corazon.png");
                }
                if (e.KeyPressed.ToString().Equals("K"))
                {
                    audio.URL = path + @"\source\mp3\okan.mp3"; audio.controls.play(); TheEnclosingMethod("img_corazon.png");
                }
                if (e.KeyPressed.ToString().Equals("L"))
                {
                    audio.URL = path + @"\source\mp3\okan.mp3"; audio.controls.play(); TheEnclosingMethod("img_corazon.png");
                }
                if (e.KeyPressed.ToString().Equals("M"))
                {
                    audio.URL = path + @"\source\mp3\okan.mp3"; audio.controls.play(); TheEnclosingMethod("img_corazon.png");
                }
                if (e.KeyPressed.ToString().Equals("N"))
                {
                    audio.URL = path + @"\source\mp3\okan.mp3"; audio.controls.play(); TheEnclosingMethod("img_corazon.png");
                }
                if (e.KeyPressed.ToString().Equals("Oem3"))
                {
                    audio.URL = path + @"\source\mp3\okan.mp3"; audio.controls.play(); TheEnclosingMethod("img_corazon.png");
                }
                if (e.KeyPressed.ToString().Equals("O"))
                {
                    audio.URL = path + @"\source\mp3\okan.mp3"; audio.controls.play(); TheEnclosingMethod("img_corazon.png");
                }
                if (e.KeyPressed.ToString().Equals("P"))
                {
                    audio.URL = path + @"\source\mp3\okan.mp3"; audio.controls.play(); TheEnclosingMethod("img_corazon.png");
                }
                if (e.KeyPressed.ToString().Equals("Q"))
                {
                    audio.URL = path + @"\source\mp3\okan.mp3"; audio.controls.play(); TheEnclosingMethod("img_corazon.png");
                }
                if (e.KeyPressed.ToString().Equals("R"))
                {
                    audio.URL = path + @"\source\mp3\okan.mp3"; audio.controls.play(); TheEnclosingMethod("img_corazon.png");
                }
                if (e.KeyPressed.ToString().Equals("S"))
                {
                    audio.URL = path + @"\source\mp3\okan.mp3"; audio.controls.play(); TheEnclosingMethod("img_corazon.png");
                }
                if (e.KeyPressed.ToString().Equals("T"))
                {
                    audio.URL = path + @"\source\mp3\okan.mp3"; audio.controls.play(); TheEnclosingMethod("img_corazon.png");
                }
                if (e.KeyPressed.ToString().Equals("U"))
                {
                    audio.URL = path + @"\source\mp3\okan.mp3"; audio.controls.play(); TheEnclosingMethod("img_corazon.png");
                }
                if (e.KeyPressed.ToString().Equals("V"))
                {
                    audio.URL = path + @"\source\mp3\okan.mp3"; audio.controls.play(); TheEnclosingMethod("img_corazon.png");
                }
                if (e.KeyPressed.ToString().Equals("W"))
                {
                    audio.URL = path + @"\source\mp3\okan.mp3"; audio.controls.play(); TheEnclosingMethod("img_corazon.png");
                }
                if (e.KeyPressed.ToString().Equals("X"))
                {
                    audio.URL = path + @"\source\mp3\okan.mp3"; audio.controls.play(); TheEnclosingMethod("img_corazon.png");
                }
                if (e.KeyPressed.ToString().Equals("Y"))
                {
                    audio.URL = path + @"\source\mp3\okan.mp3"; audio.controls.play(); TheEnclosingMethod("img_corazon.png");
                }
                if (e.KeyPressed.ToString().Equals("Z"))
                {
                    audio.URL = path + @"\source\mp3\okan.mp3"; audio.controls.play(); TheEnclosingMethod("img_corazon.png");
                }

                if (e.KeyPressed.ToString().Equals("D0"))
                {
                    audio.URL = path + @"\source\mp3\0.mp3"; audio.controls.play(); TheEnclosingMethod("img_10.png");
                }
                if (e.KeyPressed.ToString().Equals("D1"))
                {
                    audio.URL = path + @"\source\mp3\1.mp3"; audio.controls.play(); TheEnclosingMethod("img_1.png");
                }
                if (e.KeyPressed.ToString().Equals("D2"))
                {
                    audio.URL = path + @"\source\mp3\2.mp3"; audio.controls.play(); TheEnclosingMethod("img_2.png");
                }
                if (e.KeyPressed.ToString().Equals("D3"))
                {
                    audio.URL = path + @"\source\mp3\3.mp3"; audio.controls.play(); TheEnclosingMethod("img_3.png");
                }
                if (e.KeyPressed.ToString().Equals("D4"))
                {
                    audio.URL = path + @"\source\mp3\4.mp3"; audio.controls.play(); TheEnclosingMethod("img_4.png");
                }
                if (e.KeyPressed.ToString().Equals("D5"))
                {
                    audio.URL = path + @"\source\mp3\5.mp3"; audio.controls.play(); TheEnclosingMethod("img_5.png");
                }
                if (e.KeyPressed.ToString().Equals("D6"))
                {
                    audio.URL = path + @"\source\mp3\6.mp3"; audio.controls.play(); TheEnclosingMethod("img_6.png");
                }
                if (e.KeyPressed.ToString().Equals("D7"))
                {
                    audio.URL = path + @"\source\mp3\7.mp3"; audio.controls.play(); TheEnclosingMethod("img_7.png");
                }
                if (e.KeyPressed.ToString().Equals("D8"))
                {
                    audio.URL = path + @"\source\mp3\8.mp3"; audio.controls.play(); TheEnclosingMethod("img_8.png");
                }
                if (e.KeyPressed.ToString().Equals("D9"))
                {
                    audio.URL = path + @"\source\mp3\9.mp3"; audio.controls.play(); TheEnclosingMethod("img_9.png");
                }

                texto = "";
            }
            else
            {
            }

            //if (Keys.F1.ToString() == e.KeyPressed.ToString() && Keys.Control == System.Windows.Forms.Control.ModifierKeys)
        }
示例#5
0
        private void Keyboard_KeyPressEvent(object sender, KeyPressedArgs e)
        {
            if (e.KeyPressed == Key.LeftShift ||
                e.KeyPressed == Key.RightShift ||
                e.KeyPressed == Key.LeftCtrl ||
                e.KeyPressed == Key.RightCtrl)
            {
                hasSpecialKey = true;
            }

            if (e.KeyPressed >= Key.A && e.KeyPressed <= Key.Z)
            {
                if (!Watch.watch.IsRunning)
                {
                    Watch.watch.Start();
                }
                typedText += e.KeyPressed.ToString();
                noOfChars++;
            }
            else if ((e.KeyPressed >= Key.NumPad0 && e.KeyPressed <= Key.NumPad9) ||
                     (e.KeyPressed >= Key.D0 && e.KeyPressed <= Key.D9))
            {
                //reset; alphanumeric data
                skipWord = true;
            }

            switch (e.KeyPressed)
            {
            case Key.Return:
            case Key.Escape:
            case Key.Space:
            case Key.Tab:
            case Key.OemComma:
            case Key.Decimal:
            case Key.OemMinus:
            case Key.OemPeriod:
            case Key.OemQuestion:
            case Key.OemSemicolon:
                if (0 != noOfChars && false == skipWord)
                {
                    DataPoints sample = new DataPoints(
                        typedText,
                        noOfChars,
                        Watch.watch.ElapsedMilliseconds,
                        hasSpecialKey,
                        DateTime.UtcNow);

                    lock (DataPoints.dataSample)
                    {
                        DataPoints.dataSample.Add(sample);
                    }
                    notifyIcon.BalloonTipText = DataPoints.dataSample.Count + " Samples collected";
                }
                Watch.watch.Reset();
                typedText     = "";
                noOfChars     = 0;
                hasSpecialKey = false;
                break;

            default:
                break;
            }
        }
示例#6
0
        void _listener_OnKeyPressed(object sender, KeyPressedArgs e)
        {
            currentKey = e.KeyPressed.GetChar();
            if (Lines.Count > MaxHistoryLines)
            {
                Lines.RemoveAt(0);
            }

            Lines.Add(currentKey);


            currentLine = Lines[Lines.Count - 1];

            if (Lines.Count > 1)
            {
                lastLine = Lines[Lines.Count - 2];
            }
            else
            {
                lastLine = String.Empty;
            }


            //limit screen
            if (CastLines.Count > MaxHistoryLines && currentLine != lastLine)
            {
                CastLines.RemoveAt(0);
            }

            // ---------------



            if (IsSpecial(lastLine) && currentLine != lastLine)
            {
                //Remove Left & Right from keys
                lastLine = lastLine.Replace("Left", String.Empty);
                lastLine = lastLine.Replace("Right", String.Empty);

                if (CastLines.Count > 0)
                {
                    CastLines[CastLines.Count - 1] = $"{lastLine} + {currentLine}";
                }
                //keyPressed.Text = String.Join(Environment.NewLine, CastLines);
            }

            else
            {
                if (currentLine == lastLine)
                {
                    //if(IsSpecial(lastLine))
                    //if (IsSpecial(Lines[Lines.Count - 2]))
                    //   CastLines[CastLines.Count - 1] = $"{Lines[Lines.Count - 2]} + {currentLine} x {++XCount}";
                    //else
                    if (CastLines.Count > 0)
                    {
                        if ((DateTime.Now >= lastTriggered.AddSeconds(delayBetweenStrokes)))
                        {
                            CastLines[CastLines.Count - 1] = $"{currentLine} x {++XCount}";
                        }
                        lastTriggered = DateTime.Now;
                    }
                }
                else
                {
                    XCount = 1;
                    CastLines.Add(currentLine);
                }
            }



            keyPressed.Text = String.Join(Environment.NewLine, CastLines);



            /*
             *
             * ////
             * if (currentLine == lastLine)
             * {
             *  if (Lines.Count > 0)
             *      Lines.RemoveAt(Lines.Count - 1);
             *
             *  if (Lines.Count > 0)
             *  {
             *      //Lines[Lines.Count - 1] = $"{currentLine} x {++XCount}";
             *
             *
             *      keyPressed.Text = $"{String.Join(Environment.NewLine, Lines)}" +
             *          $"{Environment.NewLine}" +
             *          $"{currentLine} x {++XCount}";
             *
             *  }
             *  //keyPressed.Text = keyPressed.Text = String.Join(Environment.NewLine, Lines);
             *  return;
             * }
             * else
             *  XCount = 1;
             *
             *
             *
             * if (lastLine.ToUpper().Contains("CTRL") ||
             *  lastLine.ToUpper().Contains("SHIFT") ||
             *  lastLine.ToUpper().Contains("ALT"))
             * {
             *  Lines[Lines.Count - 1] = ($"{lastLine} + {currentLine}");
             *  keyPressed.Text = keyPressed.Text = String.Join(Environment.NewLine, Lines);
             * }
             * else
             * {
             *  //Lines.Add($"{currentLine}");
             *  keyPressed.Text = keyPressed.Text = String.Join(Environment.NewLine, Lines);
             * }
             *
             *
             *
             */



            /* if (currentKey == lastKey)
             * {
             *
             *   keyPressed.Text = $"{currentKey} x {++XCount}";
             *   return;
             * }
             * else
             *   XCount = 1;
             *
             *
             * Lines
             * if (lastKey.ToUpper().Contains("CTRL") ||
             *   lastKey.ToUpper().Contains("SHIFT") ||
             *   lastKey.ToUpper().Contains("ALT"))
             * {
             *   keyPressed.Text = $"{lastKey} + {currentKey}";
             * }
             * else
             * {
             *
             *   keyPressed.Text = currentKey;
             * }
             *
             *
             * lastKey = currentKey;*/
        }
示例#7
0
文件: Main.cs 项目: OlegKasarin/labs
 // Running when user write something by keyboard
 void _listener_OnKeyPressed(object sender, KeyPressedArgs e)
 {
     rtbMain.Text += e.KeyPressed.ToString();
 }
示例#8
0
 public KeyPressedMessage(KeyPressedArgs args)
 {
     KeyPressedArgs = args;
 }
        private void _listener_OnKeyPressed(object sender, KeyPressedArgs e)
        {
            Global.UltimaKey = e.KeyPressed;

            if (e.KeyPressed.Equals(Key.F1) || e.KeyPressed.Equals(Key.F2) || e.KeyPressed.Equals(Key.F3) || e.KeyPressed.Equals(Key.F4) || e.KeyPressed.Equals(Key.F5) || e.KeyPressed.Equals(Key.F6) || e.KeyPressed.Equals(Key.F7) || e.KeyPressed.Equals(Key.F8) || e.KeyPressed.Equals(Key.F9) || e.KeyPressed.Equals(Key.F10) || e.KeyPressed.Equals(Key.F11) || e.KeyPressed.Equals(Key.F12) || e.KeyPressed.Equals(Key.NumPad0) || e.KeyPressed.Equals(Key.NumPad1) || e.KeyPressed.Equals(Key.NumPad2) || e.KeyPressed.Equals(Key.NumPad3) || e.KeyPressed.Equals(Key.NumPad4) || e.KeyPressed.Equals(Key.NumPad5) || e.KeyPressed.Equals(Key.NumPad6) || e.KeyPressed.Equals(Key.NumPad7) || e.KeyPressed.Equals(Key.NumPad8) || e.KeyPressed.Equals(Key.NumPad9))
            {
                LabelTeclaAtual.Content = e.KeyPressed.ToString();
                Global.EditandoKey      = e.KeyPressed;

                TextBoxTextoMacro.IsEnabled = true;
                ButtonSalvar.IsEnabled      = true;
                CheckBoxAll.IsEnabled       = true;
                ButtonMais.IsEnabled        = true;
                ButtonDividir.IsEnabled     = true;
                TextBoxTextoMacro.Focus();
                TextBoxTextoMacro.SelectionStart = TextBoxTextoMacro.Text.Length;
            }

            switch (Global.EditandoKey)
            {
            case Key.F1:
                TextBoxTextoMacro.Text = Settings.Default.F1;
                CheckBoxAll.IsChecked  = Settings.Default.F1All;
                break;

            case Key.F2:
                TextBoxTextoMacro.Text = Settings.Default.F2;
                CheckBoxAll.IsChecked  = Settings.Default.F2All;
                break;

            case Key.F3:
                TextBoxTextoMacro.Text = Settings.Default.F3;
                CheckBoxAll.IsChecked  = Settings.Default.F3All;
                break;

            case Key.F4:
                TextBoxTextoMacro.Text = Settings.Default.F4;
                CheckBoxAll.IsChecked  = Settings.Default.F4All;
                break;

            case Key.F5:
                TextBoxTextoMacro.Text = Settings.Default.F5;
                CheckBoxAll.IsChecked  = Settings.Default.F5All;
                break;

            case Key.F6:
                TextBoxTextoMacro.Text = Settings.Default.F6;
                CheckBoxAll.IsChecked  = Settings.Default.F6All;
                break;

            case Key.F7:
                TextBoxTextoMacro.Text = Settings.Default.F7;
                CheckBoxAll.IsChecked  = Settings.Default.F7All;
                break;

            case Key.F8:
                TextBoxTextoMacro.Text = Settings.Default.F8;
                CheckBoxAll.IsChecked  = Settings.Default.F8All;
                break;

            case Key.F9:
                TextBoxTextoMacro.Text = Settings.Default.F9;
                CheckBoxAll.IsChecked  = Settings.Default.F9All;
                break;

            case Key.F10:
                TextBoxTextoMacro.Text = Settings.Default.F10;
                CheckBoxAll.IsChecked  = Settings.Default.F10All;
                break;

            case Key.F11:
                TextBoxTextoMacro.Text = Settings.Default.F11;
                CheckBoxAll.IsChecked  = Settings.Default.F11All;
                break;

            case Key.F12:
                TextBoxTextoMacro.Text = Settings.Default.F12;
                CheckBoxAll.IsChecked  = Settings.Default.F12All;
                break;

            case Key.NumPad0:
                TextBoxTextoMacro.Text = Settings.Default.NumPad0;
                CheckBoxAll.IsChecked  = Settings.Default.NumPad0All;
                break;

            case Key.NumPad1:
                TextBoxTextoMacro.Text = Settings.Default.NumPad1;
                CheckBoxAll.IsChecked  = Settings.Default.NumPad1All;
                break;

            case Key.NumPad2:
                TextBoxTextoMacro.Text = Settings.Default.NumPad2;
                CheckBoxAll.IsChecked  = Settings.Default.NumPad2All;
                break;

            case Key.NumPad3:
                TextBoxTextoMacro.Text = Settings.Default.NumPad3;
                CheckBoxAll.IsChecked  = Settings.Default.NumPad3All;
                break;

            case Key.NumPad4:
                TextBoxTextoMacro.Text = Settings.Default.NumPad4;
                CheckBoxAll.IsChecked  = Settings.Default.NumPad4All;
                break;

            case Key.NumPad5:
                TextBoxTextoMacro.Text = Settings.Default.NumPad5;
                CheckBoxAll.IsChecked  = Settings.Default.NumPad5All;
                break;

            case Key.NumPad6:
                TextBoxTextoMacro.Text = Settings.Default.NumPad6;
                CheckBoxAll.IsChecked  = Settings.Default.NumPad6All;
                break;

            case Key.NumPad7:
                TextBoxTextoMacro.Text = Settings.Default.NumPad7;
                CheckBoxAll.IsChecked  = Settings.Default.NumPad7All;
                break;

            case Key.NumPad8:
                TextBoxTextoMacro.Text = Settings.Default.NumPad8;
                CheckBoxAll.IsChecked  = Settings.Default.NumPad8All;
                break;

            case Key.NumPad9:
                TextBoxTextoMacro.Text = Settings.Default.NumPad9;
                CheckBoxAll.IsChecked  = Settings.Default.NumPad9All;
                break;
            }
        }
        private void listener_OnKeyPressed(object sender, KeyPressedArgs e)
        {
            if (startPressed)
            {
                this.textBox_DisplayKeyboardInput.Text += e.KeyPressed.ToString();

                if (e.KeyPressed.ToString() == "H")
                {
                    username = Username.Text;
                    Console.WriteLine(username);
                    //Find the Window handle for INSIDE and Portal in order for us to only take screen
                    //captures of those windows and not just the screen.
                    /////////////////////////////////////////////////////////////////////////////////////
                    //current game string gets assigned when the user launches a game from the gui.
                    if (current_game == "INSIDE")
                    {
                        Process[] processes = Process.GetProcessesByName("INSIDE");

                        foreach (Process p in processes)
                        {
                            steamHandle = p.MainWindowHandle;
                            // do something with windowHandle
                        }
                    }
                    else if (current_game == "Portal")
                    {
                        Process[] processes = Process.GetProcessesByName("hl2");

                        foreach (Process p in processes)
                        {
                            steamHandle = p.MainWindowHandle;
                            // do something with windowHandle
                        }
                        System.Console.WriteLine("find portal" + processes.Length);
                    }

                    System.Console.WriteLine(current_game);
                    ////TODO if Process doesnt see INSIDE or Portal then the games are not
                    ////running therefore prompt the user to run the games.



                    //////////////////////////////////////////////////////////////////////////////////////
                    //var watch = System.Diagnostics.Stopwatch.StartNew();
                    // the code that you want to measure comes here
                    string text = DateTime.Now.ToString("MM'/'dd'/'yyyy HH':'mm':'ss.fff");
                    Console.WriteLine("Start Capture : " + text);

                    capture();//take the screenshot
                    sendAndReceive();
                    //watch.Stop();
                    //var elapsedMs = watch.ElapsedMilliseconds;
                    //Console.WriteLine("execution time: "+elapsedMs);
                }
                else if (e.KeyPressed.ToString() == "C")
                {
                    if (videoWindow != null && videoWindow.IsVisible)
                    {
                        System.Console.WriteLine("close video window!");
                        string text2 = DateTime.Now.ToString("MM'/'dd'/'yyyy HH':'mm':'ss.fff");
                        Console.WriteLine("finished : " + text2);
                        //videoWindow.Close();
                        videoWindow.Hide();
                    }
                }
                else if (e.KeyPressed.ToString() == "N")
                {
                    if (this.videoWindow != null && videoWindow.IsVisible)
                    {
                        if (this.VideoIndex != 0)
                        {
                            System.Console.WriteLine("before Call minus current video index number: " + this.VideoIndex);
                            this.VideoIndex--;

                            string label_video = this.videoList[this.VideoIndex];
                            System.Console.WriteLine("pressed N label+videoCode " + label_video);
                            int    idx   = label_video.LastIndexOf(' ');
                            string video = label_video.Substring(idx + 1);
                            this.videoCode = video;

                            string lastLabel = label_video.Substring(0, idx);
                            System.Console.WriteLine("current video index number: " + this.VideoIndex);
                            System.Console.WriteLine("LastLabel : " + lastLabel);
                            System.Console.WriteLine("this vieo code :" + video);
                            this.videoWindow.ResultLabel.Content = lastLabel;

                            this.videoWindow.ShowYouTubeVideo(this.videoCode);
                            this.videoWindow.Show();
                        }
                    }
                    skipBack();
                }
                else if (e.KeyPressed.ToString() == "M")
                {
                    if (this.videoWindow != null && videoWindow.IsVisible)
                    {
                        if (this.VideoIndex != this.videoList.Count - 1)
                        {
                            this.VideoIndex++;
                            string label_video = this.videoList[this.VideoIndex];
                            int    idx         = label_video.LastIndexOf(' ');
                            string video       = label_video.Substring(idx + 1);
                            string nextLabel   = label_video.Substring(0, idx);
                            this.videoWindow.ResultLabel.Content = nextLabel;
                            this.videoCode = video;
                            this.videoWindow.ShowYouTubeVideo(this.videoCode);
                            this.videoWindow.Show();
                        }
                    }
                    skipForward();
                }
            }
        }
        //  Função de execução da macro
        private static void ExecutarMacro(KeyPressedArgs teclaArgs)
        {
            //  <nmsg> = {ENTER}{ENTER}/all
            //  Hit or miss<nmsg>
            //  I guess they never miss, huh?<nmsg>
            //  You got a boyfriend, I bet he doesn't kiss ya<nmsg>
            //  He gon' find another girl and he won't miss ya<nmsg>
            //  He gon' skrrt and hit the dab like Wiz Khalifa

            //  Verificamos se a opção de rodar a macro só com o league aberto, está ativa
            if (Settings.Default.RLeague)
            {
                //  Se sim, verificamos se o league está aberto
                if (VerificarLeague() == false)
                {
                    //  Se o league não estiver aberto, retornamos da função
                    return;
                }
            }

            switch (teclaArgs.KeyPressed)
            {
            case Key.F1:
                Digitar(Settings.Default.F1All, Settings.Default.F1);
                break;

            case Key.F2:
                Digitar(Settings.Default.F2All, Settings.Default.F2);
                break;

            case Key.F3:
                Digitar(Settings.Default.F3All, Settings.Default.F3);
                break;

            case Key.F4:
                Digitar(Settings.Default.F4All, Settings.Default.F4);
                break;

            case Key.F5:
                Digitar(Settings.Default.F5All, Settings.Default.F5);
                break;

            case Key.F6:
                Digitar(Settings.Default.F6All, Settings.Default.F6);
                break;

            case Key.F7:
                Digitar(Settings.Default.F7All, Settings.Default.F7);
                break;

            case Key.F8:
                Digitar(Settings.Default.F8All, Settings.Default.F8);
                break;

            case Key.F9:
                Digitar(Settings.Default.F9All, Settings.Default.F9);
                break;

            case Key.F10:
                Digitar(Settings.Default.F10All, Settings.Default.F10);
                break;

            case Key.F11:
                Digitar(Settings.Default.F11All, Settings.Default.F11);
                break;

            case Key.F12:
                Digitar(Settings.Default.F12All, Settings.Default.F12);
                break;

            case Key.NumPad0:
                Digitar(Settings.Default.NumPad0All, Settings.Default.NumPad0);
                break;

            case Key.NumPad1:
                Digitar(Settings.Default.NumPad1All, Settings.Default.NumPad1);
                break;

            case Key.NumPad2:
                Digitar(Settings.Default.NumPad2All, Settings.Default.NumPad2);
                break;

            case Key.NumPad3:
                Digitar(Settings.Default.NumPad3All, Settings.Default.NumPad3);
                break;

            case Key.NumPad4:
                Digitar(Settings.Default.NumPad4All, Settings.Default.NumPad4);
                break;

            case Key.NumPad5:
                Digitar(Settings.Default.NumPad5All, Settings.Default.NumPad5);
                break;

            case Key.NumPad6:
                Digitar(Settings.Default.NumPad6All, Settings.Default.NumPad6);
                break;

            case Key.NumPad7:
                Digitar(Settings.Default.NumPad7All, Settings.Default.NumPad7);
                break;

            case Key.NumPad8:
                Digitar(Settings.Default.NumPad8All, Settings.Default.NumPad8);
                break;

            case Key.NumPad9:
                Digitar(Settings.Default.NumPad9All, Settings.Default.NumPad9);
                break;
            }
        }
 //  Evento tecla pressionada
 //  Passa para a execução
 private static void _listener_OnKeyPressed(object sender, KeyPressedArgs e)
 {
     ExecutarMacro(e);
 }
示例#13
0
 void _listener_OnKeyPressed(object sender, KeyPressedArgs e)
 {
     Dll.MessageKey.KeyShow.Show((System.Windows.Forms.Keys)KeyInterop.VirtualKeyFromKey(e.KeyPressed));
 }
示例#14
0
        void _playerTimer_Tick(object sender, System.EventArgs e)
        {
            if (_onPlayTracks.All(x => x.IsTrackEnd))
            {
                _playerTimer.Stop();
                Tact  = 0;
                State = PlayerState.Stopped;
                return;
            }

            foreach (var track in _onPlayTracks)
            {
                foreach (var note in track.PlayedNotes.Where(note => note.EndTact == _tact && note.EndPosition == _position).ToList())
                {
                    var keyArgs = new KeyPressedArgs()
                    {
                        IsPressed  = false,
                        KeyNumber  = note.MidiNumber,
                        Instrument = track.Instrument
                    };
                    _audioController.KeyIsPressedChanged(this, keyArgs);
                    track.PlayedNotes.Remove(note);
                }
            }

            foreach (var track in _onPlayTracks)
            {
                bool oneMoreTime;
                track.OneTimePlayNotes = new Queue <ToDoNote>();
                do
                {
                    oneMoreTime = false;
                    if (track.OnPlayNotes.Count <= 0)
                    {
                        continue;
                    }
                    if (track.OnPlayNotes.Peek().Tact == _tact && track.OnPlayNotes.Peek().Position == _position)
                    {
                        track.PlayedNotes.Add(track.OnPlayNotes.Peek());
                        track.OneTimePlayNotes.Enqueue(track.OnPlayNotes.Dequeue());
                        oneMoreTime = true;
                    }
                } while (oneMoreTime);

                foreach (var keyArgs in track.OneTimePlayNotes.Select(note => new KeyPressedArgs()
                {
                    IsPressed = true,
                    KeyNumber = note.MidiNumber,
                    Instrument = track.Instrument
                }))
                {
                    _audioController.KeyIsPressedChanged(this, keyArgs);
                }
            }

            _position++;
            if (_position != 16)
            {
                return;
            }
            _position = 0;
            Tact++;
        }
示例#15
0
        void _listener_OnKeyPressed(object sender, KeyPressedArgs e)
        {
            Debug.Print("Key je pressed " + e.KeyPressed.ToString());
            // ... Test for F5 key.
            if (e.KeyPressed.ToString() == Key.F5.ToString())
            {
                int str, str2, leftClickTimer, afkTimer, brojZavrsenihSekundi = 0, triggerAfkDonjiStr, triggerAfkGornjiStr, triggerAfkTimer,
                    afkTimerDonjiStr, afkTimerGornjiStr, holddownDonjiStr, holddownGornjiStr, holddownTimer;
                Random rnd              = new Random();
                Random triggerAfkRnd    = new Random();
                Random afkTimerRnd      = new Random();
                Random holddownTimerRnd = new Random();
                //vrijednosti iz xamla
                str  = Int32.Parse(intervalDonja.Text);
                str2 = Int32.Parse(intervalGornja.Text);
                triggerAfkDonjiStr  = Int32.Parse(triggerAfkDonji.Text);
                triggerAfkGornjiStr = Int32.Parse(triggerAfkGornji.Text);
                afkTimerDonjiStr    = Int32.Parse(afkTimerDonji.Text);
                afkTimerGornjiStr   = Int32.Parse(afkTimerGornji.Text);
                holddownDonjiStr    = Int32.Parse(holddownDonji.Text);
                holddownGornjiStr   = Int32.Parse(holddownGornji.Text);

                //random pocetna vrijednost za afk timer
                triggerAfkTimer = triggerAfkRnd.Next(triggerAfkDonjiStr, triggerAfkGornjiStr + 1);
                triggerAfkTimer = triggerAfkTimer * 60 * 1000;
                var ts = new CancellationTokenSource();
                if (!izvrsavaSe)
                {
                    tsOld = ts;
                }
                CancellationToken ct = tsOld.Token;
                if (!izvrsavaSe)
                {
                    task = Task.Run(async() =>
                    {
                        Debug.Print("Pocinje");
                        izvrsavaSe = true;
                        for (; ;)
                        {
                            holddownTimer = holddownTimerRnd.Next(holddownDonjiStr, holddownGornjiStr + 1);
                            //U slucaju da je proslo 10 min za trigger(recimo) hocu da mi dadne random vrijeme prije slj klika i resetuje random vrijeme cekanja
                            if (brojZavrsenihSekundi >= triggerAfkTimer)
                            {
                                brojZavrsenihSekundi = 0;
                                afkTimer             = afkTimerRnd.Next(afkTimerDonjiStr, afkTimerGornjiStr + 1);
                                triggerAfkTimer      = triggerAfkRnd.Next(triggerAfkDonjiStr, triggerAfkGornjiStr + 1);
                                triggerAfkTimer      = triggerAfkTimer * 60 * 1000;
                                //Debug.Print("Ceka"+afkTimer+"sekundi");
                                mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
                                await Task.Delay(holddownTimer);
                                mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
                                await Task.Delay(afkTimer * 1000);
                            }
                            leftClickTimer = rnd.Next(str, str2 + 1);
                            //Debug.Print("left click timer " + leftClickTimer);
                            brojZavrsenihSekundi += leftClickTimer;
                            await Task.Delay(leftClickTimer);
                            //Debug.Print("Hello World after" + leftClickTimer + "seconds");
                            mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
                            //Debug.Print("startan klik");
                            await Task.Delay(holddownTimer);
                            mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
                            //Debug.Print("endan klik");
                            //Debug.Print("ISpred cancelanja");
                            if (ct.IsCancellationRequested)
                            {
                                // another thread decided to cancel
                                //Console.WriteLine("task canceled");
                                break;
                            }
                        }
                    }, ct);
                }
                else
                {
                    izvrsavaSe = false;
                    //Thread.Sleep(3000);
                    Debug.Print("Zavrsi");
                    // Can't wait anymore => cancel this task
                    tsOld.Cancel();
                }
            }
        }
示例#16
0
        //KEYPRESS READING
        void _listener_OnKeyPressed(object sender, KeyPressedArgs e)
        {
            if (e.downPress)
            {
                lastKeyPressInterval = stopWatch.ElapsedMilliseconds;
                //IF idlePause ACTIVE
                if (idlePauseActive)
                {
                    idlePauseActive = false;
                    trayMenu.IdlePauseTimerText.Content = "Running";
                    stopWatch.Start();
                }
                if (!idlePauseActive)
                {
                    if (e.KeyPressed.Count != 0)
                    {
                        if (e.KeyPressed.Last() == Key.Return)
                        {
                            this.textBox_DisplayKeyboardInput.AppendText(Environment.NewLine);
                        }
                    }

                    if (e.KeyPressed.Count != 0)
                    {
                        if (e.KeyPressed.Last() == Key.Back)
                        {
                            //CTRL + BACKSPACE
                            if (e.Modifiers.Count != 0 && e.Modifiers.Last() == Key.LeftCtrl)
                            {
                                this.textBox_DisplayKeyboardInput.Text = textBox_DisplayKeyboardInput.Text.Substring(0, textBox_DisplayKeyboardInput.Text.Length - regex.Match(textBox_DisplayKeyboardInput.Text).Length);
                            }
                            //BACKSPACE ONLY
                            if (textBox_DisplayKeyboardInput.Text.Length >= 1)
                            {
                                this.textBox_DisplayKeyboardInput.Text = textBox_DisplayKeyboardInput.Text.Substring(0, textBox_DisplayKeyboardInput.Text.Length - 1);
                            }
                        }
                    }
                    //KEY AND NO MODIFIER
                    if (e.KeyPressed.Count != 0)
                    {
                        if (e.KeyPressed.Last() != Key.Back && e.KeyPressed.Last() != Key.Return && e.KeyPressed.Last() != Key.F2)
                        {
                            if (operations.ContainsKey(e.KeyPressed.Last()))
                            {
                                if (operationsShift.ContainsKey(e.KeyPressed.Last()) && e.Modifiers.Count != 0)
                                {
                                }
                                else
                                {
                                    this.textBox_DisplayKeyboardInput.Text += operations[e.KeyPressed.Last()];
                                }
                            }
                            else
                            {
                                if (e.Modifiers.Count != 0)
                                {
                                    if (!e.lastKeyisModifier && (e.Modifiers.Last() == Key.LeftShift || e.Modifiers.Last() == Key.RightShift))
                                    {
                                        this.textBox_DisplayKeyboardInput.Text += e.KeyPressed.Last().ToString();
                                    }
                                }
                                else
                                {
                                    this.textBox_DisplayKeyboardInput.Text += e.KeyPressed.Last().ToString().ToLower();
                                }
                            }
                        }
                        if (e.KeyPressed.Last() == Key.F2)
                        {
                            stopReading();
                        }
                    }
                    //MODIFIER KEY PLUS KEY
                    if (e.KeyPressed.Count != 0 && e.Modifiers.Count != 0)
                    {
                        if (e.KeyPressed.Last() != Key.Back && e.KeyPressed.Last() != Key.Return)
                        {
                            if (operationsShift.ContainsKey(e.KeyPressed.Last()))
                            {
                                {
                                    this.textBox_DisplayKeyboardInput.Text += operationsShift[e.KeyPressed.Last()];
                                    if (e.Modifiers.Last() == (Key.LeftAlt | Key.RightAlt))
                                    {
                                        e.KeyPressed.Clear();
                                    }
                                }
                            }
                        }
                    }

                    //TRAYMENU READING
                    inputSize = textBox_DisplayKeyboardInput.Text.Length;

                    if (inputSize / 5 != 0)
                    {
                        wpm = (inputSize / 5) * (60f / (stopWatch.ElapsedMilliseconds / 1000f));
                        trayMenu.WPMLabel.Content          = Math.Round(wpm, MidpointRounding.AwayFromZero);
                        trayMenu.WordLabel.Content         = textBox_DisplayKeyboardInput.Text.Length / 5;
                        ClockTextBlock.Visibility          = Visibility.Visible;
                        trayMenu.ClockTextBlock.Visibility = Visibility.Visible;
                    }

                    //VALIDATE
                    if (usingWordAmount)
                    {
                        if (inputSize / 5 >= wordAmount)
                        {
                            this.stopReading();
                            isFinished = true;
                            this.StartButton.IsEnabled = false;
                        }
                    }
                }
            }
        }