private void onPFile(P2PFileMsg pfile) { exUser user = findUser(pfile.from ); if (user != null) { FormTalkUser fs = user.Tag as FormTalkUser; if (pfile.type == type.New)//如果是接收新文件 { fs = GetUserMsgForm(user); fs.ReceiveFile(pfile); fs.Show(); fs.Activate(); } else if (pfile.type == type.cancel)//如果是取消文件传输 { if (fs != null || !fs.IsDisposed) { fs.CancelFile(pfile); } } else if (pfile.type == type.set) { if (fs != null || !fs.IsDisposed) { fs.setFileRometEP(pfile); } } } }
void msgServer_RouteP2PFileTransmit(object sender, MsgServerEventArgs e) { IMLibrary3.Protocol.P2PFileMsg msg = e.obj as IMLibrary3.Protocol.P2PFileMsg; SendMessageToUser(msg.to, e.XMLMsg); }