private void CreateTreeView() { System.Uri resourceLocater = new System.Uri("/DataSpaceSync;component/FolderTreeMVC/TreeView.xaml", System.UriKind.Relative); treeView = Application.LoadComponent(resourceLocater) as TreeView; repo = new CmisSync.CmisTree.RootFolder() { Name = FolderName, Id = Credentials.RepoId, Address = Credentials.Address.ToString() }; ObservableCollection <RootFolder> repos = new ObservableCollection <RootFolder>(); repos.Add(repo); repo.Selected = true; asyncLoader = new AsyncNodeLoader(repo, Credentials, PredefinedNodeLoader.LoadSubFolderDelegate, PredefinedNodeLoader.CheckSubFolderDelegate); IgnoredFolderLoader.AddIgnoredFolderToRootNode(repo, Ignores); LocalFolderLoader.AddLocalFolderToRootNode(repo, localPath); asyncLoader.Load(repo); treeView.DataContext = repos; treeView.AddHandler(TreeViewItem.ExpandedEvent, new RoutedEventHandler(delegate(object sender, RoutedEventArgs e) { TreeViewItem expandedItem = e.OriginalSource as TreeViewItem; Node expandedNode = expandedItem.Header as Folder; if (expandedNode != null) { asyncLoader.Load(expandedNode); } })); }
private void CreateTreeView() { System.Uri resourceLocater = new System.Uri("/DataSpaceSync;component/FolderTreeMVC/TreeView.xaml", System.UriKind.Relative); treeView = Application.LoadComponent(resourceLocater) as TreeView; repo = new CmisSync.CmisTree.RootFolder() { Name = FolderName, Id = Credentials.RepoId, Address = Credentials.Address.ToString() }; ObservableCollection<RootFolder> repos = new ObservableCollection<RootFolder>(); repos.Add(repo); repo.Selected = true; asyncLoader = new AsyncNodeLoader(repo, Credentials, PredefinedNodeLoader.LoadSubFolderDelegate, PredefinedNodeLoader.CheckSubFolderDelegate); IgnoredFolderLoader.AddIgnoredFolderToRootNode(repo, Ignores); LocalFolderLoader.AddLocalFolderToRootNode(repo, localPath); asyncLoader.Load(repo); treeView.DataContext = repos; treeView.AddHandler(TreeViewItem.ExpandedEvent, new RoutedEventHandler(delegate(object sender, RoutedEventArgs e) { TreeViewItem expandedItem = e.OriginalSource as TreeViewItem; Node expandedNode = expandedItem.Header as Folder; if (expandedNode != null) { asyncLoader.Load(expandedNode); } })); }