浏览文件夹(FolderBrowserDialog)可靠地挂起“当这台PC”时被点击了 [英] Browse for Folder (FolderBrowserDialog) Reliably Hangs When "This PC" Is Clicked

查看:85
本文介绍了浏览文件夹(FolderBrowserDialog)可靠地挂起“当这台PC”时被点击了的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

            
bool bDevelopmentMode = false;

            bool bDevelopmentMode = false;

<跨度>&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;
System.Windows.Forms.FolderBrowserDialog dlg = new System.Windows.Forms.FolderBrowserDialog();

            System.Windows.Forms.FolderBrowserDialog dlg = new System.Windows.Forms.FolderBrowserDialog();

           
if(dlg.ShowDialog()== System.Windows.Forms.DialogResult.OK)

            if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)

< span style ="font-family:Consolas; font-size:8pt">                
textBox1.Text = dlg.SelectedPath;

                textBox1.Text = dlg.SelectedPath;

<跨度>&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;
否则if(bDevelopmentMode)

            else if (bDevelopmentMode)

<跨度>&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;
textBox1.Text = @" C:\ XMAS";   //用户取消了FolderBrowserDialog框,因此放入了可行的内容

                textBox1.Text = @"C:\XMAS";  // user cancelled the FolderBrowserDialog box so put in something that works

<跨度>&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;
其他

<跨度>&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;
返回;   //未处于开发模式且用户按下了CANCEL按钮,因此返回时没有填充listOfFilesToProcess

                return;  // not in development mode and user pressed the CANCEL button so return without populating listOfFilesToProcess

问题在于,大约一半时间出现"浏览文件夹"对话框和最终用户按下此PC旁边的三角形,线程挂起。 任务管理器是唯一提供
来杀死进程并再试一次的方法。 如上所示,代码在初始线程上运行,该线程可以访问所有表单的控件,而无需使用BeginInvoke。

MARK D ROCKMAN

MARK D ROCKMAN

推荐答案

Hello
F7H2fw

由于此问题与FolderBrowserDialog控件有关,因此我将它移动到Windows窗体论坛,有窗口形式exeprts谁会帮助你。您发布的当前论坛用于讨论和询问有关.NET的核心
的问题,包括安全性,性能,托管,基类,互操作,可靠性,调试,GC和分析。

Since this issue is related with the FolderBrowserDialog control, I move it to the windows form forum, there are window form exeprts who will help you. The current forum you posted to is used to discuss and ask questions about issues regarding the very core of .NET, including security, performance, hosting, base classes, interop, reliability, debugging, GC, and profiling.

问候。


这篇关于浏览文件夹(FolderBrowserDialog)可靠地挂起“当这台PC”时被点击了的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆