Exemplo n.º 1
0
        public static void OpenImputFIle()
        {
            //检测缓存文件数量是否有变化
            if (Directory.GetFiles(RichTextBoxTool.PathCache, SystemCommon.SearchExtensionName).Length > NotepadManage.WindowListCount)
            {
                //查找新导入文件并打开
                //DirectoryInfo info = new DirectoryInfo(RichTextBoxTool.PathCache);
                foreach (string s in Directory.GetFiles(RichTextBoxTool.PathCache, SystemCommon.SearchExtensionName))
                {
                    var v = WindowList.Find(m => m.CacheFileName == s);

                    if (v == null)
                    {
                        if (App.Current.Dispatcher.Thread != Thread.CurrentThread)
                        {
                            App.Current.Dispatcher.Invoke((Action)(() =>
                            {
                                CreateNotepad(Path.GetFileNameWithoutExtension(s), GetNewIndex());
                            }));
                        }
                        else
                        {
                            CreateNotepad(Path.GetFileNameWithoutExtension(s), GetNewIndex());
                        }
                    }
                }
            }
        }