Пример #1
0
 protected virtual void OnEmoticonDefinitionReceived(EmoticonDefinitionEventArgs e)
 {
     if (EmoticonDefinitionReceived != null)
         EmoticonDefinitionReceived(this, e);
 }
Пример #2
0
        protected virtual void OnEmoticonDefinitionReceived(object sender, EmoticonDefinitionEventArgs e)
        {
            if (!autoRequestObjects)
                return;

            MSNObject existing = MSNObjectCatalog.GetInstance().Get(e.Emoticon.CalculateChecksum());
            if (existing == null)
            {
                e.Sender.Emoticons[e.Emoticon.Sha] = e.Emoticon;

                // create a session and send the invitation
                ObjectTransfer emoticonTransfer = nsMessageHandler.P2PHandler.RequestMsnObject(e.Sender, e.Emoticon);
                emoticonTransfer.TransferAborted += (emoticonTransfer_TransferAborted);
                emoticonTransfer.TransferFinished += (emoticonTransfer_TransferFinished);

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

                if (EmoticonDefinitionReceived != null)
                    EmoticonDefinitionReceived(this, e);
            }
            else
            {
                if (EmoticonDefinitionReceived != null)
                    EmoticonDefinitionReceived(this, e);

                Emoticon existingEmoticon = existing as Emoticon;

                //If exists and data were ready, fire the event.
                if(existingEmoticon.DataReady)
                {
                    OnEmoticonReceived(this, new EmoticonArrivedEventArgs(e.Sender, existingEmoticon, null, e.RoutingInfo));
                }else{
                    Trace.WriteLineIf(Settings.TraceSwitch.TraceWarning,
                                      "An emoticon definition has been received, but the emoticon data were not yet completed.");
                }
            }
        }