/// <summary> /// Handles the TimeOfDayChanged event of the world control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="TimeOfDayChangedEventArgs"/> instance containing the event data.</param> private void World_TimeOfDayChanged(object sender, TimeOfDayChangedEventArgs e) { // If we have a previous time of day, unregister our event. if (e.TransitioningFrom != null) { e.TransitioningFrom.TimeUpdated -= CurrentTimeOfDay_TimeUpdated; } e.TransitioningTo.TimeUpdated += CurrentTimeOfDay_TimeUpdated; CurrentTimeOfDay_TimeUpdated(sender, e.TransitioningTo.CurrentTime); }
/// <summary> /// Gets called when the owning world has its Time changed. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="TimeOfDayChangedEventArgs"/> instance containing the event data.</param> protected virtual void WorldTimeChanged(object sender, TimeOfDayChangedEventArgs e) { this.ApplyTimeZoneOffset(e.TransitioningTo.CurrentTime); }