private void ProfilesImExSwitch(ATElementStruct whichProfile, AT profileTmp, AT loadingTmp, string whereToClick, bool isAimpad = false) { profileTmp = SwMainWindow.GetElement(whichProfile); profileTmp.DoClickPoint(); WaitForEvent(profileTmp, loadingTmp, isAimpad); profileTmp = SwMainWindow.GetElement(whichProfile); if (whereToClick.Equals("EXPORT")) { profileTmp.GetElement(PortalObj.Profile_EXPORT).DoClickPoint(); var dialog = SwMainWindow.GetElement(PortalObj.Window_OpenFIle, treeScope: ATElement.TreeScope.Children, timeout: 5); var buttonSave = dialog.GetElement(PortalObj.Button_Save, treeScope: ATElement.TreeScope.Children, timeout: 1); buttonSave.DoClickPoint(); try { dialog.GetElement(aTElementStruct: PortalObj.Button_Exist_Yes, treeScope: ATElement.TreeScope.Descendants, timeout: 1).DoClickPoint(); } catch (Exception) { // ignored } WaitForEvent(profileTmp, loadingTmp, isAimpad); } else if (whereToClick.Equals("IMPORT")) { profileTmp.GetElement(PortalObj.Profile_IMPORT).DoClickPoint(); var dialog = SwMainWindow.GetElement(PortalObj.Window_OpenFIle, treeScope: ATElement.TreeScope.Children, timeout: 5); dialog = dialog.GetElement(PortalObj.Button_Save, treeScope: ATElement.TreeScope.Children, timeout: 1); dialog.DoClickPoint(); WaitForEvent(profileTmp, loadingTmp, isAimpad); } }
private void WaitForLoadingOrReconnecting(AT profileTmp, AT loadingTmp) { if (UtilOs.GetOsVersion().Contains(UtilOs.Name.Win10)) { UtilTime.WaitTime(3); } else { UtilTime.WaitTime(3); } try { profileTmp = SwMainWindow.GetElement(aTElementStruct: PortalObj.Profile_1, treeScope: ATElement.TreeScope.Descendants, returnNullWhenException: true); if (profileTmp == null) { SwMainWindow.GetElement(aTElementStruct: PortalObj.TabItem_PROFILES, treeScope: ATElement.TreeScope.Descendants).DoClickPoint(); return; } do { loadingTmp = SwMainWindow.GetElement(aTElementStruct: PortalObj.Lable_LOADING, treeScope: ATElement.TreeScope.Descendants, returnNullWhenException: true); } while (loadingTmp != null); } catch (Exception) { // ignored } }
public void ProfilesSimpleSwitch(long testTimes) { var TabItem_Profiles = SwMainWindow.GetElement(aTElementStruct: PortalObj.TabItem_PROFILES, treeScope: ATElement.TreeScope.Descendants); TabItem_Profiles.DoClickPoint(1);//"DoClick();" does not work for (int i = 1; i < testTimes; i++) { WriteConsoleTitle(i, $"Starting to simple switch. ({Timeout}s)", Timeout); ProfilesSimpleSwitch(PortalObj.Profile_1, null, null); ProfilesSimpleSwitch(PortalObj.Profile_2, null, null); ProfilesSimpleSwitch(PortalObj.Profile_3, null, null); ProfilesSimpleSwitch(PortalObj.Profile_4, null, null); } }
private void WaitForLoading(AT loadingTmp) { UtilTime.WaitTime(2); try { while (true) { loadingTmp = SwMainWindow.GetElement(aTElementStruct: PortalObj.Lable_LOADING, treeScope: ATElement.TreeScope.Descendants); } } catch (Exception) { // ignored } }
public void ProfilesImExSwitch(long testTimes) { var tabItemProfiles = SwMainWindow.GetElement(PortalObj.TabItem_PROFILES); tabItemProfiles.DoClickPoint();//"DoClick();" does not work UtilTime.WaitTime(2); for (var i = 1; i < testTimes; i++) { WriteConsoleTitle(i, $"Starting to Import Export switch. ({Timeout}s)", Timeout); ProfilesImExSwitch(PortalObj.Profile_2, null, null, "EXPORT"); ProfilesImExSwitch(PortalObj.Profile_1, null, null, "IMPORT"); ProfilesImExSwitch(PortalObj.Profile_1, null, null, ""); ProfilesImExSwitch(PortalObj.Profile_2, null, null, ""); ProfilesImExSwitch(PortalObj.Profile_3, null, null, ""); ProfilesImExSwitch(PortalObj.Profile_4, null, null, ""); } }
public void ProfilesImExAimpadSwitch(long testTimes) { var TabItem_Profiles = SwMainWindow.GetElement(PortalObj.TabItem_PROFILES); TabItem_Profiles.DoClickPoint(); UtilTime.WaitTime(2); for (var i = 1; i < testTimes; i++) { WriteConsoleTitle(i, $"Starting to Import Export switch (Support Aimpad Mode). ({Timeout}s)", Timeout); ProfilesImExSwitch(PortalObj.Profile_2, null, null, "EXPORT", true); ProfilesImExSwitch(PortalObj.Profile_1, null, null, "IMPORT", true); ProfilesImExSwitch(PortalObj.Profile_1, null, null, "", true); ProfilesImExSwitch(PortalObj.Profile_2, null, null, "", true); ProfilesImExSwitch(PortalObj.Profile_3, null, null, "", true); ProfilesImExSwitch(PortalObj.Profile_4, null, null, "", true); } }
public void CloseSw() { var buttonClose = SwMainWindow.GetElement(name: Obj.ButtonCloseMainWindow, controlType: ATElement.ControlType.Button, treeScope: ATElement.TreeScope.Descendants); buttonClose.DoClick(); Timeout = 2; WriteConsoleTitle(LaunchTimes, $"Waiting for closing1. ({Timeout}s)", Timeout); UtilTime.WaitTime(Timeout); try { WriteConsoleTitle(LaunchTimes, $"Waiting for closing2. ({Timeout}s)", Timeout); buttonClose = SwMainWindow.GetElement(name: Obj.ButtonCloseMainWindow, controlType: ATElement.ControlType.Button, treeScope: ATElement.TreeScope.Descendants); //button_Close.DoClickWithNewThread(); buttonClose.DoClickPoint();//Don't know why sometimes "button_Close.DoClick();" does not work UtilTime.WaitTime(Timeout); } catch (Exception) { // ignored } }
private void ProfilesSimpleSwitch(ATElementStruct whichProfile, AT profileTmp, AT loadingTmp) { profileTmp = SwMainWindow.GetElement(whichProfile); profileTmp.DoClickPoint(); WaitForLoading(loadingTmp); }