Remote API 2 (RAPI2) Managed Wrapper

Windows Mobile とPCを連携しようとすると、ActiveSyncを使うことになりますが、ファイルの同期とか考えるとActiveSyncの機能だけではどうにも心許無いということで、RAPIを使おうかなと調べてました。

Native CのAPIしかないのかなぁと見ていると、RAPI2ってことでCOMのインタフェイスがありました。
どうせなら、C#で使いたいからだれかWrapper書いてないかなぁと調べてみたところ
Remote API 2 (RAPI2) Managed Wrapper
ありました。
感謝しつつゲット。

ざっと試してみたところ、とりあえず動くものの、接続、切断のイベントが飛んでこないなぁとソースを見てみると
RAPI.cs のところで、Sinkに繋いでるけどAdviseしなくても良いのかなぁと、コードを足してみたらイベント発生。
これでいいのかなぁ

"// added this code to enable an event. 2008/05/06 " のコメントのある行が追加部分(3行)

#.......................前略
        /// <summary>
        /// Creates a new instance of <c>RemoteDeviceManager</c>.
        /// </summary>
        public RemoteDeviceManager()
        {
            iSink = new RAPISink();
            iSink.DeviceConnected += new EventHandler(OnDeviceConnected);
            iSink.DeviceDisconnected += new EventHandler(OnDeviceDisconnected);
            iDesktop.Advise(iSink, out dwContext);  // added this code to enable an event.  2008/05/06
            this.Devices = new RAPIDeviceList(iDesktop);
        }
        int dwContext = 0;  // added this code to enable an event.  2008/05/06

        /// <summary>
        /// Cleans up all internal references.
        /// </summary>
        public void Dispose()
        {
            iDesktop.UnAdvise(dwContext);   // added this code to enable an event.  2008/05/06
            iSink.DeviceConnected -= OnDeviceConnected;
            iSink.DeviceDisconnected -= OnDeviceDisconnected;
            iSink = null;
            this.Devices = null;
            GC.SuppressFinalize(this);
        }
#.......................後略