public static List <AdvertisementObject> RefreshAdvertisement(string cinema) { List <AdvertisementObject> lists = new List <AdvertisementObject>(); string xml = hiPiaoSrv.GetAdvertisement(); XmlDocument doc = new XmlDocument(); doc.LoadXml(xml); AdvertisementObject obj = null; XmlNodeList objsNode = doc.SelectNodes("//advertisement"); string picurl = string.Empty; string downdir = "Caches\\Advertisement\\"; for (int i = 0; i < objsNode.Count; i++) { obj = new AdvertisementObject(); obj.AdvName = objsNode[i].Attributes["advName"].Value; obj.AdvPicLink = objsNode[i].Attributes["advPicLink"].Value; obj.AdvWeizhiOne = objsNode[i].Attributes["advWeizhiOne"].Value; obj.AdvWeizhiTwo = objsNode[i].Attributes["advWeizhiTwo"].Value; picurl = objsNode[i].Attributes["advPic"].Value; obj.AdImagePath = DownLoad(picurl, downdir, string.Empty); if (obj.AdImagePath.Length > 0) { obj.AdvPic = Image.FromFile(obj.AdImagePath); } //picurl="http://img.hipiao.com/hipiao15/film/201208/174732921950207b3c903e3.jpg" pixlength="89" pixnumber="05110035" //pixtype lists.Add(obj); } advertisementLists = lists; return(lists); }
public static List<AdvertisementObject> RefreshAdvertisement(string cinema) { List<AdvertisementObject> lists = new List<AdvertisementObject>(); string xml = hiPiaoSrv.GetAdvertisement(); XmlDocument doc = new XmlDocument(); doc.LoadXml(xml); AdvertisementObject obj = null; XmlNodeList objsNode = doc.SelectNodes("//advertisement"); string picurl = string.Empty; string downdir = "Caches\\Advertisement\\" ; for (int i = 0; i < objsNode.Count; i++) { obj = new AdvertisementObject(); obj.AdvName = objsNode[i].Attributes["advName"].Value; obj.AdvPicLink = objsNode[i].Attributes["advPicLink"].Value; obj.AdvWeizhiOne = objsNode[i].Attributes["advWeizhiOne"].Value; obj.AdvWeizhiTwo = objsNode[i].Attributes["advWeizhiTwo"].Value; picurl = objsNode[i].Attributes["advPic"].Value; obj.AdImagePath = DownLoad(picurl, downdir, string.Empty); if (obj.AdImagePath.Length > 0) obj.AdvPic = Image.FromFile(obj.AdImagePath); //picurl="http://img.hipiao.com/hipiao15/film/201208/174732921950207b3c903e3.jpg" pixlength="89" pixnumber="05110035" //pixtype lists.Add(obj); } advertisementLists = lists; return lists; }