public bool IsParentOf(ExplorerItemViewModel argItem) { ExplorerItemViewModel tmpParent = argItem.Parent; while (tmpParent != null && tmpParent != this) { tmpParent = tmpParent.Parent; } return(tmpParent == this); }
private void AddLoadedChildItem(ExplorerItem argItem) { ExplorerItemViewModel tmpVM = new ExplorerItemViewModel(argItem, this.OnSelectedCallback, this, this.Dispatcher); this.RunActionOnUIThread(() => { this.Children.Add(tmpVM); }); // Sleeping here to ensure that there is some time between next call to be transferred to the UI thread, so the UI thread to stay responsive Thread.Sleep(5); }
private void OnFolderExpanded() { if (this.NavigateToFolder != null && this.NavigateToFolder != this.ExplorerItem.Path) { string[] tmpPathLeftSections = this.NavigateToFolder.Remove(0, this.ExplorerItem.Path.Length).Split(new char[] { '\\' }, StringSplitOptions.RemoveEmptyEntries); if (tmpPathLeftSections.Any()) { string tmpChildFolder = tmpPathLeftSections[0]; ExplorerItemViewModel tmpChildVM = this.Children.Where(item => item.ExplorerItem.Name == tmpChildFolder).FirstOrDefault(); if (tmpChildVM != null) { tmpChildVM.NavigateTo(this.NavigateToFolder); } } this.NavigateToFolder = null; } }
public ExplorerItemViewModel(ExplorerItem argItem, Action <ExplorerItemViewModel> argSelectedCallback, ExplorerItemViewModel argParent, Dispatcher argDispatcher) : this(argItem, argSelectedCallback, argDispatcher) { this.parent = argParent; }