コード例 #1
0
ファイル: OleToBCL.cs プロジェクト: Graham-Pedersen/IronPlot
 internal AdviseSink(IOleAdviseSink oleSink)
 {
     if (null == oleSink)
         throw new ArgumentNullException("Microsoft.VisualStudio.OLE.Interop.IAdviseSink");
     this.oleSink = oleSink;
     this.bclSink = oleSink as IBclAdviseSink;
 }
コード例 #2
0
ファイル: OleToBCL.cs プロジェクト: Graham-Pedersen/IronPlot
 internal AdviseSink(IBclAdviseSink bclSink)
 {
     if (null == bclSink)
         throw new ArgumentNullException("System.Runtime.InteropServices.ComTypes.IAdviseSink");
     this.oleSink = bclSink as IOleAdviseSink;
     this.bclSink = bclSink;
 }
コード例 #3
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);
        }
コード例 #4
0
 internal AdviseSink(IBclAdviseSink bclSink)
 {
     if (null == bclSink)
     {
         throw new ArgumentNullException("System.Runtime.InteropServices.ComTypes.IAdviseSink");
     }
     this.oleSink = bclSink as IOleAdviseSink;
     this.bclSink = bclSink;
 }
コード例 #5
0
 internal AdviseSink(IOleAdviseSink oleSink)
 {
     if (null == oleSink)
     {
         throw new ArgumentNullException("Microsoft.VisualStudio.OLE.Interop.IAdviseSink");
     }
     this.oleSink = oleSink;
     this.bclSink = oleSink as IBclAdviseSink;
 }
コード例 #6
0
ファイル: OleObjectBase.cs プロジェクト: olesar/Altaxo
 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;
     }
 }
コード例 #7
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);
        }