/// <summary> /// Handles the event when the <see cref="Population"/> property changes. /// </summary> /// <param name="obj">The <see cref="DependencyObject"/> that owns the property.</param> /// <param name="e">The <see cref="DependencyPropertyChangedEventArgs"/> associated with the event.</param> private static void OnSelectedPopulationChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e) { PopulationViewer viewer = (PopulationViewer)obj; if (e.OldValue == null) { viewer.SelectedPopulationEntities = null; return; } viewer.RefreshEntities((Population)e.NewValue, viewer.ExecutionState); }
/// <summary> /// Handles the event when the <see cref="ExecutionState"/> property changes. /// </summary> /// <param name="obj">The <see cref="DependencyObject"/> that owns the property.</param> /// <param name="e">The <see cref="DependencyPropertyChangedEventArgs"/> associated with the event.</param> private static void OnExecutionStateChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e) { PopulationViewer viewer = (PopulationViewer)obj; ExecutionState newState = (ExecutionState)e.NewValue; ExecutionState oldState = (ExecutionState)e.OldValue; // No need to refresh if we're moving from paused to idle since no change to the entities would have occurred. if (newState == ExecutionState.Idle && oldState == ExecutionState.Paused) { return; } viewer.RefreshEntities(viewer.Population, newState); }