我有一个带有标签的UWP应用,并且我正在其中一个标签上进行操作(即保存),我想等到标签刷新后再进行操作。
我的问题是:如果我使用appwindow.WaitForControlReady(),这是正确的指示吗?还是appwindow始终可用,因此无法正常工作? 无论如何,appwindow.WaitForControlReady()在我的情况下会做什么?
//app main window
XamlWindow mainWindow = new XamlWindow();
mainWindow.SearchProperties[XamlControl.PropertyNames.ClassName] = "Windows.UI.Core.CoreWindow";
//Console.WriteLine("name= {0}", mainWindow.GetProperty("Name"));
//TabPage
XamlControl tabPage = new XamlControl(mainWindow);
tabPage.SearchProperties[UITestControl.PropertyNames.ControlType] = "TabPage";
tabPage.SearchProperties[UITestControl.PropertyNames.Name] = "Xamarin.Forms.NavigationPage";
tabPage.SearchProperties["Instance"] = tabNumber;
//enter material
XamlEdit materialID = new XamlEdit(tabPage);
materialID.SearchProperties[XamlEdit.PropertyNames.Name] = "Material Description";
UITestControlCollection test = materialID.FindMatchingControls();
materialID.Text = Material;
//click on filter button
Mouse.Click(GetButton(ButtonEnum.Filter, manageMaterialTabPage));
// wait for lists to be refreshed
mainWindow.WaitForControlReady();
单击“过滤器”按钮后,我想在列表上断言它们已被物料过滤(刷新)。那么mainWindow.WaitForControlReady()会成功吗?