Exemplo n.º 1
0
 internal AdviseSink(IBclAdviseSink bclSink)
 {
     if (null == bclSink)
         throw new ArgumentNullException("System.Runtime.InteropServices.ComTypes.IAdviseSink");
     this.oleSink = bclSink as IOleAdviseSink;
     this.bclSink = bclSink;
 }
Exemplo n.º 2
0
 internal AdviseSink(IOleAdviseSink oleSink)
 {
     if (null == oleSink)
         throw new ArgumentNullException("Microsoft.VisualStudio.OLE.Interop.IAdviseSink");
     this.oleSink = oleSink;
     this.bclSink = oleSink as IBclAdviseSink;
 }
Exemplo n.º 3
0
 internal AdviseSink(IBclAdviseSink bclSink)
 {
     if (null == bclSink)
     {
         throw new ArgumentNullException("System.Runtime.InteropServices.ComTypes.IAdviseSink");
     }
     this.oleSink = bclSink as IOleAdviseSink;
     this.bclSink = bclSink;
 }
Exemplo n.º 4
0
 internal AdviseSink(IOleAdviseSink oleSink)
 {
     if (null == oleSink)
     {
         throw new ArgumentNullException("Microsoft.VisualStudio.OLE.Interop.IAdviseSink");
     }
     this.oleSink = oleSink;
     this.bclSink = oleSink as IBclAdviseSink;
 }
Exemplo n.º 5
0
        int BclComTypes.IDataObject.DAdvise(ref BclComTypes.FORMATETC pFormatetc, BclComTypes.ADVF advf, BclComTypes.IAdviseSink adviseSink, out int connection)
        {
            if (null != bclData)
            {
                return(bclData.DAdvise(ref pFormatetc, advf, adviseSink, out connection));
            }

            OleInterop.FORMATETC[] oleFormat = new OleInterop.FORMATETC[1];
            oleFormat[0] = StructConverter.BclFormatETC2Ole(ref pFormatetc);
            uint result;

            OleInterop.IAdviseSink oleSink = adviseSink as OleInterop.IAdviseSink;
            if (null == oleSink)
            {
                oleSink = (OleInterop.IAdviseSink)(new AdviseSink(adviseSink));
            }
            int hr = oleData.DAdvise(oleFormat, (uint)advf, oleSink, out result);

            NativeMethods.ThrowOnFailure(hr);
            connection = (int)result;
            return(hr);
        }
Exemplo n.º 6
0
        int OleInterop.IDataObject.DAdvise(OleInterop.FORMATETC[] pFormatetc, uint ADVF, OleInterop.IAdviseSink pAdvSink, out uint pdwConnection)
        {
            if (null != oleData)
            {
                return(oleData.DAdvise(pFormatetc, ADVF, pAdvSink, out pdwConnection));
            }

            // We have to call the method in the BCL version of the interface, so we need to
            // convert the parameters to the other type of structure.

            // As first make sure that the array contains exactly one element.
            if ((null == pFormatetc) || (pFormatetc.Length != 1))
            {
                throw new ArgumentException();
            }

            // Now convert the patameters
            BclComTypes.FORMATETC   bclFormat = StructConverter.OleFormatETC2Bcl(ref pFormatetc[0]);
            BclComTypes.IAdviseSink bclSink   = pAdvSink as BclComTypes.IAdviseSink;
            if (null == bclSink)
            {
                bclSink = new AdviseSink(pAdvSink);
            }

            int connection;
            int hr = bclData.DAdvise(ref bclFormat, (BclComTypes.ADVF)(ADVF), bclSink, out connection);

            pdwConnection = (uint)connection;
            return(hr);
        }