Example #1
0
 public TranslationMouseProcessor(IWpfTextView view)
 {
     try
     {
         _translationAdornmentManager = view.Properties.GetProperty <TranslationAdornmentManager>(typeof(TranslationAdornmentManager));
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
     }
 }
Example #2
0
        public static void Execute(IWpfTextView view, TranslationRequest request)
        {
            TranslationAdornmentManager manager = null;

            try
            {
                manager = view.Properties.GetProperty <TranslationAdornmentManager>(typeof(TranslationAdornmentManager));
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
            if (manager == null)
            {
                return;
            }

            manager.AddTranslation(view.Selection.SelectedSpans[0], request);
            request.GetTranslationAsync();
        }
Example #3
0
 public void TextViewCreated(IWpfTextView textView)
 {
     TranslationAdornmentManager.Create(textView);
     // AddCommandFilter(textView, new TranslationCommandFilter(textView));
 }
 public TranslationCommandFilter(IWpfTextView tv)
 {
     m_textView = tv;
     _translationAdornmentManager =
         m_textView.Properties.GetProperty<TranslationAdornmentManager>(typeof (TranslationAdornmentManager));
 }
Example #5
0
 public TranslationCommandFilter(IWpfTextView tv)
 {
     m_textView = tv;
     _translationAdornmentManager =
         m_textView.Properties.GetProperty <TranslationAdornmentManager>(typeof(TranslationAdornmentManager));
 }