/// <summary> /// Mark a node and all dependents as dirty for the next refresh. /// </summary> /// <param name="node"></param> public void Dirty(ICanDirty element) { m_Dirty.Add(element); // Also dirty outputs if a NodeView if (element is NodeView) { var node = element as NodeView; foreach (var port in node.outputs) { foreach (var conn in port.connections) { Dirty(conn.input.node as NodeView); } } } }
/// <summary> /// Poormans NotifyPropertyChanged Bubbler. Classes that impl ICanDirty can subscribe to this event to /// send IsDirty flag and in turn notify up to singleton NotifyIconViewModel.Current.Manager.IsDirty. /// MainWindow will check this flag before closing and prompt user to save/dicard changes. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void SelectedWorkItemViewModel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { if (e.PropertyName == "StartDate" || e.PropertyName == "EndDate" || e.PropertyName == "Effort") { OnPropertyChanged("WorkItemSummaryHoursCompleted"); } if (e.PropertyName == "IsDirty") { ICanDirty item = (sender as ICanDirty); if (item.IsDirty) { if (!selectedWorkItemViewModel.IsDirty) { selectedWorkItemViewModel.ForceIsDirty(true, false); // no notify } IsDirty = true; } UpdateSelectedWorkItem(selectedWorkItemViewModel); } }
/// <summary> /// Mark a node and all dependents as dirty for the next refresh. /// </summary> public void Dirty(ICanDirty element) { dirtyElements.Add(element); // TODO: Not the best place for this. EditorUtility.SetDirty(Graph); element.Dirty(); // Also dirty outputs if a NodeView if (element is NodeView node) { foreach (var port in node.Outputs) { foreach (var conn in port.connections) { if (!dirtyElements.Contains(conn.input.node as NodeView)) { Dirty(conn.input.node as NodeView); } } } } }