コード例 #1
0
 public TranslationMouseProcessor(IWpfTextView view)
 {
     try
     {
         _translationAdornmentManager = view.Properties.GetProperty <TranslationAdornmentManager>(typeof(TranslationAdornmentManager));
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
     }
 }
コード例 #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();
        }
コード例 #3
0
 public void TextViewCreated(IWpfTextView textView)
 {
     TranslationAdornmentManager.Create(textView);
     // AddCommandFilter(textView, new TranslationCommandFilter(textView));
 }
コード例 #4
0
 public TranslationCommandFilter(IWpfTextView tv)
 {
     m_textView = tv;
     _translationAdornmentManager =
         m_textView.Properties.GetProperty<TranslationAdornmentManager>(typeof (TranslationAdornmentManager));
 }
コード例 #5
0
 public TranslationCommandFilter(IWpfTextView tv)
 {
     m_textView = tv;
     _translationAdornmentManager =
         m_textView.Properties.GetProperty <TranslationAdornmentManager>(typeof(TranslationAdornmentManager));
 }