public void ApplyCriteria(string criteria, Stack<NodeWithName> ancestors, NodeWithName startPoint) { if (IsCriteriaMatched(criteria, startPoint)) { startPoint.IsVisible = true; foreach (var ancestor in ancestors) { ancestor.IsVisible = true; ancestor.Expanded = !String.IsNullOrEmpty(criteria); } } else startPoint.IsVisible = false; ancestors.Push(startPoint); foreach (var child in startPoint.Children) if (child != null && child.GetType() != typeof(Sound)) ApplyCriteria(criteria, ancestors, child as NodeWithName); ancestors.Pop(); }
private bool IsCriteriaMatched(string criteria, NodeWithName check) { if (!ExcludeApproved) return String.IsNullOrEmpty(criteria) || check.Name.ToLower().Contains(criteria.ToLower()); if (check.Approved) return false; return String.IsNullOrEmpty(criteria) || check.Name.ToLower().Contains(criteria.ToLower()); }
public void FindMatches(string criteria, string fullPath, Stack<NodeWithName> ancestors, NodeWithName startPoint) { if (IsCriteriaMatched(criteria, startPoint)) { (startPoint as Sound).ReimportSoundFile(fullPath); MessageBox.Show(String.Format("We reimported {0} successfully.", Path.GetFileNameWithoutExtension(criteria))); } ancestors.Push(startPoint); if (startPoint.Children != null && startPoint.Children.Count > 0) { foreach (var child in startPoint.Children) FindMatches(criteria, fullPath, ancestors, child as NodeWithName); } ancestors.Pop(); }
private bool IsCriteriaMatched(string criteria, NodeWithName check) { return String.IsNullOrEmpty(criteria) || check.Name.ToLower().Contains(criteria.ToLower()); }
public void ExecuteSelectedItemChangedCommand(object o) { var e = o as RoutedPropertyChangedEventArgs<object>; if (e.NewValue is Document) { _currentSelectedNode = _viewModelLocator.DocumentView.Document = e.NewValue as Document; CurrentView = _viewModelLocator.DocumentView; } else if (e.NewValue is Folder) { _currentSelectedNode = _viewModelLocator.FolderView.Folder = e.NewValue as Folder; CurrentView = _viewModelLocator.FolderView; } else if (e.NewValue is Cue) { _currentSelectedNode = _viewModelLocator.CueView.Cue = e.NewValue as Cue; CurrentView = _viewModelLocator.CueView; } else if (e.NewValue is Sound) { _currentSelectedNode = _viewModelLocator.SoundView.Sound = e.NewValue as Sound; CurrentView = _viewModelLocator.SoundView; } else { CurrentView = null; } }