c# - 白色 - 文件打开对话框

标签 c# winforms white-framework

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

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

这行不通。

我也试过以下但返回空值。我认为我可以使用 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

关于c# - 白色 - 文件打开对话框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3502054/

相关文章:

c# - 使用 C# Entity Framework 在时态表中插入记录

c# - 使用 Json 错误请求的 WCF 服务

c# - 无法将文件写入 Windows 7 中的 Application.StartupPath

c# - 将 .rtf 文件从资源加载到 RichTextBox

WPF、Project White 和 Infragistics

ui-automation - 如何自动化 xceed updown 控件

c# - 等效于 WPF .NET 5、.NET 6 或 .Net Core 中的 UserSettings/ApplicationSettings

c# - 如何使用 Access 数据库中的值填充列表或数组

.net - 是什么导致 Windows 在此 WPF 功能区应用程序中挂起

c# - 屏幕外元素测试堆栈白色