本文整理汇总了C#中System.Windows.Automation.PropertyCondition类的典型用法代码示例。如果您正苦于以下问题:C# PropertyCondition类的具体用法?C# PropertyCondition怎么用?C# PropertyCondition使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PropertyCondition类属于System.Windows.Automation命名空间,在下文中一共展示了PropertyCondition类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: GetControls
public void GetControls()
{
//window = AutomationElement.FromHandle(new IntPtr(window.Current.NativeWindowHandle));
var autoIds = new string[] {
"12005",
"12006",
"12007",
"2010"};
var types = new TradeContorlTypes[] {
TradeContorlTypes.BuyCode,
TradeContorlTypes.BuyMoney,
TradeContorlTypes.BuyAmount,
TradeContorlTypes.BuyButton };
PropertyCondition propertyCondition = null;
for (var i = 0; i < autoIds.Length; i++)
{
propertyCondition = new PropertyCondition(AutomationElement.AutomationIdProperty, autoIds[i]);
var control = window.FindFirst(TreeScope.Subtree, propertyCondition);
if (control != null)
{
TradeControls.Instance().AddControl(types[i], control);
}
}
}
开发者ID:Keyabob,项目名称:MMG,代码行数:25,代码来源:AuTest.cs
示例2: ButtonClick
private static bool ButtonClick(AutomationElement inElement, string automationId)
{
PropertyCondition btnCondition = new PropertyCondition(AutomationElement.AutomationIdProperty, automationId);
Console.WriteLine("Searching for the {0} button...", automationId);
AutomationElement control = inElement.FindFirst(TreeScope.Descendants, btnCondition);
if (control != null)
{
Console.WriteLine("Clicking the {0} button", automationId);
object controlType = control.GetCurrentPropertyValue(AutomationElement.ControlTypeProperty);
if (controlType == ControlType.Button)
{
InvokePattern clickCommand = control.GetCurrentPattern(InvokePattern.Pattern) as InvokePattern;
clickCommand.Invoke();
}
else if (controlType == ControlType.RadioButton)
{
SelectionItemPattern radioCheck = control.GetCurrentPattern(SelectionItemPattern.Pattern) as SelectionItemPattern;
radioCheck.Select();
}
System.Threading.Thread.Sleep(2000);
Console.WriteLine("Button {0} clicked.", automationId);
return true;
}
else
{
Console.WriteLine("Could not find button {0} ", automationId);
return false;
}
}
开发者ID:svetlik,项目名称:AutoInstall,代码行数:32,代码来源:AutoInstall.cs
示例3: ShouldDescribeNegatedCompoundsUsingNot
public void ShouldDescribeNegatedCompoundsUsingNot()
{
var nameCondition = new PropertyCondition(AutomationElement.NameProperty, "Wooble");
const string expected = "not Name='Wooble'";
Assert.AreEqual(expected, new ConditionDescriber().Describe(new NotCondition(nameCondition)));
}
开发者ID:pako4u2k,项目名称:wipflash,代码行数:7,代码来源:ConditionDescriberBehaviour.cs
示例4: getScreenshotForWindowwithTitle
public static void getScreenshotForWindowwithTitle(string partorfulltext, string screenshotlocation)
{
AutomationElement root = AutomationElement.RootElement;
Condition cndwindows = new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Window);
AutomationElementCollection ActiveWindows = root.FindAll(TreeScope.Descendants, cndwindows);
AutomationElement ActiveWindow = null;
foreach (AutomationElement windw in ActiveWindows)
{
if (windw.Current.Name.Contains(partorfulltext))
{
ActiveWindow = windw;
break;
}
}
ActiveWindow.SetFocus();
WindowPattern wndptn = (WindowPattern)ActiveWindow.GetCurrentPattern(WindowPattern.Pattern);
wndptn.SetWindowVisualState(WindowVisualState.Maximized);
System.Threading.Thread.Sleep(2000);
Bitmap bitmap = new Bitmap(Screen.PrimaryScreen.Bounds.Width,
Screen.PrimaryScreen.Bounds.Height);
Graphics graphics = Graphics.FromImage(bitmap as Image);
graphics.CopyFromScreen(0, 0, 0, 0, bitmap.Size);
bitmap.Save( Path.Combine(screenshotlocation, Guid.NewGuid() + ".jpg"), ImageFormat.Jpeg);
}
开发者ID:prasannarhegde2015,项目名称:MySQLBackupCsharpScript,代码行数:25,代码来源:getscreenshot.cs
示例5: ShouldDescribeAPropertyConditionWithConditionAndValue
public void ShouldDescribeAPropertyConditionWithConditionAndValue()
{
var condition = new PropertyCondition(AutomationElement.NameProperty, "Wibble");
const string expected = "Name='Wibble'";
Assert.AreEqual(expected, new ConditionDescriber().Describe(condition));
}
开发者ID:pako4u2k,项目名称:wipflash,代码行数:7,代码来源:ConditionDescriberBehaviour.cs
示例6: FindApplicationByTitle
/// <summary>
/// Find application from desktop
/// </summary>
/// <param name="appPath"></param>
/// <param name="arguments"></param>
/// <returns></returns>
public static AutomationElement FindApplicationByTitle(string titile)
{
Helper.ValidateArgumentNotNull(titile, "Title");
var desktop = AutomationElement.RootElement;
Condition condition = new PropertyCondition(AutomationElement.NameProperty, titile);
return desktop.FindFirst(TreeScope.Descendants,condition);
}
开发者ID:barbarossia,项目名称:DIS,代码行数:14,代码来源:Driver.cs
示例7: ConditionSetByConstructor
public void ConditionSetByConstructor()
{
var automationProperty = AutomationElement.NameProperty;
var valueProvider = CreateValueProvider(automationProperty);
var condition = new PropertyCondition(automationProperty, "");
var def = CreateElementDefinition(TreeScope.Descendants, automationProperty, valueProvider, condition);
Assert.IsTrue(ReferenceEquals(condition, def.Condition));
}
开发者ID:softek,项目名称:WinUIScraper,代码行数:8,代码来源:ElementDefinitionTests.cs
示例8: GetNamePropertyOf
public static string GetNamePropertyOf(this AutomationElement dialogWindow, string type)
{
if (dialogWindow == null) throw new ArgumentNullException("dialogWindow");
var controlTypePropertyCondition = new PropertyCondition(AutomationElement.LocalizedControlTypeProperty, type);
var firstResultOfCondition = dialogWindow.FindFirst(TreeScope.Children, controlTypePropertyCondition);
return firstResultOfCondition.GetCurrentPropertyValue(AutomationElement.NameProperty) as string;
}
开发者ID:staxmanade,项目名称:StatLight,代码行数:8,代码来源:MessageBoxMonitor.cs
示例9: FindElementByAutomationId
/// <summary>
/// Finds a descendent of the focused element that has the specified
/// className, controlType and automationID
/// </summary>
/// <param name="focusedElement"></param>
/// <param name="className">class name </param>
/// <param name="controlType">controlType</param>
/// <param name="automationId">automation id </param>
/// <returns>automation element if found null otherwise</returns>
public static AutomationElement FindElementByAutomationId(AutomationElement focusedElement, String className, object controlType, String automationId)
{
var controlTypeProperty = new PropertyCondition(AutomationElement.ControlTypeProperty, controlType);
var automationIdProperty = new PropertyCondition(AutomationElement.AutomationIdProperty, automationId);
var classNameProperty = new PropertyCondition(AutomationElement.ClassNameProperty, className);
var findControl = new AndCondition(controlTypeProperty, automationIdProperty, classNameProperty);
var retVal = focusedElement.FindFirst(TreeScope.Descendants, findControl);
return retVal;
}
开发者ID:nbsrujan,项目名称:acat,代码行数:19,代码来源:AgentUtils.cs
示例10: FindElementById
public static AutomationElement FindElementById(AutomationElement parentElement, string automationID, ControlType type)
{
PropertyCondition typeCondition = new PropertyCondition(AutomationElement.ControlTypeProperty, type);
PropertyCondition IDCondition = new PropertyCondition(AutomationElement.AutomationIdProperty, automationID);
AndCondition andCondition = new AndCondition(typeCondition, IDCondition);
return parentElement.FindFirst(TreeScope.Element | TreeScope.Descendants, andCondition);
}
开发者ID:tankxiao,项目名称:tankproject,代码行数:10,代码来源:AutomationBuild.cs
示例11: FindWindowByName
public static AutomationElement FindWindowByName(AutomationElement rootElement, string name, ControlType type)
{
PropertyCondition nameCondition = new PropertyCondition(AutomationElement.NameProperty, name);
PropertyCondition typeCondition = new PropertyCondition(AutomationElement.ControlTypeProperty, type);
AndCondition andCondition = new AndCondition(nameCondition, typeCondition);
return rootElement.FindFirst(TreeScope.Element | TreeScope.Descendants, andCondition);
}
开发者ID:tankxiao,项目名称:tankproject,代码行数:10,代码来源:AutomationBuild.cs
示例12: ShouldDescribeCompoundConditionsUsingOr
public void ShouldDescribeCompoundConditionsUsingOr()
{
var nameCondition = new PropertyCondition(AutomationElement.NameProperty, "Wubble");
var controlTypeCondition = new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Window);
var condition = new OrCondition(nameCondition, controlTypeCondition);
var expected = "(Name='Wubble' or ControlType='" + ControlType.Window.Id + "')";
Assert.AreEqual(expected, new ConditionDescriber().Describe(condition));
}
开发者ID:pako4u2k,项目名称:wipflash,代码行数:10,代码来源:ConditionDescriberBehaviour.cs
示例13: ConditionTest
public void ConditionTest ()
{
AssertRaises<ArgumentNullException> (
() => new TreeWalker (null),
"passing null to TreeWalker constructor");
Condition buttonCondition = new PropertyCondition (AEIds.ControlTypeProperty, ControlType.Button);
TreeWalker buttonWalker = new TreeWalker (buttonCondition);
Assert.AreEqual (buttonCondition, buttonWalker.Condition, "Condition");
}
开发者ID:mono,项目名称:uia2atk,代码行数:10,代码来源:TreeWalkerTest.cs
示例14: FindElementByClassName
public static AutomationElementCollection FindElementByClassName(AutomationElement parentElement, string className, ControlType type)
{
PropertyCondition typeCondition = new PropertyCondition(AutomationElement.ControlTypeProperty, type);
PropertyCondition IDCondition = new PropertyCondition(AutomationElement.ClassNameProperty, className);
AndCondition andCondition = new AndCondition(typeCondition, IDCondition);
return parentElement.FindAll(TreeScope.Element | TreeScope.Descendants, andCondition);
}
开发者ID:tankxiao,项目名称:tankproject,代码行数:10,代码来源:AutomationBuild.cs
示例15: GetFirstChildTest
public void GetFirstChildTest ()
{
Condition buttonCondition = new PropertyCondition (AEIds.ControlTypeProperty, ControlType.Button);
TreeWalker buttonWalker = new TreeWalker (buttonCondition);
AssertRaises<ArgumentNullException> (
() => buttonWalker.GetFirstChild (null),
"passing null to TreeWalker.GetFirstChild");
VerifyGetFirstChild (buttonWalker, groupBox1Element, button7Element);
}
开发者ID:mono,项目名称:uia2atk,代码行数:11,代码来源:TreeWalkerTest.cs
示例16: TreeFilterTest
public void TreeFilterTest()
{
CacheRequest target = new CacheRequest();
PropertyCondition expected = new PropertyCondition(AutomationElement.NameProperty, "foo");
PropertyCondition actual;
target.TreeFilter = expected;
actual = (PropertyCondition)target.TreeFilter;
Assert.AreEqual(expected.Flags, actual.Flags);
Assert.AreEqual(expected.Property, actual.Property);
Assert.AreEqual(expected.Value, actual.Value);
}
开发者ID:RyuaNerin,项目名称:UIAComWrapper,代码行数:11,代码来源:CacheRequestTest.cs
示例17: Find
public int Find(int parent, int index)
{
AutomationElement baseElement = base.Find(parent);
Condition locator = new PropertyCondition(AutomationElement.ControlTypeProperty, controlType);
AutomationElementCollection elements = baseElement.FindAll(TreeScope.Subtree, locator);
if (elements.Count <= index)
{
return 0;
}
logger.Debug(String.Format("Found hwnd: {0}",elements[index].Current.NativeWindowHandle));
return elements[index].Current.NativeWindowHandle;
}
开发者ID:mkolisnyk,项目名称:Sirius,代码行数:12,代码来源:Control.cs
示例18: TryGetWindowElement
private static AutomationElement TryGetWindowElement(String windowAutomationId, Int32 timeoutMs)
{
var desktop = AutomationElement.RootElement;
var condition = new PropertyCondition(AutomationElement.AutomationIdProperty, windowAutomationId);
var getWindowElementOperation = new UiOperation<AutomationElement>(
null,
() => desktop.FindFirst(TreeScope.Children, condition),
e => e != null,
timeoutMs,
150);
return getWindowElementOperation.Invoke();
}
开发者ID:ShyAlex,项目名称:automation,代码行数:12,代码来源:WindowDriver.cs
示例19: NativePropertyCondition
public void NativePropertyCondition()
{
SearchCondition test = SearchConditionFactory.CreateForNativeProperty(AutomationElement.IsControlElementProperty, true);
PropertyCondition expected;
expected = new PropertyCondition(AutomationElement.IsControlElementProperty, true);
Assert.AreEqual((bool)expected.Value,(bool)((PropertyCondition)test.AutomationCondition).Value);
Assert.AreEqual(expected.Property.ProgrammaticName, ((PropertyCondition)test.AutomationCondition).Property.ProgrammaticName);
expected = new PropertyCondition(AutomationElement.NameProperty, "hello");
test = SearchConditionFactory.CreateForNativeProperty(AutomationElement.NameProperty, "hello");
Assert.AreEqual((string)expected.Value, (string)((PropertyCondition)test.AutomationCondition).Value);
Assert.AreEqual(expected.Property.ProgrammaticName, ((PropertyCondition)test.AutomationCondition).Property.ProgrammaticName);
}
开发者ID:EDOlsson,项目名称:White,代码行数:12,代码来源:NativePropertyConditionTest.cs
示例20: ExtractElement
/// <summary>
/// Extract Window from parent window
/// </summary>
/// <param name="parent"></param>
/// <param name="titleName"></param>
/// <returns></returns>
public static AutomationElement ExtractElement(AutomationElement parent, string nameValue, TreeScope treeScope)
{
ValidateArgumentNotNull(parent, "Extract Window from parent window");
Condition condition = new PropertyCondition(AutomationElement.NameProperty, nameValue);
AutomationElement appElement;
DateTime timeOut = DateTime.Now.AddMilliseconds(TimeOutMillSec);
do
{
appElement = parent.FindFirst(treeScope, condition);
} while (appElement == null && DateTime.Now < timeOut);
return appElement;
}
开发者ID:barbarossia,项目名称:DIS,代码行数:19,代码来源:Helper.cs
注:本文中的System.Windows.Automation.PropertyCondition类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论