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); }
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; }