private void DeactivateThreadManager() { if (_threadManager != null) { if (_threadManager.Value != null) { // On XP, if we're called on a worker thread (during AppDomain shutdown) // we can't call call any methods on _threadManager. The problem is // that there's no proxy registered for ITfThreadMgr on OS versions // previous to Vista. Not calling Deactivate will leak the IMEs, but // in practice (1) they're singletons, so it's not unbounded; and (2) // most applications will share the thread with other AppDomains that // have a UI, in which case the IME won't be released until the process // shuts down in any case. In theory we could also work around this // problem by creating our own XP proxy/stub implementation, which would // be added to WPF setup.... if (_thread == Thread.CurrentThread || System.Environment.OSVersion.Version.Major >= 6) { _threadManager.Value.Deactivate(); } Marshal.ReleaseComObject(_threadManager.Value); } _threadManager = null; } // ThreadManager was deactivated. It is time to release this TextServicesHost. TextEditorThreadLocalStore threadLocalStore = TextEditor._ThreadLocalStore; threadLocalStore.TextServicesHost = null; }
private void DeactivateThreadManager() { if (this._threadManager != null) { if (this._threadManager.Value != null) { if (this._thread == Thread.CurrentThread || Environment.OSVersion.Version.Major >= 6) { this._threadManager.Value.Deactivate(); } Marshal.ReleaseComObject(this._threadManager.Value); } this._threadManager = null; } TextEditorThreadLocalStore threadLocalStore = TextEditor._ThreadLocalStore; threadLocalStore.TextServicesHost = null; }
// Token: 0x06002B27 RID: 11047 RVA: 0x000C4E14 File Offset: 0x000C3014 internal void OnRenderCaretSubElement(DrawingContext context) { this.Win32SetCaretPos(); if (this._showCaret) { TextEditorThreadLocalStore threadLocalStore = TextEditor._ThreadLocalStore; Invariant.Assert(!this._italic || !this.IsInInterimState, "Assert !(_italic && IsInInterimState)"); int num = 0; context.PushOpacity(this._opacity); num++; if (this._italic && !threadLocalStore.Bidi) { FlowDirection flowDirection = (FlowDirection)base.AdornedElement.GetValue(FrameworkElement.FlowDirectionProperty); context.PushTransform(new RotateTransform((double)((flowDirection == FlowDirection.RightToLeft) ? -20 : 20), 0.0, this._height)); num++; } if (this.IsInInterimState || this._systemCaretWidth > 1.0) { context.PushOpacity(0.5); num++; } if (this.IsInInterimState) { context.DrawRectangle(this._caretBrush, null, new Rect(0.0, 0.0, this._interimWidth, this._height)); } else { if (!this._italic || threadLocalStore.Bidi) { GuidelineSet guidelines = new GuidelineSet(new double[] { -(this._systemCaretWidth / 2.0), this._systemCaretWidth / 2.0 }, null); context.PushGuidelineSet(guidelines); num++; } context.DrawRectangle(this._caretBrush, null, new Rect(-(this._systemCaretWidth / 2.0), 0.0, this._systemCaretWidth, this._height)); } if (threadLocalStore.Bidi) { double num2 = 2.0; FlowDirection flowDirection2 = (FlowDirection)base.AdornedElement.GetValue(FrameworkElement.FlowDirectionProperty); if (flowDirection2 == FlowDirection.RightToLeft) { num2 *= -1.0; } PathGeometry pathGeometry = new PathGeometry(); PathFigure pathFigure = new PathFigure(); pathFigure.StartPoint = new Point(0.0, 0.0); pathFigure.Segments.Add(new LineSegment(new Point(-num2, 0.0), true)); pathFigure.Segments.Add(new LineSegment(new Point(0.0, this._height / 10.0), true)); pathFigure.IsClosed = true; pathGeometry.Figures.Add(pathFigure); context.DrawGeometry(this._caretBrush, null, pathGeometry); } for (int i = 0; i < num; i++) { context.Pop(); } return; } this.Win32DestroyCaret(); }