TrakHound_UI.Timeline.TimelineTray.OnMaxDateTimeChanged C# (CSharp) Method

OnMaxDateTimeChanged() public static method

public static OnMaxDateTimeChanged ( DependencyObject d, System.Windows.DependencyPropertyChangedEventArgs e ) : void
d System.Windows.DependencyObject
e System.Windows.DependencyPropertyChangedEventArgs
return void
        public static void OnMaxDateTimeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            TimelineTray                                t;

            t = d as TimelineTray;

            if (t != null && e.NewValue != e.OldValue)
            {
                if ((DateTime) e.NewValue < t.MinDateTime)
                {
                    throw new ArgumentOutOfRangeException("MaxDateTime cannot be less then MinDateTime");
                }
                else if (t.CurrentDateTime >= (DateTime) e.NewValue)
                {
                    t.SetValue(CurrentDateTimeProperty, e.NewValue);
                }

                foreach (TimelineBand b in t.m_bands)
                {
                    if (b.Calculator != null && b.Calculator.Calendar != null)
                    {
                        b.Calculator.Calendar.MaxDateTime = ((DateTime) e.NewValue);
                    }
                }
            }
        }