예제 #1
0
        private static void UseValidTimesChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            TimeCtrl tc = d as TimeCtrl;

            if (tc != null && e.NewValue is bool)
            {
                tc.SetIsValidTime();
            }
        }
예제 #2
0
        private static void TextAlignmentChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            TimeCtrl tc = d as TimeCtrl;

            if (tc != null && e.NewValue is TextAlignment)
            {
                tc.TextBoxCtrl.TextAlignment = (TextAlignment)e.NewValue;
                tc.ReloadTimeCtrlsGrid();
            }
        }
예제 #3
0
 void ChangeTimeCtrlAlignment(TimeCtrl tc)
 {
     if (tc.TextAlignment == TextAlignment.Left)
     {
         tc.TextAlignment = TextAlignment.Center;
     }
     else if (tc.TextAlignment == TextAlignment.Center)
     {
         tc.TextAlignment = TextAlignment.Right;
     }
     else
     {
         tc.TextAlignment = TextAlignment.Left;
     }
 }
예제 #4
0
        private static void IsValidTimeChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            TimeCtrl tc = d as TimeCtrl;

            if (tc != null && e.NewValue is bool)
            {
                foreach (FrameworkElement fe in tc.TimeCtrls.Children)
                {
                    if (fe is TextBox)
                    {
                        ((TextBox)fe).Foreground = tc.TextBrush;
                    }
                    else if (fe is TextBlock)
                    {
                        ((TextBlock)fe).Foreground = tc.TextBrush;
                    }
                }
            }
        }
예제 #5
0
        private static void ValueChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            TimeCtrl tc = d as TimeCtrl;

            if (tc != null && e.NewValue is DateTime)
            {
                foreach (UIElement ele in tc.TimeCtrls.Children)
                {
                    var ctrl = ele as FrameworkElement;

                    HMSType hmsType = ctrl.get_HMSType();

                    if (hmsType != HMSType.unknown)
                    {
                        var tb = ctrl as TextBox;
                        if (tb != null)
                        {
                            tb.set_HMSText((DateTime)e.NewValue);
                        }
                    }
                }
                tc.SetIsValidTime();
            }
        }