首页 新闻 搜索 专区 学院

win8 app中如何才从一个类中定义的注册事件中返回数据,让调用该类的方法得到这个数据

0
[已关闭问题] 关闭于 2013-08-05 14:55

在一个界面A上点击一个按钮事件,这个事件调用了一个方法B,方法B中注册了一个事件(这个事件是底层库的,不是马上就返回数据集,要几秒钟后才返回数据) ,有什么办法可以去获取到这来返回的数据作为数据源显示在A的listview上,下面是大致的代码:

 public class A         {             B MYB = new B();             MYB.B1Method();             //这里比如有个listview,我想让她的source为那边传回来的myFileInfoList

listview.itemsource = "这里用什么方法可以拿到那边回调函数传回来的数据???"谢谢了,         }         public class B         {             public void B1Method()             {                 IParseLayerSendDataParam mSendDlnaStandardParam = GrolbDataAccessManage.tDataAccessManager.CreateSendDataParam(GlobalCommand.COMMAND_SEND_DLAN_GET_FILE_LIST);

                mSendDlnaStandardParam.sIP = IP;                 mSendDlnaStandardParam.eOperate = EnumSendOperate.COMMAND_SEND_OPERATE_NORMAL;                 GrolbDataAccessManage.tDataAccessManager.OnAccessDataResultEvent += tDataAccessManager_OnAccessDataResultEvent;             }             void tDataAccessManager_OnAccessDataResultEvent(string sDeviceID, GlobalCommand iCommandID, IParseLayerReciveDataParam dataRecive, EnumAccessLayerResultFlag tmpFlag)             {                 List<FileInfo> myFileInfoList = new List<FileInfo>();                 if (tmpFlag.Equals(EnumAccessLayerResultFlag.ACCESS_LAYER_RESULT_SUCCESS))                 {                     if (dataRecive.ErrorNo == 0)                     {                         TDlnaReciveGetFileList myDataRecive = (TDlnaReciveGetFileList)dataRecive;                         //获取dlna信息成功                         foreach (var tmpItem in myDataRecive.nNodeItemList)                         {//想把这里获取到的myFileInfoList返回到上面去                             myFileInfoList.Add(new FileInfo()                             {                                 FileName = tmpItem.sTitle,                                 FileSize = Convert.ToString(tmpItem.iSize),                                 FileType = tmpItem.sNodeType,                                 FileUrl = tmpItem.sPath,                                 SmallImageUrl = tmpItem.sThumPath,                                 CreateTime = tmpItem.sDate

                            });                         }                     }                 }             }         }

zihaobiao的主页 zihaobiao | 初学一级 | 园豆:200
提问于:2013-05-18 00:26
< >
分享
所有回答(1)
0

自己解决,嘻嘻

zihaobiao | 园豆:200 (初学一级) | 2013-08-05 14:51
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册