public void Rebuild() { ViewMode tempViewMode = _musicTree.CurrentViewMode; Stack <long> idStack = new Stack <long>(); if (tempViewMode != ViewMode.MAX && CurrentTreeView.SelectedItem is LibraryViewModel model) { while (model != null) { idStack.Push(model.Data.Id); model = model.Parent; } } _musicTree = new MusicTreeViewModel(LibraryRequestHandler); DataContext = _musicTree; if (tempViewMode != ViewMode.MAX) { //Trigger the loading of the current view mode _musicTree.CurrentViewMode = tempViewMode; _musicTree.RestoreHierarchy(tempViewMode, idStack); } }
public void Rebuild() { _musicTree = new MusicTreeViewModel(LibraryRequestHandler); DataContext = _musicTree; //Trigger the loading of the current view mode _musicTree.CurrentViewMode = ViewMode.Classic; }
public LibraryControl() { InitializeComponent(); if (DesignerProperties.GetIsInDesignMode(this)) { _musicTree = new MusicTreeViewModel(); } else { Loaded += LibraryControl_Loaded; Unloaded += LibraryControl_Unloaded; _musicTree = new MusicTreeViewModel(LibraryRequestHandler); } DataContext = _musicTree; }