我想从带有文件对话框的共享中选择文件名(例如OpenFileDialog
)。
点击"确定"在对话框上花了很长时间(在我的情况下最多20秒)。如果我在按下" OK"之前导航到共享文件夹,也是如此。看起来似乎正在按下" OK"触发下载或类似的东西。
OpenFileDialog
上。 (也许它确实触发了下载,我可以告诉它不要等等。)OpenFileDialog
意味着文件已打开并且有一个选择对话框。)这是我的代码:
var openFileDialog1 = new OpenFileDialog()
{
InitialDirectory = "c:\\",
Filter = "txt files (*.txt)|*.tca|All files (*.*)|*.*",
FilterIndex = 2,
RestoreDirectory = true,
};
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
MessageBox.Show(openFileDialog1.FileName);
}
这是回溯,而对话框正忙:
[Managed to Native Transition]
System.Windows.Forms.dll!System.Windows.Forms.FileDialog.RunDialogVista(System.IntPtr hWndOwner) + 0x75 Bytes
System.Windows.Forms.dll!System.Windows.Forms.FileDialog.RunDialog(System.IntPtr hWndOwner) + 0x55 Bytes
System.Windows.Forms.dll!System.Windows.Forms.CommonDialog.ShowDialog(System.Windows.Forms.IWin32Window owner) + 0x1cb Bytes
System.Windows.Forms.dll!System.Windows.Forms.CommonDialog.ShowDialog() + 0x7 Bytes
> TestCases.exe!TestCases.Program.SelectFile() Line 39 + 0xa Bytes
TestCases.exe!TestCases.Program.Main() Line 24 + 0x5 Bytes