OSDN Git Service

フォーカスロスト時にテキストサービスマネージャを作り直さないとおかしなことになる
authortest <test@yahoo.co.jp>
Fri, 20 Apr 2018 10:55:13 +0000 (19:55 +0900)
committertest <test@yahoo.co.jp>
Fri, 20 Apr 2018 10:55:13 +0000 (19:55 +0900)
UWP/FooEditEngine.UWP/FooTextBox.cs

index 1f05ce1..6a1a817 100644 (file)
@@ -444,6 +444,9 @@ namespace FooEditEngine.UWP
         {
             this.RemoveTextContext();
 
+            this.textServiceManager.InputLanguageChanged -= TextServiceManager_InputLanguageChanged;
+            this.textServiceManager = null;
+
             System.Diagnostics.Debug.WriteLine("losing focus");
         }
 
@@ -515,6 +518,7 @@ namespace FooEditEngine.UWP
         {
             if(this.textEditContext != null)
             {
+                this.textEditContext.NotifyFocusLeave();
                 this.textEditContext.CompositionStarted -= TextEditContext_CompositionStarted;
                 this.textEditContext.CompositionCompleted -= TextEditContext_CompositionCompleted;
                 this.textEditContext.LayoutRequested -= TextEditContext_LayoutRequested;
@@ -525,7 +529,6 @@ namespace FooEditEngine.UWP
                 this.textEditContext.FormatUpdating -= TextEditContext_FormatUpdating;
                 this.textEditContext.FocusRemoved -= TextEditContext_FocusRemoved;
                 this.textEditContext.NotifyFocusLeaveCompleted -= TextEditContext_NotifyFocusLeaveCompleted;
-                this.textEditContext.NotifyFocusLeave();
                 this.textEditContext = null;
             }
         }