void ClickOnGrid(DevExpress.Xpf.Grid.GridControl grid) { MouseActions.LeftMouseDown(grid.View, 2, 2); MouseActions.LeftMouseUp(grid.View, 2, 2); }
private static void DissmissMissingSoldiers() { StopSoldierDismiss = false; if (StopSoldierDismiss == false && CheckforTruppkameradenliste() == 1) { if (Keyboard.IsKeyDown(Key.LeftCtrl) && Keyboard.IsKeyDown(Key.LeftAlt) && (Keyboard.IsKeyDown(Key.NumPad0) || Keyboard.IsKeyDown(Key.D0))) { log.Debug("Dismissing Soldiers interrupted by user at: CheckforTruppkameradenliste"); StopSoldierDismiss = true; return; } MouseActions.SingleClickAtPosition(-122, 925); //open Filtermenu if (StopSoldierDismiss == false && CheckforFilterScreen() == 1) { MouseActions.SingleClickAtPosition(-742, 218); //nicht verfügbar MainWindow.Sleep(250); MouseActions.SingleClickAtPosition(-551, 611); // activate 1* MainWindow.Sleep(250); MouseActions.SingleClickAtPosition(-446, 612); // activate 2* MainWindow.Sleep(250); MouseActions.SingleClickAtPosition(-1738, 209); // Close FilterScreen MainWindow.Sleep(350); int AmountOfLoops = 0; while (AmountOfLoops++ < 20) { if (AmountOfLoops > 1) { MainWindow.Sleep(300); //time required for SF to reorder soldiers after dissmissing one. Not needet in First round. } if (Keyboard.IsKeyDown(Key.LeftCtrl) && Keyboard.IsKeyDown(Key.LeftAlt) && (Keyboard.IsKeyDown(Key.NumPad0) || Keyboard.IsKeyDown(Key.D0))) { log.Debug("Dismissing Soldiers interrupted by user at: CheckforTruppkameradenliste"); StopSoldierDismiss = true; return; } string[] ImageLocation = ImgSearch.UseImageSearch(MainWindow.ResourcesPath + "berger.png", "140", -1920, 748, 1920, 890); if (StopSoldierDismiss == false && ImageLocation != null && ImageLocation.Length > 0) { int.TryParse(ImageLocation[1], out int x); int.TryParse(ImageLocation[2], out int y); MouseActions.SingleClickAtPosition(x - 100, y - 200); //upperleft corner of picture (which is in the "Bergung" Button) -> to middle of soldier screen if (CheckforSoldierDissmissScreen() == 1) { MainWindow.Sleep(100); MouseActions.SingleClickAtPosition(-1834, 997); // Dissmiss Soldier if (CheckforAcceptDissmissScreen() == 1) { MainWindow.Sleep(100); MouseActions.SingleClickAtPosition(-421, 811); //"Accept" Dismiss Button if (StopSoldierDismiss == false && CheckforTruppkameradenliste() == 1) { } else { StopSoldierDismiss = true; return; } } else { StopSoldierDismiss = true; return; } } else { StopSoldierDismiss = true; return; } } else if (StopSoldierDismiss == false && ImageLocation == null) { //scroll 3boosters int i = 0; while (StopSoldierDismiss == false && i < 3) { if (Keyboard.IsKeyDown(Key.LeftCtrl) && Keyboard.IsKeyDown(Key.LeftAlt) && (Keyboard.IsKeyDown(Key.NumPad0) || Keyboard.IsKeyDown(Key.D0))) { log.Debug("Dismissing Soldiers interrupted by user at: CheckforTruppkameradenliste"); StopSoldierDismiss = true; return; } int moveToX = 0; if (MainWindow.CurrentHostName == "VMgr4ndpa" || MainWindow.CurrentHostName == "VMgr4ndpaClone") { MouseActions.SetCursorPos(1868, 484); moveToX = 1715; MouseActions.LeftMouseDown(); while (moveToX > 48 && StopSoldierDismiss == false) { if (Keyboard.IsKeyDown(Key.LeftCtrl) && Keyboard.IsKeyDown(Key.LeftAlt) && (Keyboard.IsKeyDown(Key.NumPad0) || Keyboard.IsKeyDown(Key.D0))) { log.Debug("AutoMission interrupted by user at: selecting Booster"); StopSoldierDismiss = true; return; } moveToX -= 90; MouseActions.SetCursorPos(moveToX, 484); MainWindow.Sleep(34); } } else { MouseActions.SetCursorPos(-52, 557); moveToX = -215; MouseActions.LeftMouseDown(); while (moveToX > -1872 && StopSoldierDismiss == false) { if (Keyboard.IsKeyDown(Key.LeftCtrl) && Keyboard.IsKeyDown(Key.LeftAlt) && (Keyboard.IsKeyDown(Key.NumPad0) || Keyboard.IsKeyDown(Key.D0))) { log.Debug("AutoMission interrupted by user at: selecting Booster"); StopSoldierDismiss = true; return; } moveToX -= 90; MouseActions.SetCursorPos(moveToX, 484); MainWindow.Sleep(34); } } MainWindow.Sleep(150); MouseActions.LeftMouseUp(); i++; if (StopSoldierDismiss == false && ImgSearch.UseImageSearch(MainWindow.ResourcesPath + "berger.png", "140", -1920, 748, 1920, 890) != null) { break; } else if (StopSoldierDismiss == true) { return; } } } else if (StopSoldierDismiss == true) { return; } } log.Debug("Loops finished."); StopSoldierDismiss = true; return; } else { StopSoldierDismiss = true; return; } } else { StopSoldierDismiss = true; return; } }
void CreateCheckHitTestDemoActions() { AddLoadModuleActions(typeof(GridDemo.HitTesting)); AddSimpleAction(delegate() { Assert.IsTrue(HitTestModule.showHitInfoCheckEdit.IsChecked.Value); Assert.AreEqual(0, HitTestModule.viewsListBox.SelectedIndex); Assert.AreEqual(GridControl, HitTestModule.hitInfoPopup.PlacementTarget); Assert.AreEqual(PlacementMode.Mouse, HitTestModule.hitInfoPopup.Placement); MouseActions.MouseMove(GridControl, -5, -5); Assert.IsFalse(HitTestModule.hitInfoPopup.IsOpen); MouseActions.MouseMove(GridControl, 5, 5); Assert.IsTrue(HitTestModule.hitInfoPopup.IsOpen); Assert.AreEqual(0d, HitTestModule.hitInfoPopup.HorizontalOffset); Assert.AreEqual(0d, HitTestModule.hitInfoPopup.VerticalOffset); EditorsActions.ToggleCheckEdit(HitTestModule.showHitInfoCheckEdit); Assert.IsFalse(HitTestModule.hitInfoPopup.IsOpen); EditorsActions.ToggleCheckEdit(HitTestModule.showHitInfoCheckEdit); Assert.IsTrue(HitTestModule.hitInfoPopup.IsOpen); MouseActions.LeftMouseDown(GridControlHelper.GetColumnHeaderElements(GridControl, GridControl.Columns[0])[0], 5, 5); MouseActions.MouseMove(GridControlHelper.GetColumnHeaderElements(GridControl, GridControl.Columns[0])[0], 25, 5); Assert.IsFalse(HitTestModule.hitInfoPopup.IsOpen); MouseActions.LeftMouseUp(GridControlHelper.GetColumnHeaderElements(GridControl, GridControl.Columns[0])[0], 5, 5); Assert.IsTrue(HitTestModule.hitInfoPopup.IsOpen); TableView.ShowColumnChooser(); UpdateLayoutAndDoEvents(); Assert.IsFalse(HitTestModule.hitInfoPopup.IsOpen); TableView.HideColumnChooser(); UpdateLayoutAndDoEvents(); Assert.IsTrue(HitTestModule.hitInfoPopup.IsOpen); Assert.AreEqual(4, HitTestModule.hitIfoItemsControl.Items.Count); Assert.AreEqual("HitTest", GetHitInfoNameTextControl(0).NameValue); Assert.AreEqual("ColumnHeader", GetHitInfoNameTextControl(0).TextValue); Assert.AreEqual("Column", GetHitInfoNameTextControl(1).NameValue); Assert.AreEqual("ID", GetHitInfoNameTextControl(1).TextValue); Assert.AreEqual("RowHandle", GetHitInfoNameTextControl(2).NameValue); Assert.AreEqual("No row", GetHitInfoNameTextControl(2).TextValue); Assert.AreEqual("CellValue", GetHitInfoNameTextControl(3).NameValue); Assert.AreEqual("", GetHitInfoNameTextControl(3).TextValue); MouseActions.MouseMove(LayoutHelper.FindElementByName(GridControl, "PART_NewItemRow"), 35, 5); Assert.AreEqual(4, HitTestModule.hitIfoItemsControl.Items.Count); Assert.AreEqual("New Item Row", GetHitInfoNameTextControl(2).TextValue); MouseActions.MouseMove(LayoutHelper.FindElementByName(GridControl, "PART_FilterRow"), 35, 5); Assert.AreEqual(4, HitTestModule.hitIfoItemsControl.Items.Count); Assert.AreEqual("Auto Filter Row", GetHitInfoNameTextControl(2).TextValue); MouseActions.MouseMove(View.GetCellElementByRowHandleAndColumn(0, GridControl.Columns[0]), 35, 5); Assert.AreEqual(4, HitTestModule.hitIfoItemsControl.Items.Count); Assert.AreEqual("0 (data row)", GetHitInfoNameTextControl(2).TextValue); Assert.AreEqual("10248", GetHitInfoNameTextControl(3).TextValue); AssertAdditionalElements(); MouseActions.MouseMove(LayoutHelper.FindElement(LayoutHelper.FindElement(GridControl, IsGroupGridRow), e => e is DevExpress.Xpf.Grid.GroupRowIndicator), 5, 5); Assert.AreEqual(5, HitTestModule.hitIfoItemsControl.Items.Count); Assert.AreEqual("RowIndicatorState", GetHitInfoNameTextControl(4).NameValue); Assert.AreEqual("Focused", GetHitInfoNameTextControl(4).TextValue); HitTestModule.viewsListBox.SelectedIndex = 1; CardView.CardLayout = DevExpress.Xpf.Grid.CardLayout.Rows; UpdateLayoutAndDoEvents(); Assert.IsNotNull(CardView); AssertAdditionalElements(); }); }