/// <summary>
        /// 设置FileViewer的文件
        /// </summary>
        /// <param name="filesWithClassesFunc">用于获取文件的异步函数</param>
        /// <returns></returns>
        private async Task <bool> SetFilesAsync(
            Func <List <UIFile> > getUIFiles,
            FileCollectionType type
            )
        {
            currentFileCollectionType = type;
            bool result = false;
            await MainWindow.Current.DoProcessAsync(Do());

            async Task Do()
            {
                Debug.WriteLine("Set Files, Project Hashcode is " + Project.GetHashCode()
                                + ", Class is " + (classPanel.SelectedUIClass == null ? "null" : classPanel.SelectedUIClass.Class.Name));
                IEnumerable <UIFile> uiFiles = null;
                UIClass c = classPanel.SelectedUIClass;
                await Task.Run(() =>
                {
                    try
                    {
                        uiFiles = getUIFiles();
                    }
                    catch (Exception ex)
                    {
                        Dispatcher.Invoke(() =>
                        {
                            new ErrorDialog().ShowAsync(ex, "查询文件失败");
                        });
                        return;
                    }
                    rawFiles = uiFiles;
                    if (FilterPattern.Length > 0)
                    {
                        Regex r = new Regex(FilterPattern);
                        uiFiles = uiFiles.Where(p => r.IsMatch(p.File.Name));
                    }
                    uiFiles.ForEach(p => p.Class = c?.Class);
                    result = true;
                });

                await filesViewer.SetFilesAsync(uiFiles, c, type);

                await ApplyDirs();
            }

            return(result);
        }
 private async Task SetSpecialFiles(Func <Project, IEnumerable <KeyValuePair <File, IEnumerable <Class> > > > func, FileCollectionType type)
 {
     ignoreClassChanged         = true;
     classPanel.SelectedUIClass = null;
     ignoreClassChanged         = false;
     await SetFilesAsync(() =>
     {
         var files = func(Project);
         return(files.Select(p => new UIFile(p.Key)
         {
             Classes = new ObservableCollection <Class>(),
         }).ToList());
     }, type);
 }