private void Button_Create_Click(object sender, RoutedEventArgs e) { int x = Convert.ToInt32(Label_X_Value.Content); int y = Convert.ToInt32(Label_Y_Value.Content); int delay; bool leftClick; try { delay = Convert.ToInt32(TextBox_Delay.Text); } catch { delay = 0; } if ((bool)RadioButton_Leftclick.IsChecked) { leftClick = true; } else { leftClick = false; } MouseBotAction mouseBotAction = new MouseBotAction(x, y, leftClick, delay); MainWindow.AddBotAction(mouseBotAction); MainWindow.RefreshListBox(); this.Close(); }
private void Button_Start_Click(object sender, RoutedEventArgs e) { this.Hide(); if (actions.Count >= 1) { Thread.Sleep(delay); for (int l = 0; l <= loops; l++) { for (int i = 0; i <= actions.Count - 1; i++) { if (actions[i] is MouseBotAction) { MouseBotAction mouseBotAction = (MouseBotAction)actions[i]; int x = mouseBotAction.x; int y = mouseBotAction.y; if (mouseBotAction.leftClick) { LeftMouseClick(x, y); } else { RightMouseClick(x, y); } } else if (actions[i] is KeyBoardBotAction) { KeyBoardBotAction keyBoardBotAction = (KeyBoardBotAction)actions[i]; InputSimulator inputSimulator = new InputSimulator(); inputSimulator.Keyboard.TextEntry(keyBoardBotAction.text); } Thread.Sleep(actions[i].delay); } } } this.Show(); }
public MouseBotActionSettings(MouseBotAction mouseBotAction, int Index) { InitializeComponent(); Label_X_Value.Content = mouseBotAction.x; Label_Y_Value.Content = mouseBotAction.y; if (mouseBotAction.leftClick) { RadioButton_Leftclick.IsChecked = true; } else { RadioButton_Rightclick.IsChecked = true; } TextBox_Delay.Text = mouseBotAction.delay.ToString(); Button_Close.Click += (s, e) => Close(); Button_Minimize.Click += (s, e) => WindowState = WindowState.Minimized; }