private void HookManager_KeyPress(object sender, KeyPressEventArgs e) { string tActiveWindowTitle = GetActiveWindowTitle(); //int tValue = ReturnMatchedKeyCode(e.KeyValue.ToString()); KeysConverter tConverter = new KeysConverter(); string tKey = tConverter.ConvertToString(e.KeyChar); int tValue = ReturnMatchedKeyCode(tKey); if (tValue == tBetScreenKey) { e.Handled = true; HookManager.KeyPress -= new KeyPressEventHandler(HookManager_KeyPress); tBetScreen = new NewBet(); tBetScreen.TopMost = true; tBetScreen.FormClosed += new FormClosedEventHandler(tBetScreen_FormClosed); tBetScreen.tX = tBetX; tBetScreen.tY = tBetY; tBetScreen.Show(); } if (tValue == tScreenshotKey) { e.Handled = true; ScreenShot(); } if (tValue == tSaveKey) { e.Handled = true; InsertRow(tCurrentName1, tCurrentName2, tCurrentBet, tWorksheetFeed); SubmitCommission(); } if (tActiveWindowTitle.Contains("RuneScape")) { if (tAutoTyperDictionary.ContainsKey(tValue)) { e.Handled = true; tCurrentAutotypeKey = tValue; //if (AutotypeThread != null) //{ // AutotypeThread.Abort(); //} //AutotypeThread = new Thread(new ThreadStart(AutoType)); //AutotypeThread.Start(); AutoType(); } } if (tValue != tBetScreenKey && tValue != tScreenshotKey && tValue != tSaveKey) { return; } e.Handled = true; }
private void HookManager_KeyPress(object sender, KeyPressEventArgs e) { string tActiveWindowTitle = GetActiveWindowTitle(); //int tValue = ReturnMatchedKeyCode(e.KeyValue.ToString()); KeysConverter tConverter = new KeysConverter(); string tKey = tConverter.ConvertToString(e.KeyChar); int tValue = ReturnMatchedKeyCode(tKey); if (tValue == tBetScreenKey) { e.Handled = true; HookManager.KeyPress -= new KeyPressEventHandler(HookManager_KeyPress); tBetScreen = new NewBet(); tBetScreen.TopMost = true; tBetScreen.FormClosed += new FormClosedEventHandler(tBetScreen_FormClosed); tBetScreen.tX = tBetX; tBetScreen.tY = tBetY; tBetScreen.Show(); } if (tValue == tScreenshotKey) { e.Handled = true; ScreenShot(); } if (tValue == tSaveKey) { e.Handled = true; InsertRow(tCurrentName1, tCurrentName2, tCurrentBet, tWorksheetFeed); SubmitCommission(); } if (tActiveWindowTitle.Contains("RuneScape")) { if (tAutoTyperDictionary.ContainsKey(tValue)) { e.Handled = true; tCurrentAutotypeKey = tValue; //if (AutotypeThread != null) //{ // AutotypeThread.Abort(); //} //AutotypeThread = new Thread(new ThreadStart(AutoType)); //AutotypeThread.Start(); AutoType(); } } if (tValue != tBetScreenKey && tValue != tScreenshotKey && tValue != tSaveKey) return; e.Handled = true; }