예제 #1
0
        private static void JumpToNodeAsync(FilePicker filePicker, ItemCollection items, StructureBuilder structure)
        {
            if (structure != null)
            {
                filePicker.IsLoading = true;
                bool done  = false;
                int  layer = 0;

                new Thread(() =>
                {
                    List <FolderEntry> entries = items.OfType <FolderEntry>().ToList();
                    while (!done)
                    {
                        FolderEntry entry = entries.FirstOrDefault(x => x.Path.Equals(structure.GetPathAtTreeLayer(layer)));

                        if (entry != null)
                        {
                            entry.IsExpanded = true;
                            entries          = entry.SubDirectories.ToList();

                            if (Helper.NormalizePath(entry.Path).Equals(Helper.NormalizePath(structure.TargetPath)))
                            {
                                entry.IsSelected = true;
                                done             = true;

                                filePicker.Dispatcher.Invoke(() =>
                                {
                                    filePicker.IsLoading = false;
                                });
                            }

                            layer++;
                        }
                    }
                }).Start();
            }
        }