本文整理汇总了C#中WinWindow.SetFocus方法的典型用法代码示例。如果您正苦于以下问题:C# WinWindow.SetFocus方法的具体用法?C# WinWindow.SetFocus怎么用?C# WinWindow.SetFocus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WinWindow
的用法示例。
在下文中一共展示了WinWindow.SetFocus方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SelectWinTab
public static void SelectWinTab(string wintitle ,string tabname)
{
WinWindow wnd = new WinWindow();
wnd.SearchProperties.Add(WinWindow.PropertyNames.Name, wintitle, PropertyExpressionOperator.Contains);
wnd.SearchProperties.Add(WinWindow.PropertyNames.ClassName, "WindowsForms10.Window", PropertyExpressionOperator.Contains);
wnd.SetFocus();
wnd.Maximized = true;
WinTabPage wtbpg = new WinTabPage(wnd);
wtbpg.SearchProperties.Add(WinTabPage.PropertyNames.Name, tabname, PropertyExpressionOperator.Contains);
Mouse.Click(wtbpg);
}
示例2: ClickWinButton
public static void ClickWinButton(string wintitle, string tabname)
{
WinWindow wnd2 = new WinWindow();
wnd2.SearchProperties.Add(WinWindow.PropertyNames.Name, wintitle, PropertyExpressionOperator.Contains);
wnd2.SearchProperties.Add(WinWindow.PropertyNames.ClassName, "WindowsForms10.Window", PropertyExpressionOperator.Contains);
wnd2.SetFocus();
wnd2.Maximized = true;
Console.WriteLine("got focus of window"+ wnd2.Name);
Console.WriteLine("Button Name " + tabname);
WinButton wbtn = new WinButton(wnd2);
UITestControlCollection allbtns = wbtn.FindMatchingControls();
Console.WriteLine("buttons count insiode widnows was " + allbtns.Count);
foreach (UITestControl indbutton in allbtns)
{
Console.WriteLine("Found button " + indbutton.Name);
}
wbtn.SearchProperties.Add(WinButton.PropertyNames.Name, tabname, PropertyExpressionOperator.Contains);
Mouse.Click(wbtn);
}
示例3: AddData
//.........这里部分代码省略.........
{
if (_controlValue.Length > 0)
{
logTofile(_eLogPtah, "control value : " + _controlValue);
AutomationElement udtitem = GetUIAutomationDataItem(_searchBy, _controlName, _index);
SelectionItemPattern selpat = (SelectionItemPattern)udtitem.GetCurrentPattern(SelectionItemPattern.Pattern);
selpat.Select();
switch (_controlValue.ToLower())
{
case "d":
DoubleClickControl(udtitem);
break;
case "l":
ClickControl(udtitem);
break;
case "r":
RightClickControl(udtitem);
break;
case "1":
ClickControl(udtitem);
break;
}
}
}
break;
case "uiautomationspinner":
case "uspinner":
{
if (_controlValue.Length > 0)
{
logTofile(_eLogPtah, "control value:" + _controlValue);
AutomationElement uspinner = GetUIAutomationSpinner(_searchBy, _controlName, _index);
uspinner.SetFocus();
}
}
break;
/* case "wpflistview":
wpfapp.GetWPFDataGrid(_globalWindow, _searchBy, _controlName).Focus();
break; */
/* case "wpfcombobox":
if (_controlValue.Length > 0)
{
wpfapp.GetWPFComboBox(_globalWindow, _searchBy, _controlName, _index).Select(_controlValue);
uilog.AddTexttoColumn("Control Detected", "Yes");
uilog.AddTexttoColumn("Action Performed on Control", "select Combo item" + _controlValue);
}
break; */
case "uiautomationcombobox":
case "ucombobox":
bool itemClicked = false;
AutomationElement combo = GetUIAutomationComboBox(_searchBy, _controlName, _index);
try
{
combo.SetFocus();
ExpandCollapsePattern expandPat = (ExpandCollapsePattern)combo.GetCurrentPattern(ExpandCollapsePattern.Pattern);
if (expandPat != null)
{
logTofile(_eLogPtah, "Expanding the combobox");
expandPat.Expand();
Thread.Sleep(100);
}
}
catch