本文整理汇总了C#中TestStack.White.UIItems.WindowItems.Window类的典型用法代码示例。如果您正苦于以下问题:C# Window类的具体用法?C# Window怎么用?C# Window使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Window类属于TestStack.White.UIItems.WindowItems命名空间,在下文中一共展示了Window类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetBaseCondiction
public static CondictionScript GetBaseCondiction(AutomationElement element,Window rootWindow)
{
var walker =
new System.Windows.Automation.TreeWalker(
System.Windows.Automation.Condition.TrueCondition);
System.Windows.Automation.AutomationElement testparent;
var baseCondiction = new CondictionScript();
var paths=new List<AutomationElement>();
GetPath(element, rootWindow, walker, paths);
int flag = AnalyseSimpleCondiction(paths, rootWindow, baseCondiction);
if(flag>0)
{
return baseCondiction;
}
else if(flag==0)
{
return new CondictionScript();
}
else
{
return null;
}
}
示例2: New
public virtual object New(Window window, ScreenRepository screenRepository)
{
var o = Activator.CreateInstance(type, window, screenRepository);
//Get all fields, even from base types
var fieldInfos = AllTypes(type).SelectMany(t=>t.GetFields(Entity.BindingFlag));
foreach (var fieldInfo in fieldInfos)
{
if (nonInjectedTypes.Any(t=>t.IsAssignableFrom(fieldInfo.FieldType))) continue;
object injectedObject = null;
if (typeof(IUIItem).IsAssignableFrom(fieldInfo.FieldType))
{
var interceptor = new UIItemInterceptor(SearchCondition(fieldInfo, window.Framework), window, screenRepository.SessionReport);
injectedObject = DynamicProxyGenerator.Instance.CreateProxy(fieldInfo.FieldType, interceptor);
}
else if (typeof(AppScreenComponent).IsAssignableFrom(fieldInfo.FieldType))
{
var componentScreenClass = new ScreenClass(fieldInfo.FieldType);
injectedObject = componentScreenClass.New(window, screenRepository);
}
if (injectedObject != null) fieldInfo.SetValue(o, injectedObject);
}
return o;
}
示例3: Reset
/// <summary>
/// reset action after executing
/// </summary>
public override void Reset()
{
base.Reset();
Window = null;
Control = null;
}
示例4: ClassInit
public static void ClassInit(TestContext context)
{
var applicationPath = "WhiteTest.exe";
application = Application.Launch(applicationPath);
window = application.GetWindow("MainWindow", InitializeOption.NoCache);
}
示例5: FindControl
/// <summary>
/// given a criteria, find a control within a window
/// </summary>
/// <param name="window">the containing window</param>
/// <param name="criteria">the criteria to find the control</param>
/// <returns>the found control. null - if not found</returns>
public IUIItem FindControl(Window window, Dictionary<string, string> criteria)
{
// the "all" condition
SearchCriteria crit = SearchCriteria.All;
// for each criteria, AND with a new condition
foreach (string key in criteria.Keys)
{
switch (key.ToLower())
{
//case Constants.PropertyNames.ControlType:
// crit = crit.AndControlType(GetTypeByName(criteria[key]));
// break;
case Constants.PropertyNames.AutomationId:
crit = crit.AndAutomationId(criteria[key]);
break;
case Constants.PropertyNames.Text:
crit = crit.AndByText(criteria[key]);
break;
case Constants.PropertyNames.ClassName:
crit = crit.AndByClassName(criteria[key]);
break;
case Constants.PropertyNames.Index:
crit = crit.AndIndex(int.Parse(criteria[key]));
break;
default:
{
bool bNativeFound = false;
AutomationProperty[] props = window.AutomationElement.GetSupportedProperties();
foreach (AutomationProperty prop in props)
{
string propName = prop.ProgrammaticName.Substring(prop.ProgrammaticName.IndexOf('.') + 1);
propName = propName.Substring(0, propName.IndexOf("Property"));
if (propName.Equals(key, StringComparison.CurrentCultureIgnoreCase))
{
crit.AndNativeProperty(prop, criteria[key]);
bNativeFound = true;
break;
}
}
if (bNativeFound)
break; ;
}
return null;
};
}
try
{
// search for control with 'crit'
IUIItem item = window.Get(crit, WaitTime);
// return the found control
return item;
}
catch(Exception)
{
return null;
}
}
示例6: CheckWindowExists
//**************************************************************************************************************************************************************
public static bool CheckWindowExists(Window mainWindow, string childWindowName)
{
bool window = false;
try
{
List<Window> allChildWindows = mainWindow.ModalWindows();
foreach (Window w in allChildWindows)
{
if (w.Name.Equals(childWindowName) || w.Name.Contains(childWindowName))
{
window = true;
Thread.Sleep(int.Parse(Execution_Speed));
break;
}
}
return window;
}
catch (Exception e)
{
String sMessage = e.Message;
LastException.SetLastError(sMessage);
throw new Exception(sMessage);
}
}
示例7: FindControl
/// <summary>
/// given a criteria, find a control within a window
/// </summary>
/// <param name="window">the containing window</param>
/// <param name="criteria">the criteria to find the control</param>
/// <returns>the found control. null - if not found</returns>
public IUIItem FindControl(Window window, Dictionary<string, string> criteria)
{
// the "all" condition
SearchCriteria crit = SearchCriteria.All;
// for each criteria, AND with a new condition
foreach (string key in criteria.Keys)
{
switch (key.ToLower())
{
case Constants.PropertyNames.ControlType:
crit = crit.AndControlType(GetTypeByName(criteria[key]));
break;
case Constants.PropertyNames.AutomationId:
crit = crit.AndAutomationId(criteria[key]);
break;
case Constants.PropertyNames.Text:
crit = crit.AndByText(criteria[key]);
break;
default:
return null;
};
}
// search for control with 'crit'
IUIItem item = window.Get(crit, WaitTime);
// return the found control
return item;
}
示例8: Initialize
public void Initialize()
{
qbApp = FrameworkLibraries.AppLibs.WhiteAPI.QuickBooks.Initialize(exe);
qbWindow = FrameworkLibraries.AppLibs.WhiteAPI.QuickBooks.PrepareBaseState(qbApp);
QuickBooks.ResetQBWindows(qbApp, qbWindow, false);
InitQB();
}
示例9: Slide
public void Slide(Window window)
{
var thumb = window.Get<Thumb>("Splitter");
var originalY = thumb.Location.Y;
thumb.SlideVertically(50);
Assert.Equal(originalY + 50, thumb.Location.Y);
}
示例10: Slide
public void Slide(Window window)
{
var thumb = window.Get<Thumb>("Splitter");
double originalX = thumb.Location.X;
thumb.SlideHorizontally(50);
Assert.Equal(originalX + 50, thumb.Location.X);
}
示例11: DeskSelectionModel
public DeskSelectionModel(Window window)
{
deskSelection = window.Get<ComboBox>(SearchCriteria.ByAutomationId(DeskSelectionIDs.DESKSELECTIONCOMBOBOX));
makeMeImmediatlyAvailable = window.Get<CheckBox>(SearchCriteria.ByAutomationId(DeskSelectionIDs.MAKEMEIMMEDIATELYAVAILABLECHECKBOX));
okButton = window.Get<Button>(SearchCriteria.ByAutomationId(DeskSelectionIDs.OKBUTTON));
cancelButton = window.Get<Button>(SearchCriteria.ByAutomationId(DeskSelectionIDs.OKBUTTON));
closeButton = window.Get<Button>(SearchCriteria.ByAutomationId(DeskSelectionIDs.CLOSEBUTTON));
}
示例12: CleanUp
public void CleanUp()
{
_mainWindow.Close();
_application.Dispose();
_application = null;
_mainWindow = null;
}
示例13: TestInitialize
public void TestInitialize()
{
qbApp = FrameworkLibraries.AppLibs.QBDT.WhiteAPI.QuickBooks.Initialize(exe);
qbWindow = FrameworkLibraries.AppLibs.QBDT.WhiteAPI.QuickBooks.PrepareBaseState(qbApp);
QuickBooks.ResetQBWindows(qbApp, qbWindow);
invoiceNumber = rand.Next(12345, 99999);
poNumber = rand.Next(12345, 99999);
}
示例14: Initialize
public void Initialize()
{
Logger test = new Logger("US_Commented_Reports_Test");
qbApp = FrameworkLibraries.AppLibs.WhiteAPI.QuickBooks.Initialize(exe);
qbWindow = FrameworkLibraries.AppLibs.WhiteAPI.QuickBooks.PrepareBaseState(qbApp);
QuickBooks.ResetQBWindows(qbApp, qbWindow, false);
InitQB();
}
示例15: OperationsPage
public OperationsPage(Window window)
{
this.window = window;
string[] operations = { "*", "/", "-", "+", "=" };
operationButtons = operations.ToDictionary(o => o, o => window.Get<Button>(SearchCriteria.ByText(o)));
}