Пример #1
0
        /// <summary>
        /// Handle the Time property change event.
        /// </summary>
        /// <param name="d">Time label whose time is changed.</param>
        /// <param name="e">Instance of <see cref="System.Windows.DependencyPropertyChangedEventArgs"/> containing the data.</param>
        private static void OnTimeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            TimeLabel lblTime = d as TimeLabel;

            if (lblTime != null)
            {
                if (e.NewValue == null && e.Property == ValueProperty)
                {
                    throw new ArgumentNullException(e.Property.ToString());
                }

                if (e.OldValue != e.NewValue)
                {
                    if (e.Property == NullIndexProperty)
                    {
                        lblTime.Value.NullIndex = (int)e.NewValue;
                    }
                    else if (e.Property == TimeValueProperty)
                    {
                        lblTime.Value.TimeValue = (DateTime)e.NewValue;
                    }
                    else if (e.Property == TimeTypeProperty)
                    {
                        lblTime.Value.TimeType = (TimeType)e.NewValue;
                    }
                    else if (e.Property == ValueProperty)
                    {
                        CuiTime time = e.NewValue as CuiTime;
                        if (time != null)
                        {
                            lblTime.TimeType  = time.TimeType;
                            lblTime.TimeValue = time.TimeValue;
                            lblTime.NullIndex = time.NullIndex;
                        }
                    }

                    lblTime.UpdateDisplayValue();

                    TimeLabelAutomationPeer peer;

#if SILVERLIGHT
                    peer = FrameworkElementAutomationPeer.FromElement(lblTime) as TimeLabelAutomationPeer;
#else
                    peer = UIElementAutomationPeer.FromElement(lblTime) as TimeLabelAutomationPeer;
#endif

                    if (peer != null)
                    {
                        peer.RaiseValueChangedEvent(e.OldValue.ToString(), e.NewValue.ToString());
                    }
                }
            }
        }
Пример #2
0
 /// <summary>
 /// Creates a new instance of time label automation peer.
 /// </summary>
 /// <param name="control">Time label control.</param>
 public TimeLabelAutomationPeer(TimeLabel control)
     : base(control)
 {
 }
Пример #3
0
 /// <summary>
 /// Creates a new instance of time label automation peer.
 /// </summary>
 /// <param name="control">Time label control.</param>
 public TimeLabelAutomationPeer(TimeLabel control)
     : base(control)
 {
 }