public UploadFile(YiChe yc, string ImageUpload) { StartPosition = FormStartPosition.CenterScreen; InitializeComponent(); this.yc = yc; this.ImageUpload = ImageUpload; doc = yc.InforManagerNews(ImageUpload); var currentargsjs = doc.DocumentNode.SelectNodes("//script")[6].OuterHtml.Trim().Split('\r'); foreach (string str in currentargsjs) { if (str.Contains("CurrentArgs")) { currentargs = str.Replace("\n var CurrentArgs = '", "").Replace("'", ""); break; } } var piclink = doc.DocumentNode.SelectSingleNode("//a[contains(@href, 'SelectExsitPic')]"); if (piclink != null) { SelectExsitPic = url + piclink.GetAttributeValue("href", ""); } InitImg(0); }
public PhotoSelectNew(YiChe yc, string csid) { StartPosition = FormStartPosition.CenterScreen; InitializeComponent(); this.yc = yc; this.csid = csid; currentPage = PreviousPage = lbtn1; doc = yc.InforManagerNews(photoUrl + csid); InitDll(0); InitImg(); InitPage(); }
private void InitImg(int type) { if (type == 0) { doc = yc.InforManagerNews(SelectExsitPic); } var viewstate = doc.GetElementbyId("__VIEWSTATE"); if (viewstate != null) { str_viewstate = HttpHelper.URLEncode(viewstate.GetAttributeValue("value", "")); } var viewstategenerator = doc.GetElementbyId("__VIEWSTATEGENERATOR"); if (viewstategenerator != null) { str_viewstategenerator = viewstategenerator.GetAttributeValue("value", ""); } var eventvalidation = doc.GetElementbyId("__EVENTVALIDATION"); if (eventvalidation != null) { str_eventvalidation = HttpHelper.URLEncode(eventvalidation.GetAttributeValue("value", "")); } var imgs = doc.GetElementbyId("alert_imgs_mng"); if (imgs != null) { panel1.Controls.Clear(); var imgList = imgs.SelectNodes(".//li"); int xstep = 143; int ystep = 116; int xstart = 3; int ystart = 3; for (int i = 0; i < imgList.Count; i++) { var thumb = imgList[i].SelectSingleNode(".//img").GetAttributeValue("src", ""); var artwork = imgList[i].SelectSingleNode(".//div/a[contains(@href, 'http')]").GetAttributeValue("href", ""); var id = imgList[i].SelectSingleNode(".//div/a[contains(@href, 'java')]").GetAttributeValue("href", "").Replace("javascript:deleteWindow(", "").Replace(");", ""); var name = imgList[i].SelectSingleNode(".//input[@name='hiddenclid']").GetAttributeValue("value", ""); int x = xstart; int y = ystart; if (i > 0) { x = xstart + (xstep * (i % 4)); y = ystart + (ystep * (i / 4)); } var img = new ImgControl1(); img.Location = new System.Drawing.Point(x, y); img.Name = string.Format("img{0}", i); img.Tag = name; img.Size = new System.Drawing.Size(122, 98); img.pbxImg.ImageLocation = thumb; img.lblFocusImg.Tag = artwork; img.lblDel.Tag = id; img.Click += Img_Click; img.pbxImg.Click += Img_Click; img.lblDel.Click += LblDel_Click; panel1.Controls.Add(img); } if (type == 0) { int count = 0; if (!doc.DocumentNode.OuterHtml.Contains("此分类下没有图片")) { var pager = doc.GetElementbyId("pager1"); if (pager != null) { var pagerLinks = pager.SelectNodes(".//a"); var recordCount = pagerLinks[pagerLinks.Count - 1].GetAttributeValue("href", "").Replace("javascript:__doPostBack('pager1','", "").Replace("'", "").Replace(")", ""); count = Convert.ToInt32(recordCount) * 8; } } ucPager.RecordCount = count; ucPager.PageIndex = 1; ucPager.InitPageInfo(); ucPager.PageChanged -= UcPager_PageChanged; ucPager.PageChanged += UcPager_PageChanged; } } }