private void ParseDirectoryThread(object p)//使用后台线程获取文件信息 { /////////////_client.RequestOpenShareFolder(string.Empty, 0); string _directory = ""; if (p != null && p is string) { _directory = (string)p; } if (_directory == "") { return; } ShowSharefile.SendDirectoryName(_directory); try { Application.Current.Dispatcher.Invoke(DispatcherPriority.Background, (ThreadStart) delegate { FileItemInfo.Clear(); }); t = new Thread(new ParameterizedThreadStart(ParseDirectoryRecursive)); //在后台线程中调用ParseDirectoryRecursive方法 t.IsBackground = true; //指定为后台线程 t.Priority = ThreadPriority.BelowNormal; //指定线程优先级别 t.Start(_directory); //为线程方法传入文件夹路径 } catch (Exception) //如果产生异常 { //调用自定义的异常信息窗口 throw; // ExceptionManagement.Manage("Catalog:ParseDirectoryThread", err); } }