/// <summary> /// Translates the specified text. /// </summary> /// <param name="view">The view.</param> /// <param name="text">The text.</param> public static void Translate(IWpfTextView view, string text) { TranslatePopupAdornment adornment = null; try { adornment = view.Properties.GetProperty <TranslatePopupAdornment>(typeof(TranslatePopupAdornment)); } catch (Exception e) { } if (adornment != null) { adornment.Translate(view.Selection.SelectedSpans[0], text); } }
#pragma warning restore 649, 169 /// <summary> /// Instantiates a TransplatePopupAdornment manager when a textView is created. /// </summary> /// <param name="textView">The <see cref="IWpfTextView"/> upon which the adornment should be placed</param> public void TextViewCreated(IWpfTextView textView) { TranslatePopupAdornment.Create(textView); }