private void _coreWindow_Activated(CoreWindow sender, WindowActivatedEventArgs args)
 {
     if (_internalFocus)
     {
         _editContext.NotifyFocusEnter();
         _inputPane.TryShow();
     }
 }
예제 #2
0
        /*
         *  editContextを作り直します。
         */
        void UpdateEditContext()
        {
            if (DesignMode.DesignModeEnabled)
            {
                // ビューデザイナーの中で動作している場合は何もしない。

                return;
            }

            // CoreTextEditContextオブジェクトを作ります。
            // IMEとのやりとりはこのオブジェクトを使います。
            Debug.WriteLine("--->> CreateEditContext");
            editContext = textServiceManager.CreateEditContext();

            // IMEの各種のイベントハンドラを登録します。
            Debug.WriteLine("--->> Subscribe IME Event");
            editContext.CompositionStarted        += EditContext_CompositionStarted;
            editContext.CompositionCompleted      += EditContext_CompositionCompleted;
            editContext.FocusRemoved              += EditContext_FocusRemoved;
            editContext.LayoutRequested           += EditContext_LayoutRequested;
            editContext.NotifyFocusLeaveCompleted += EditContext_NotifyFocusLeaveCompleted;
            editContext.SelectionRequested        += EditContext_SelectionRequested;
            editContext.SelectionUpdating         += EditContext_SelectionUpdating;
            editContext.TextRequested             += EditContext_TextRequested;
            editContext.TextUpdating              += EditContext_TextUpdating;
            editContext.FormatUpdating            += EditContext_FormatUpdating;

            // IMEにフォーカスの取得を知らせます。
            Debug.WriteLine("--->> NotifyFocusEnter");
            editContext.NotifyFocusEnter();
        }
예제 #3
0
        void SetInternalFocus()
        {
            if (!_internalFocus)
            {
                // Update internal notion of focus.
                _internalFocus = true;

                // Update the UI.
                UpdateTextUI();
                UpdateFocusUI();

                // Notify the CoreTextEditContext that the edit context has focus,
                // so it should start processing text input.
                _editContext.NotifyFocusEnter();
            }

            // Ask the software keyboard to show.  The system will ultimately decide if it will show.
            // For example, it will not show if there is a keyboard attached.
            _inputPane.TryShow();
        }