Esempio n. 1
0
        internal static void StartTransitoryExtension(TextStore textstore)
        {
            UnsafeNativeMethods.ITfCompartmentMgr tfCompartmentMgr = textstore.DocumentManager as UnsafeNativeMethods.ITfCompartmentMgr;
            Guid guid = UnsafeNativeMethods.GUID_COMPARTMENT_TRANSITORYEXTENSION;

            UnsafeNativeMethods.ITfCompartment tfCompartment;
            tfCompartmentMgr.GetCompartment(ref guid, out tfCompartment);
            object obj = 2;

            tfCompartment.SetValue(0, ref obj);
            guid = UnsafeNativeMethods.IID_ITfTransitoryExtensionSink;
            UnsafeNativeMethods.ITfSource tfSource = textstore.DocumentManager as UnsafeNativeMethods.ITfSource;
            if (tfSource != null)
            {
                int transitoryExtensionSinkCookie;
                tfSource.AdviseSink(ref guid, textstore, out transitoryExtensionSinkCookie);
                textstore.TransitoryExtensionSinkCookie = transitoryExtensionSinkCookie;
            }
            Marshal.ReleaseComObject(tfCompartment);
        }
Esempio n. 2
0
        internal static void StopTransitoryExtension(TextStore textstore)
        {
            UnsafeNativeMethods.ITfCompartmentMgr tfCompartmentMgr = textstore.DocumentManager as UnsafeNativeMethods.ITfCompartmentMgr;
            if (textstore.TransitoryExtensionSinkCookie != -1)
            {
                UnsafeNativeMethods.ITfSource tfSource = textstore.DocumentManager as UnsafeNativeMethods.ITfSource;
                if (tfSource != null)
                {
                    tfSource.UnadviseSink(textstore.TransitoryExtensionSinkCookie);
                }
                textstore.TransitoryExtensionSinkCookie = -1;
            }
            Guid guid_COMPARTMENT_TRANSITORYEXTENSION = UnsafeNativeMethods.GUID_COMPARTMENT_TRANSITORYEXTENSION;

            UnsafeNativeMethods.ITfCompartment tfCompartment;
            tfCompartmentMgr.GetCompartment(ref guid_COMPARTMENT_TRANSITORYEXTENSION, out tfCompartment);
            object obj = 0;

            tfCompartment.SetValue(0, ref obj);
            Marshal.ReleaseComObject(tfCompartment);
        }
Esempio n. 3
0
        //------------------------------------------------------
        //
        //  Constructors
        //
        //------------------------------------------------------

        internal TextServicesCompartment(Guid guid, UnsafeNativeMethods.ITfCompartmentMgr compartmentmgr)
        {
            _guid           = guid;
            _compartmentmgr = new SecurityCriticalData <UnsafeNativeMethods.ITfCompartmentMgr>(compartmentmgr);
            _cookie         = UnsafeNativeMethods.TF_INVALID_COOKIE;
        }