/// <summary> /// Initializes a new instance of the <see cref="DeviceCareProcessFunctions"/> class. /// </summary> public DeviceCareProcessFunctions() { this.drives = null; this.driveList = new List <string>(); this.pathFragments = new List <string>(); this.repo = GUI.DeviceCareApplication.Instance; }
/// <summary> /// The run. /// </summary> /// <param name="functionToSelect"> /// The function to select. /// </param> /// <returns> /// The <see cref="bool"/>. /// </returns> public bool Run(string functionToSelect) { GUI.DeviceCareApplication deviceCareApplication = GUI.DeviceCareApplication.Instance; RepoItemInfo repo = deviceCareApplication.ApplicationArea.ModuleSelection.TabPagesInfo; System.Collections.Generic.IList <TabPage> tabPages; tabPages = Host.Local.Find <TabPage>(repo.AbsolutePath, DefaultValues.GeneralTimeout); foreach (var tabPage in tabPages) { Text text = tabPage.FindDescendant <Text>(); if (text.TextValue.Equals(functionToSelect)) { tabPage.MoveTo(); tabPage.Click(); } } //string modifiedPath = repo.AbsolutePath.ToString(); //modifiedPath = modifiedPath.Replace("MODULENAME", functionToSelect); //TabPage tabPage; //Host.Local.TryFindSingle((RxPath)modifiedPath, DefaultValues.GeneralTimeout, out tabPage); //if (tabPage != null && tabPage.HasFocus == false) //{ // tabPage.Focus(); //} return(false); }
/// <summary> /// The is host application open. /// </summary> /// <param name="processName"> /// The process Name. /// </param> /// <returns> /// The <see cref="bool"/>. /// </returns> public static bool IsHostApplicationOpen(string processName = ProcessName) { Log.Enter(typeof(HostApplication), MethodBase.GetCurrentMethod().Name); GUI.DeviceCareApplication deviceCareApplication = GUI.DeviceCareApplication.Instance; Ranorex.Core.Repository.RepoItemInfo repoItemInfo = deviceCareApplication.MenuArea.MainMenu.MainMenuItems.ButtonExitInfo; Process[] processes = Process.GetProcesses(); foreach (var process in processes) { if (process.ProcessName.Equals(processName)) { if (repoItemInfo.Exists()) { Common.Tools.Log.Debug("Device Care is running."); return(true); } } } Common.Tools.Log.Debug("Device Care is not running."); return(false); }