コード例 #1
0
        protected virtual void OnWinkDefinitionReceived(object sender, WinkEventArgs e)
        {
            if (!autoRequestObjects)
            {
                return;
            }

            MSNObject existing = MSNObjectCatalog.GetInstance().Get(e.Wink.CalculateChecksum());

            if (existing == null)
            {
                // create a session and send the invitation
                ObjectTransfer winkTransfer = nsMessageHandler.P2PHandler.RequestMsnObject(e.Sender, e.Wink);
                winkTransfer.TransferAborted  += (winkTransfer_TransferAborted);
                winkTransfer.TransferFinished += (winkTransfer_TransferFinished);

                MSNObjectCatalog.GetInstance().Add(e.Wink);

                if (WinkDefinitionReceived != null)
                {
                    WinkDefinitionReceived(this, e);
                }
            }
            else
            {
                if (WinkDefinitionReceived != null)
                {
                    WinkDefinitionReceived(this, new WinkEventArgs(e.Sender, existing as Wink, e.RoutingInfo));
                }

                //If exists, fire the event.
                OnWinkReceived(this, new WinkEventArgs(e.Sender, existing as Wink, e.RoutingInfo));
            }
        }
コード例 #2
0
 protected virtual void OnWinkReceived(object sender, WinkEventArgs e)
 {
     if (WinkReceived != null)
     {
         WinkReceived(this, e);
     }
 }