int IndexOfCursorLocationSetter(string cls_str, int default_index = -1) { if (CursorLocationSettersDict.ContainsKey(cls_str)) { ICursorLocationSetter cls = CursorLocationSettersDict[cls_str]; return(Array.IndexOf(CursorLocationSetters, cls)); } else { return(default_index); } }
public MouseActionPerformer(int PollingRate = PollingRateDefault, ICursorLocationSetter cursor_loc_setter = null, ScreenColorDetector screen_color_detector = null) { this.PollingRate = PollingRate; // this also sets PollingPeriod this.Polled = true; this.CursorLocationSetter = cursor_loc_setter ?? new MouseEventCursorLocationSetter(); this.ScreenColorDetector = screen_color_detector ?? new ScreenColorDetector(); LeftButton = new Button(Button.LeftDownCode, Button.LeftUpCode, this); RightButton = new Button(Button.RightDownCode, Button.RightUpCode, this); MiddleButton = new Button(Button.MiddleDownCode, Button.MiddleUpCode, this); }
private void MouseFunctionComboBox_SelectedIndexChanged(object sender, EventArgs e) { // set all mouse movers' movement functions to the new selected one. if (MouseFunctionComboBox.SelectedValue != null) { ICursorLocationSetter move_func = (ICursorLocationSetter)MouseFunctionComboBox.SelectedValue; // apply this mouse_func to all of the mouse movers foreach (MouseActionPerformer mouse_mover in MouseMovers.Values) { mouse_mover.CursorLocationSetter = move_func; } } else { MessageBox.Show("Invalid Mouse Function selection"); } }