コード例 #1
0
            private void OnKeyInputBuffered(object sender, KeyInputSetEventArgs args)
            {
                try
                {
                    var globalSettings = _vimBuffer.GlobalSettings;

                    // If 'timeout' is not enabled then ensure the timer is disabled and return.  Ensuring
                    // it's disabled is necessary because the 'timeout' could be disabled in the middle
                    // of processing a key mapping
                    if (!globalSettings.Timeout)
                    {
                        _timer.Stop();
                    }

                    if (_timer.IsEnabled)
                    {
                        _timer.Stop();
                    }

                    _timer.Interval = TimeSpan.FromMilliseconds(globalSettings.TimeoutLength);
                    _timer.Start();
                }
                catch (Exception ex)
                {
                    // Several DispatcherTimer operations including setting the Interval can throw
                    // so catch them all here
                    _protectedOperations.Report(ex);
                }
            }
コード例 #2
0
            private void OnKeyInputBuffered(object sender, KeyInputSetEventArgs args)
            {
                try
                {
                    var globalSettings = _vimBuffer.GlobalSettings;

                    // If 'timeout' is not enabled then ensure the timer is disabled and return.  Ensuring
                    // it's disabled is necessary because the 'timeout' could be disabled in the middle
                    // of processing a key mapping
                    if (!globalSettings.Timeout)
                    {
                        _timer.Stop();
                    }

                    if (_timer.IsEnabled)
                    {
                        _timer.Stop();
                    }

                    _timer.Interval = TimeSpan.FromMilliseconds(globalSettings.TimeoutLength);
                    _timer.Start();
                }
                catch (Exception ex)
                {
                    // Several DispatcherTimer operations including setting the Interval can throw 
                    // so catch them all here
                    _protectedOperations.Report(ex);
                }
            }