internal AdviseSink(IOleAdviseSink oleSink) { if (null == oleSink) throw new ArgumentNullException("Microsoft.VisualStudio.OLE.Interop.IAdviseSink"); this.oleSink = oleSink; this.bclSink = oleSink as IBclAdviseSink; }
internal AdviseSink(IBclAdviseSink bclSink) { if (null == bclSink) throw new ArgumentNullException("System.Runtime.InteropServices.ComTypes.IAdviseSink"); this.oleSink = bclSink as IOleAdviseSink; this.bclSink = bclSink; }
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); }
internal AdviseSink(IBclAdviseSink bclSink) { if (null == bclSink) { throw new ArgumentNullException("System.Runtime.InteropServices.ComTypes.IAdviseSink"); } this.oleSink = bclSink as IOleAdviseSink; this.bclSink = bclSink; }
internal AdviseSink(IOleAdviseSink oleSink) { if (null == oleSink) { throw new ArgumentNullException("Microsoft.VisualStudio.OLE.Interop.IAdviseSink"); } this.oleSink = oleSink; this.bclSink = oleSink as IBclAdviseSink; }
public int Advise(System.Runtime.InteropServices.ComTypes.IAdviseSink pAdvSink, out int cookie) { ComDebug.ReportInfo("{0}.IOleObject.Advise", GetType().Name); try { _oleAdviseHolder.Advise(pAdvSink, out cookie); return(ComReturnValue.NOERROR); } catch (Exception e) { ComDebug.ReportError("{0}.IOleObject.Advise caused an exception: {1}", GetType().Name, e); throw; } }
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); }