Exemplo n.º 1
0
 private void TextBoxHeures_PreviewKeyDown(object sender, KeyEventArgs e)
 {
     // Si Entrer est pressé, on valide la date
     if (e.Key == Key.Enter || e.Key == Key.Space)
     {
         TextBoxMinutes.Focus();
     }
     else if (e.Key == Key.Delete)
     {
         TextBoxHeures.Text = "0";
     }
     else if (e.Key == Key.Right && TextBoxHeures.CaretIndex == TextBoxHeures.Text.Length)
     {
         TextBoxMinutes.Focus();
         TextBoxMinutes.CaretIndex = 0;
     }
     else if (e.Key == Key.Up)
     {
         TextBoxHeures.Text = UpDown(TextBoxHeures.Text, 1, 23);
     }
     else if (e.Key == Key.Down)
     {
         TextBoxHeures.Text = UpDown(TextBoxHeures.Text, -1, 23);
     }
 }
Exemplo n.º 2
0
 private void TextBoxSecondes_PreviewKeyDown(object sender, KeyEventArgs e)
 {
     // Si Entrer est pressé, on valide la date
     if (e.Key == Key.Enter || e.Key == Key.Space || e.Key == Key.Tab)
     {
         buttonProgrammerExtinction.Focus();
     }
     else if (e.Key == Key.Delete)
     {
         TextBoxSecondes.Text = "0";
     }
     else if (e.Key == Key.Left && TextBoxSecondes.CaretIndex == 0)
     {
         TextBoxMinutes.Focus();
         TextBoxMinutes.CaretIndex = TextBoxMinutes.Text.Length;
     }
     else if (e.Key == Key.Up)
     {
         TextBoxSecondes.Text = UpDown(TextBoxSecondes.Text, 1, 59);
     }
     else if (e.Key == Key.Down)
     {
         TextBoxSecondes.Text = UpDown(TextBoxSecondes.Text, -1, 59);
     }
 }
Exemplo n.º 3
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            // Sélection sur focus
            TextBoxHeures.AddHandler(PreviewMouseLeftButtonDownEvent, new RoutedEventHandler(ComponentsHelper.ToutSelectionnerSurFocus));
            TextBoxMinutes.AddHandler(PreviewMouseLeftButtonDownEvent, new RoutedEventHandler(ComponentsHelper.ToutSelectionnerSurFocus));
            TextBoxSecondes.AddHandler(PreviewMouseLeftButtonDownEvent, new RoutedEventHandler(ComponentsHelper.ToutSelectionnerSurFocus));

            // Focus sans sélection
            TextBoxHeures.AddHandler(PreviewMouseLeftButtonDownEvent, new MouseButtonEventHandler(ComponentsHelper.FocusSansClic));
            TextBoxMinutes.AddHandler(PreviewMouseLeftButtonDownEvent, new MouseButtonEventHandler(ComponentsHelper.FocusSansClic));
            TextBoxSecondes.AddHandler(PreviewMouseLeftButtonDownEvent, new MouseButtonEventHandler(ComponentsHelper.FocusSansClic));
        }