白色 - 文件打开对话框

发布于 2024-09-14 20:23:49 字数 744 浏览 7 评论 0原文

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

应用程序会加载一个您登录的表单。这将打开另一个表单,其中有许多按钮。选择这些按钮之一会打开另一个窗体。在这种形式中,有一个用于选择文件的按钮。在此阶段打开了 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"); 

有什么想法吗?谢谢

This is my problem. I have an application where it opens a file open dialog box and I'm trying to enter in the file path and file name into the "File name:" combo box section.

The application loads with a form where you log in. This opens another form where there are a number of buttons. Choosing one of these buttons opens another form. It is in this form that there is a button to select a file. At this stage there's 3 forms opened. This will open the standard file open dialog box. I can't seem to get a handle on this file open dialog box.

Here's the code I'm using.

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

For some reason, I can access all buttons from the other forms using the LoginForm variable.
I've tried the following.

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

This doesn't work.

I've also tried the following but this returns null. I thought that I would be able to access this using the LoginForm variable.

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

Any ideas? Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

源来凯始玺欢你 2024-09-21 20:23:49

打开文件对话框是一个模式窗口。您将需要使用 LoginForm.ModalWindows() 函数。来自 白色项目 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

The open file dialog is a modal window. You will need to use the LoginForm.ModalWindows() function. From 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
花想c 2024-09-21 20:23:49

标准文件打开对话框。我似乎无法处理此文件打开对话框。

另一个解决方案是

Window FileOpenDialog = application.GetWindows().Last();

我一直使用它,因为当显示时(并且考虑到它是模态的),OpenFileDialog 是您在应用程序中打开的最后一个窗口;我想不出更好的单行解决方案来解决这个问题。

the standard file open dialog box. I can't seem to get a handle on this file open dialog box.

Another solution is just

Window FileOpenDialog = application.GetWindows().Last();

I use that all the time, since when shown (and given that it's modal), the OpenFileDialog is the last window you opened in your application; I can't think of a better one-liner solution for this problem.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文