private void imageListView_ItemClick(object sender, ItemClickEventArgs e) { PhotoDownloader.PreloadPictures(m_post, true); List <string> _files = new List <string>(); foreach (var _file in imageListView.Items) { _files.Add(_file.FileName); } using (PhotoView _photoView = new PhotoView(m_imageAttachments, m_filePathOrigins, m_filePathMediums, m_filesMapping, int.Parse(e.Item.Tag.ToString()))) { _photoView.ShowDialog(); } }
private void Set_Pictures() { PhotoDownloader.PreloadPictures(m_post, true); imageListView.Items.Clear(); m_filePathOrigins = new List <string>(); m_filePathMediums = new List <string>(); m_imageAttachments = new List <Attachment>(); foreach (Attachment _a in Post.attachments) { if (_a.type == "image") { m_imageAttachments.Add(_a); } } if (m_imageAttachments.Count == 0) { return; } m_filesMapping.Clear(); foreach (Attachment _attachment in m_imageAttachments) { string _urlO = string.Empty; string _fileNameO = string.Empty; Main.Current.RT.REST.attachments_getRedirectURL_Image(_attachment, "origin", out _urlO, out _fileNameO, false); string _localFileO = Main.GCONST.CachePath + _fileNameO; m_filePathOrigins.Add(_localFileO); if (!m_filesMapping.ContainsKey(_fileNameO)) { if ((_attachment.file_name != string.Empty) && (!_attachment.file_name.Contains("?"))) { m_filesMapping.Add(_fileNameO, _attachment.file_name); } } string _urlM = string.Empty; string _fileNameM = string.Empty; Main.Current.RT.REST.attachments_getRedirectURL_Image(_attachment, "medium", out _urlM, out _fileNameM, false); string _localFileM = Main.GCONST.CachePath + _fileNameM; m_filePathMediums.Add(_localFileM); if (!m_filesMapping.ContainsKey(_fileNameM)) { if ((_attachment.file_name != string.Empty) && (!_attachment.file_name.Contains("?"))) { m_filesMapping.Add(_fileNameM, _attachment.file_name); } } } timer.Interval = ((m_imageAttachments.Count / 200) + 3) * 1000; if (!FillImageListView(true)) { timer.Enabled = true; } }