internal virtual void OnEndEdit(UnsafeNativeMethods.ITfContext context, int ecReadOnly, UnsafeNativeMethods.ITfEditRecord editRecord)
        {
            UnsafeNativeMethods.ITfProperty   tfProperty     = null;
            UnsafeNativeMethods.IEnumTfRanges propertyUpdate = this.GetPropertyUpdate(editRecord);
            UnsafeNativeMethods.ITfRange[]    array          = new UnsafeNativeMethods.ITfRange[1];
            int num;

            while (propertyUpdate.Next(1, array, out num) == 0)
            {
                ITextPointer textPointer;
                ITextPointer textPointer2;
                this.ConvertToTextPosition(array[0], out textPointer, out textPointer2);
                if (tfProperty == null)
                {
                    context.GetProperty(ref this._guid, out tfProperty);
                }
                UnsafeNativeMethods.IEnumTfRanges enumTfRanges;
                if (tfProperty.EnumRanges(ecReadOnly, out enumTfRanges, array[0]) == 0)
                {
                    UnsafeNativeMethods.ITfRange[] array2 = new UnsafeNativeMethods.ITfRange[1];
                    while (enumTfRanges.Next(1, array2, out num) == 0)
                    {
                        this.OnRange(tfProperty, ecReadOnly, array2[0]);
                        Marshal.ReleaseComObject(array2[0]);
                    }
                    Marshal.ReleaseComObject(enumTfRanges);
                }
                Marshal.ReleaseComObject(array[0]);
            }
            Marshal.ReleaseComObject(propertyUpdate);
            if (tfProperty != null)
            {
                Marshal.ReleaseComObject(tfProperty);
            }
        }
예제 #2
0
        internal virtual void OnEndEdit(UnsafeNativeMethods.ITfContext context,
                                        int ecReadOnly,
                                        UnsafeNativeMethods.ITfEditRecord editRecord)
        {
            int fetched;

            UnsafeNativeMethods.IEnumTfRanges ranges;
            UnsafeNativeMethods.ITfProperty   prop = null;

            ranges = GetPropertyUpdate(editRecord);

            UnsafeNativeMethods.ITfRange [] outRanges;
            outRanges = new UnsafeNativeMethods.ITfRange[1];
            while (ranges.Next(1, outRanges, out fetched) == 0)
            {
                //
                // check the element has enabled dynamic property.
                //
                ITextPointer start;
                ITextPointer end;

                ConvertToTextPosition(outRanges[0], out start, out end);

                if (prop == null)
                {
                    context.GetProperty(ref _guid, out prop);
                }

                UnsafeNativeMethods.IEnumTfRanges rangesProp;

                if (prop.EnumRanges(ecReadOnly, out rangesProp, outRanges[0]) == 0)
                {
                    UnsafeNativeMethods.ITfRange [] outRangesProp;
                    outRangesProp = new UnsafeNativeMethods.ITfRange[1];
                    while (rangesProp.Next(1, outRangesProp, out fetched) == 0)
                    {
                        OnRange(prop, ecReadOnly, outRangesProp[0]);
                        Marshal.ReleaseComObject(outRangesProp[0]);
                    }
                    Marshal.ReleaseComObject(rangesProp);
                }

                Marshal.ReleaseComObject(outRanges[0]);
            }
            Marshal.ReleaseComObject(ranges);
            if (prop != null)
            {
                Marshal.ReleaseComObject(prop);
            }
        }