public static void ClickProbe(int n) { if (n < 1) { throw new ArgumentOutOfRangeException("Menu items' index start at 1"); } int xMul = (n - 1) % 3; bool yAdd = (int)((n - 1) / 3) >= 1; int x = 100 + 250 * xMul; int y = 100 + (yAdd ? 150 : 0); String menu = WebHandling.GetMenuNumber(); SecureClick(x, y); for (int i = 0; i < 100; i++) { Thread.Sleep(50); if (!menu.Equals(WebHandling.GetMenuNumber())) { break; } } if (menu.Equals(WebHandling.GetMenuNumber())) { throw new Exception("Menu has not changed!"); } }
public static void ClickMenuItem(int n) { if (n < 1) { throw new ArgumentOutOfRangeException("Menu items' index start at 1"); } int x = 200; int y = 140 + 65 * (n - 1); SecureClick(x, y); String menu = WebHandling.GetMenuNumber(); for (int i = 0; i < 100; i++) { Thread.Sleep(50); if (!menu.Equals(WebHandling.GetMenuNumber())) { break; } } if (menu.Equals(WebHandling.GetMenuNumber())) { throw new Exception("Menu has not changed!"); } }