OrCondition(Condition[]) 생성자
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
OrCondition 클래스의 새 인스턴스를 초기화합니다.
public:
OrCondition(... cli::array <System::Windows::Automation::Condition ^> ^ conditions);
public OrCondition (params System.Windows.Automation.Condition[] conditions);
new System.Windows.Automation.OrCondition : System.Windows.Automation.Condition[] -> System.Windows.Automation.OrCondition
Public Sub New (ParamArray conditions As Condition())
매개 변수
- conditions
- Condition[]
둘 이상의 조건으로, 이 중 하나만 true여도 일치로 판정합니다.
예제
다음 예제 OrCondition 에서는 단추 또는 라디오 단추인 UI 자동화 요소를 검색하는 데 사용됩니다.
/// <summary>
/// Uses OrCondition to retrieve elements that match either of two conditions.
/// </summary>
/// <param name="elementMainWindow">An application window element.</param>
public void OrConditionExample(AutomationElement elementMainWindow)
{
if (elementMainWindow == null)
{
throw new ArgumentException();
}
OrCondition conditionButtons = new OrCondition(
new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Button),
new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.RadioButton));
AutomationElementCollection elementCollectionButtons = elementMainWindow.FindAll(
TreeScope.Subtree, conditionButtons);
Console.WriteLine("\nButtons and radio buttons:");
foreach (AutomationElement autoElement in elementCollectionButtons)
{
Console.WriteLine(autoElement.Current.Name);
}
// Example of getting the conditions from the OrCondition.
Condition[] conditions = conditionButtons.GetConditions();
Console.WriteLine("OrCondition has " + conditions.GetLength(0) + " subconditions.");
}
''' <summary>
''' Uses OrCondition to retrieve elements that match either of two conditions.
''' </summary>
''' <param name="elementMainWindow">An application window element.</param>
Public Sub OrConditionExample(ByVal elementMainWindow As AutomationElement)
If elementMainWindow Is Nothing Then
Throw New ArgumentException()
End If
Dim conditionButtons As New OrCondition(New PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Button), New PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.RadioButton))
Dim elementCollectionButtons As AutomationElementCollection = elementMainWindow.FindAll(TreeScope.Subtree, conditionButtons)
Console.WriteLine("Buttons and radio buttons:")
Dim autoElement As AutomationElement
For Each autoElement In elementCollectionButtons
Console.WriteLine(autoElement.Current.Name)
Next autoElement
' Example of getting the conditions from the OrCondition.
Dim conditions As Condition() = conditionButtons.GetConditions()
Console.WriteLine("OrCondition has " & conditions.GetLength(0) & " subconditions.")
End Sub