private ArtifactBase AddArtifact(ArtifactType type, string name, bool selected = false, ArtifactBase parent = null) { ArtifactBase artifact; switch (type) { case ArtifactType.Root: artifact = new RootArtifact(); break; case ArtifactType.Process: artifact = new ProcessArtifact(); break; default: return(null); } artifact.Name = name; artifact.Parent = parent; artifact.IsExpanded = false; artifact.IsSelected = selected; lock (AccessLock) { _artifacts.Add(artifact); } NotifyPropertyChange("TreeItems"); // this forces the set property / INotifyPropertyCHange NotifyPropertyChange("Processes"); return(artifact); }
/// <summary> /// This function gets called everytime something gets selected in the tree view /// First do a check to see if the selected item is the currently selected item /// </summary> /// <param name="selectedArtifact"></param> public void UpdateDetails(ArtifactBase selectedArtifact) { if (selectedArtifact == null || selectedArtifact == _activeArtifact) { return; } _activeArtifact = selectedArtifact; RootArtifact ra = _activeArtifact as RootArtifact; if (ra != null) { CurrentDetailsViewModelHint = "root"; _processInfoDictionary.Clear(); NotifyPropertyChange("CurrentDetailsViewModel"); // this forces the set property / INotifyPropertyCHange CurrentHexViewerContent CurrentDetailsViewModel return; } ProcessArtifact pa = _activeArtifact as ProcessArtifact; if (pa != null) { CurrentDetailsViewModelHint = "process"; _processInfoDictionary.Clear(); UpdateProcessInfoDictionary(pa.LinkedProcess); _selectedProcess = pa.LinkedProcess; NotifyPropertyChange("CurrentDetailsViewModel"); return; } }