白色 - 文件打开对话框

问题描述:

这是我的问题。我有一个应用程序打开文件打开对话框,我试图在文件路径和文件名中输入“文件名:”组合框部分。白色 - 文件打开对话框

该应用程序使用登录的表单加载。这会打开另一个表单,其中有多个按钮。选择其中一个按钮打开另一个表单。在这种形式下,有一个按钮可以选择文件。在这个阶段有3个表格打开。这将打开标准文件打开对话框。我似乎无法得到这个文件打开对话框的句柄。

这是我正在使用的代码。

Window LoginForm = application.GetWindow("LoginForm"); 
LoginForm.Get<Button>("btnSelectFiles").Click(); // This is from the 3rd form that is opened 

出于某种原因,我可以使用LoginForm变量访问其他窗体中的所有按钮。 我试过以下。

Window FileOpenDialog = application.GetWindow("Open", InitializeOption.NoCache); 

这不起作用。

我也试过以下,但是这返回null。我认为我可以使用LoginForm变量来访问它。

Win32ComboBox comboBox = LoginForm.Get<Win32ComboBox>("Filename"); 

任何想法?谢谢

打开的文件对话框是一个模态窗口。您将需要使用LoginForm.ModalWindows()函数。来自white project wiki

Window mainWindow = application.GetWindow("main"); 
List<Window> modalWindows = mainWindow.ModalWindows(); //list of all the modal windows belong to the window. 
Window childWindow = mainWindow.ModalWindow("child"); //modal window with title "child" 
childWindow.IsModal; //returns true