Пример #1
0
        //------------------------------------------------------
        //
        //  public Events
        //
        //------------------------------------------------------

        //------------------------------------------------------
        //
        //  Private Methods
        //
        //------------------------------------------------------

        private void SetFocusOnDim(ITfDocumentMgr dim)
        {
            ITfThreadMgrEx threadmgr = ThreadManager;

            if (threadmgr != null)
            {
                ITfDocumentMgr prevDocMgr;
                threadmgr.AssociateFocus(InputMethod.WindowHandle, dim, out prevDocMgr);
            }
        }
Пример #2
0
        // Called by framework's TextStore class.  This method registers a
        // document with TSF.  The TextServicesContext must maintain this list
        // to ensure all native resources are released after gc or uninitialization.
        public void RegisterTextStore(TextStore defaultTextStore)
        {
            _defaultTextStore = defaultTextStore;

            ITfThreadMgrEx threadManager = ThreadManager;

            if (threadManager != null)
            {
                ITfDocumentMgr doc;
                int            editCookie = TF_INVALID_COOKIE;

                // Activate TSF on this thread if this is the first TextStore.
                if (_istimactivated == false)
                {
                    //temp variable created to retrieve the value
                    // which is then stored in the critical data.
                    if (InputMethod.ShowOSImeWindow)
                    {
                        threadManager.Activate(out _clientId);
                    }
                    else
                    {
                        threadManager.ActivateEx(out _clientId, TfTmaeFlags.Uielementenabledonly);
                    }

                    _istimactivated = true;
                }

                // Create a TSF document.
                threadManager.CreateDocumentMgr(out doc);
                _defaultTextStore.DocumentManager = doc;

                doc.CreateContext(_clientId, 0 /* flags */, _defaultTextStore, out _editContext, out editCookie);
                _defaultTextStore.EditCookie = editCookie;
                _contextOwnerServices        = _editContext.QueryInterface <ITfContextOwnerServices>();

                doc.Push(_editContext);

                AdviseSinks();
            }
        }