Class Util
Provides common utility methods.
public class Util
- Inheritance
-
Util
- Inherited Members
Constructors
Util()
public Util()
Properties
IsRestartRequiredForWinAppAccess
Gets a value indicating whether a restart is required to access Windows apps.
public static bool IsRestartRequiredForWinAppAccess { get; }
Property Value
Examples
The following code checks for the privileges to access Windows apps and restarts the executable in order to get those privileges:
if (Ranorex.Core.Util.IsRestartRequiredForWinAppAccess)
return Ranorex.Core.Util.RestartWithUiAccess();
Remarks
If this property returns true, the current process does not have
the required privileges to access Windows apps. You can get the those privileges
by calling the RestartWithUiAccess() method like in the example below.
Methods
GetApplicationOpenForms()
Gets the open forms of the application.
public static IList<Form> GetApplicationOpenForms()
Returns
Remarks
This method is a wrapper for the OpenForms property.
GetCodeModuleCSharpReplayTemplate()
Gets the CSharp code module replay template.
public static string GetCodeModuleCSharpReplayTemplate()
Returns
- string
The CSharp code module replay template.
GetCodeModuleVBReplayTemplate()
Gets the VB.NET code module replay template.
public static string GetCodeModuleVBReplayTemplate()
Returns
- string
The VB.NET code module replay template.
GetStaticAndDynamicCapabilities(Element)
Gets the static and dynamic capabilities of an element.
public static List<Capability> GetStaticAndDynamicCapabilities(Element element)
Parameters
elementElementAn element.
Returns
- List<Capability>
A List<T> containing all static and the dynamic capabilities of the
element.
HasTopMostForm()
Determines whether the current application has a form with the TopMost
property set to true.
public static bool HasTopMostForm()
Returns
RestartWithUiAccess()
Restarts the current executable with UI access privileges. Those privileges are required to access Windows apps.
public static int RestartWithUiAccess()
Returns
- int
The exit code returned by the current executable.
Examples
The following code checks for the privileges to access Windows apps and restarts the executable in order to get those privileges:
if (Ranorex.Core.Util.IsRestartRequiredForWinAppAccess)
return Ranorex.Core.Util.RestartWithUiAccess();
Remarks
If the current process does not have UI access privileges, you can call this method to restart the current executable with UI privileges. The executable will be restarted using the Ranorex.UiaLauncher which thereby provides the required privileges to e.g. access Windows apps.
StartRanorexInstrumentationWizard(string, IDictionary<string, string>)
Starts the ranorex instrumentation wizard.
public static bool StartRanorexInstrumentationWizard(string pageName, IDictionary<string, string> props)
Parameters
pageNamestringName of the page to show.
propsIDictionary<string, string>Additional properties passed to the wizard.
Returns
- bool
A value indicating if the wizard could successfully be started.
StartRanorexInstrumentationWizard(string, IDictionary<string, string>, out Process)
Starts the ranorex instrumentation wizard.
public static bool StartRanorexInstrumentationWizard(string pageName, IDictionary<string, string> props, out Process process)
Parameters
pageNamestringName of the page to show.
propsIDictionary<string, string>Additional properties passed to the wizard.
processProcessOut parameter containing the created process
Returns
- bool
A value indicating if the wizard could successfully be started.