示例#1
0
        void txtPos_LostFocus(object sender, EventArgs e)
        {
            ((NumericTextBox)(sender)).IsReadOnly = true;

            (DataContext as GrblViewModel).SuspendPositionNotifications = false;

            if (hasFocus)
            {
                (sender as NumericTextBox).Background = background;
                (DataContext as GrblViewModel).Position.Values[(int)(sender as NumericTextBox).Tag] = orgpos;
            }

            hasFocus = false;

            DROEnabledChanged?.Invoke(false);
        }
示例#2
0
        private void txtPos_KeyPress(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Enter)
            {
                NumericTextBox axis = (NumericTextBox)sender;

                if (axis.Value != orgpos)
                {
                    AxisPositionChanged(GrblInfo.AxisIndexToLetter((int)axis.Tag), axis.Value);
                }

                axis.IsReadOnly = true;

                DROEnabledChanged?.Invoke(false);
            }
        }
示例#3
0
        private void TxtReadout_GotFocus(object sender, RoutedEventArgs e)
        {
            if (IsFocusable && !(DataContext as GrblViewModel).IsJobRunning)
            {
                (DataContext as GrblViewModel).SuspendPositionNotifications = true;

                orgpos = (DataContext as GrblViewModel).Position.Values[(int)((NumericTextBox)(sender)).Tag];

                background = (sender as NumericTextBox).Background;
                (sender as NumericTextBox).IsReadOnly = false;
                (sender as NumericTextBox).Background = Brushes.White;

                hasFocus = true;

                DROEnabledChanged?.Invoke(true);
            }
        }