用户在控件中插入文本所需的时间

时间:2019-03-29 14:12:27

标签: c# wpf mvvm

我最初的问题是能够将普通键盘与条形码扫描仪区分开来: 一个计时器,检查它是否太快,它必须是条形码扫描仪, 我尝试使用事件触发器,但找不到方法,因此我在后面隐藏了一些代码,还必须确保将注意力集中在正确的控件上

后端代码

#enable intuitive mouse behavior
set -g mouse off

# Refersh .tmux.conf
bind r source-file ~/.tmux.conf \;
display "Tmux Reloaded!"

# remap prefix from 'C-b' to 'C-a'
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix

# split panes using | and -
bind | split-window -h
bind - split-window -v
unbind '"'
unbind %

# switch panes using Alt-arrow without prefix
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D

# don't rename windows automatically
set-option -g allow-rename off

#Move window tabs around
bind-key -r "," swap-window -t -1 #press the < key without shift
bind-key -r "." swap-window -t +1 #press the > key without shift
bind-key -r "z" command-prompt -I "#W" "rename-window '%%'" #commands above forced me to map rename to z

# Start windows and panes at 1, not 0
set -g base-index 1 #Window indices start at 1
#setw -g pane-base-index 1

# Shift arrow to switch windows
bind -n S-Left  previous-window
bind -n S-Right next-window

# No delay for escape key press
set -sg escape-time 0

我的xaml

 private void UiTextBox_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
        {
            var window = Window.GetWindow(this);
            window.KeyDown += HandleKeyPress;
        }
        private void Windows_Loaded(object sender, RoutedEventArgs e)
        {

            var window = Window.GetWindow(this);
            NewPrelevementLigne.Focus();
            window.KeyDown += HandleKeyPress;


        }



        private void HandleKeyPress(object sender, KeyEventArgs e)
        {
            var cle = e.Key;
            var vm = (NewPrelevementVm)this.DataContext;
            vm.LigneAddCommand.Execute(null);
        }

我的命令

 <wpf:UiTextBlock    Grid.Row="0" Name="NewPrelevementLigne"   Grid.Column="0"  Text="{Binding Texts.NewPrelevementLigne,UpdateSourceTrigger=PropertyChanged}" FontWeight="SemiBold">

                </wpf:UiTextBlock>

0 个答案:

没有答案