示例#1
0
 private void CleanupLogicAndInputListener()
 {
     Logic?.Dispose();
     _inputListener?.Dispose();
     Logic          = null;
     _inputListener = null;
 }
示例#2
0
 protected void OnKeyboardAction(object oSender, char?key, KeyEventType eventType)
 {
     Logic = Logic ?? throw new Exception($"{nameof(OnKeyboardAction)} in {nameof(CocoJumperBaseCommand)}, {nameof(Logic)} is null");
     if (Logic.KeyboardAction(key, eventType) == CocoJumperKeyboardActionResult.Finished)
     {
         CleanupLogicAndInputListener();
     }
 }
示例#3
0
        protected void Execute(object sender, EventArgs e)
        {
            ThreadHelper.ThrowIfNotOnUIThread();
            IVsTextView              textView    = _vsTextManager.GetActiveView();
            IWpfTextView             wpfTextView = _editorAdaptersFactoryService.GetWpfTextView(textView);
            CocoJumperCommandPackage cocoJumperCommandPackage = (CocoJumperCommandPackage)_package;

            CleanupLogicAndInputListener();
            WpfViewProvider renderer = new WpfViewProvider(wpfTextView);

            Logic          = new CocoJumperLogic(renderer, cocoJumperCommandPackage);
            _inputListener = new InputListener(textView);
            _inputListener.KeyPressEvent += OnKeyboardAction;

            ExecutePostAction();
        }