private void OnClick(object sender, RoutedEventArgs e) { var color = //Color.FromArgb(0x43, 0x88, 0xFA, 0xEE); //Colors.Red; Color.FromArgb(0x12, 0x34, 0x56, 0x78); var peer = new ColorBoardAutomationPeer(ColorBoard); var hSlider = ColorBoard.FindVisualDescendantByName("PART_HSVSlider") as Slider; var aSlider = ColorBoard.FindVisualDescendantByName("PART_ASlider") as Slider; var rect = ColorBoard.FindVisualDescendantByName("PART_HSVRectangle") is not Rectangle hsvRect; var colorPosition = peer.GetColorPoint(color); // hsvRect.RaiseEvent(new RoutedEventArgs(MouseDoubleClickEvent, rect)); var boundingRect = peer.GetHsvCanvasBoundingRect(); var absoluteColorPosition = new Point(boundingRect.X + colorPosition.X, boundingRect.Y + colorPosition.Y); //LeftMouseClick((int)absoluteColorPosition.X, (int)absoluteColorPosition.Y); MouseInput.MoveTo(absoluteColorPosition); MouseInput.Click(); hSlider.Value = ColorHelper.GetHSV_H(color); //Thread.Sleep(2000); aSlider.Value = color.A; //ColorBoard.SetHsvColor(Color.FromArgb(0x12, 0x34, 0x56, 0x78)); }
public override void SetFocus() { if (SystemUnderTestHandle != IntPtr.Zero) { MouseInput.Click(SystemUnderTestHandle, false, 100, 1); } }
private void ClickButton(string buttonAutomationId) { AutomationElement automationElement = RootElement.FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.AutomationIdProperty, buttonAutomationId)); Assert.IsNotNull(automationElement, buttonAutomationId); MouseInput.Click(automationElement); }
public void SetColor(Color color) { var colorPosition = (Point)Access.Execute(nameof(ColorBoardAutomationPeer.GetColorPoint), color); var boundingRect = BoundingRectangle; var absoluteColorPosition = new Point(boundingRect.X + colorPosition.X, boundingRect.Y + colorPosition.Y); MouseInput.MoveTo(absoluteColorPosition); MouseInput.Click(); }
public void HandleInput(PerspectiveCamera camera, KeyboardInput keyboard, MouseInput mouse) { if (mouse.JustPressed(MouseButtons.Left)) { this.selecting = true; this.SelectionSystem.StartSelection(camera, mouse.Position); Debug.WriteLine("Selection started"); } else if (this.selecting && !mouse.Hold(MouseButtons.Left)) { this.selecting = false; var selected = new List <Entity>(); this.SelectionSystem.EndSelection(camera, mouse.Position, selected); foreach (var entity in selected) { Debug.WriteLine($"Selected {entity}"); this.selectedFighter = this.fighters.IndexOf(entity); } Debug.WriteLine("Selection finished"); } if (mouse.Click(MouseButtons.Right)) { var mouseWorldPosition = camera.Pick(mouse.Position, 0.0f); if (mouseWorldPosition.HasValue && this.selectedFighter < this.fighters.Count) { var entity = this.fighters[this.selectedFighter]; if (this.FlightPlans.TryGet(entity, out var flightPlan)) { var finalManeuver = (LerpManeuver)flightPlan.Maneuvers.Last(); ManeuverPlanner.PlanMoveTo(flightPlan.Maneuvers, finalManeuver.TargetPosition, finalManeuver.TargetYaw, finalManeuver.TargetPitch, mouseWorldPosition.Value, this.linearAcceleration, this.angularAcceleration); } else { var pose = this.Containers.Get <ComponentContainer <Pose> >().Get(entity); var maneuvers = new Queue <IManeuver>(); ManeuverPlanner.PlanMoveTo(maneuvers, pose.Position, pose.Yaw, pose.Pitch, mouseWorldPosition.Value, this.linearAcceleration, this.angularAcceleration); this.Factories.Get <FlightPlanFactory>().Construct(entity, maneuvers); } } } }