private void TimerGetSecond_Tick(object sender, System.EventArgs e) { string sReq = string.Format("http://e.dangdang.com/media/api2.go?action=searchMedia&keyword={0}&start=0&end=20&stype=paper&enable_f=1", TextBox_bookISBN.Text); System.Net.WebRequest req = (System.Net.HttpWebRequest)System.Net.HttpWebRequest.Create(sReq); req.Timeout = 10000; req.Method = "GET"; // using (System.Net.WebResponse wr = req.GetResponse()) { //在这里对接收到的页面内容进行处理 StreamReader streamReader = new StreamReader(wr.GetResponseStream()); string responseContent = streamReader.ReadToEnd(); Root bookInfo = JavaScriptConvert.DeserializeObject <Root>(responseContent); //插入控件中 if (bookInfo.data.searchMediaPaperList.Count == 0) { lb_intro.Text = "正在尝试第二次搜索数据......."; timerGetFirst.Start(); } else { TextBox_bookName.Text = bookInfo.data.searchMediaPaperList[0].title.Trim(); TextBox_bookPublisher.Text = bookInfo.data.searchMediaPaperList[0].publisher.Trim(); TextBox_bookValue.Text = bookInfo.data.searchMediaPaperList[0].originalPrice.ToString().Trim(); pic_cover.LoadAsync(bookInfo.data.searchMediaPaperList[0].mediaPic); lb_intro.Text = "书籍简介:\r\n\r\n" + bookInfo.data.searchMediaPaperList[0].description; lb_author.Text = "作者:" + bookInfo.data.searchMediaPaperList[0].author; } streamReader.Close(); } timerGetSecond.Stop(); }
public void SwitchPhotos(bool i_IsNext, Button i_ButtonBack, Button i_ButtonNext) { if (i_IsNext) { m_PictureBox.LoadAsync(m_ListOfPhotos[++m_PhotoIndex].PictureNormalURL); updateStatistics(); } else { m_PictureBox.LoadAsync(m_ListOfPhotos[--m_PhotoIndex].PictureNormalURL); updateStatistics(); } if (m_PhotoIndex == 0) { i_ButtonBack.Enabled = false; } else if (m_PhotoIndex == m_ListOfPhotos.Count() - 1) { i_ButtonNext.Enabled = false; } else if (m_PhotoIndex == 1) { i_ButtonBack.Enabled = true; } else if (m_PhotoIndex == m_ListOfPhotos.Count() - 2) { i_ButtonNext.Enabled = true; } }
/** * Get pictures link from database and show it. */ private void timer1_Tick(object sender, EventArgs e) { if (imgur_count != 0) { picture_box.LoadAsync(link[imgur_count - 1]); imgur_count--; } else { try { if (r != 0) { r = 0; } else { r = 1; } picture_box.LoadAsync(local_img[r]); } catch (Exception ex) { Console.WriteLine(ex.ToString()); } link.Clear(); MySqlConnection conn_image = new MySqlConnection("server={sql_server_ip}; port=3306; user=bnb_c; password=12345678; database=bnb_wedding"); try { conn_image.Open(); } catch (Exception ex) { Console.WriteLine(ex.ToString()); } String blessing_image = "SELECT * FROM wedding_image WHERE wedding_image_timestamp >= '" + DateTime.Now.ToString("yyyy-MM-dd") + "'"; MySqlCommand blessing_command_image = new MySqlCommand(blessing_image, conn_image); try { MySqlDataReader blessing_reader_image = blessing_command_image.ExecuteReader(); while (blessing_reader_image.Read()) { link.Add(blessing_reader_image.GetString(1)); imgur_count++; } } catch (Exception ex) { Console.WriteLine(ex.ToString()); } conn_image.Close(); } }
private void setPictureOnForm(PictureBox i_PictureToSet, string i_PhotoUrl) { if (i_PictureToSet.InvokeRequired) { Invoke((MethodInvoker)(() => i_PictureToSet.LoadAsync(i_PhotoUrl))); } else { i_PictureToSet.LoadAsync(i_PhotoUrl); } }
private void ListBoxSearchResults_SelectedIndexChanged(object sender, EventArgs e) { Post selectedPost = ((sender as ListBox).SelectedItem as PostWrapper).m_Post; string userName = "******"; string userAge = "unknown"; m_TextBoxPostMassage.Clear(); m_PictureBoxPostPicture.Image = null; m_LabelPostOwnerInfo.Text = string.Format( @"Post Owner Name: {0} Post Owner Age: {1}", userName, userAge); if (selectedPost.PictureURL != null) { m_PictureBoxPostPicture.LoadAsync(selectedPost.PictureURL); } else if (selectedPost.From != null) { m_PictureBoxPostPicture.LoadAsync(selectedPost.From.PictureNormalURL); userAge = AdvancedSearcher.UserAge(selectedPost.From).ToString(); userName = selectedPost.From.Name; } if (selectedPost.Name != null) { m_TextBoxPostMassage.AppendText(selectedPost.Name); m_TextBoxPostMassage.AppendText(Environment.NewLine); } if (selectedPost.Message != null) { m_TextBoxPostMassage.AppendText(selectedPost.Message); m_TextBoxPostMassage.AppendText(Environment.NewLine); } if (selectedPost.Link != null) { m_TextBoxPostMassage.AppendText(selectedPost.Link); m_TextBoxPostMassage.AppendText(Environment.NewLine); } if (selectedPost.Description != null) { m_TextBoxPostMassage.AppendText(selectedPost.Description); m_TextBoxPostMassage.AppendText(Environment.NewLine); } }
private void updatePostVideoOrPhoto(Post i_Post, PictureBox i_PictureBox, WebBrowser i_WebBrowser) { if (i_Post.Type == Post.eType.video) { i_PictureBox.Hide(); i_WebBrowser.Show(); if (i_Post.Source != null) { i_WebBrowser.Url = new Uri(i_Post.Source); } } else { i_WebBrowser.Hide(); i_PictureBox.Hide(); if (i_Post.PictureURL != null) { i_WebBrowser.Url = new Uri(i_Post.PictureURL); string pictureURL = i_Post.PictureURL; string enlargedPictureUrl = pictureURL.Replace("_s", "_n"); i_PictureBox.LoadAsync(enlargedPictureUrl); i_PictureBox.Show(); } } }
private void initAlbum() { AlbumNameLabel.Text = FacebookAlbum.Name; int x = 0; int y = 0; foreach (Photo photo in FacebookAlbum.Photos) { PictureBox picture = new PictureBox(); picture.LoadAsync(photo.PictureThumbURL); picture.Location = new Point(x, y); picture.SizeMode = PictureBoxSizeMode.Zoom; picture.Size = new Size(k_ImageSize, k_ImageSize); ImagesPanel.Controls.Add(picture); x += k_ImageSize + 10; if (x >= ImagesPanel.Width - k_ImageSize - 10) { x = 0; y += k_ImageSize + 10; } } }
/// <summary> /// Assign image from WolframAlpha to a PictureBox /// </summary> /// <param name="input">Input that wolfram will parse</param> /// <param name="picture">PictureBox to put a picture in</param> /// <returns></returns> private Task <int> GetInputImageFromWolfram(string input, PictureBox picture, string podTitle = "Input") { QueryResult results = wolfram.Query(input); if (results != null) { foreach (Pod pod in results.Pods) { if (pod.Title == podTitle) { foreach (SubPod subPod in pod.SubPods) { var image_src = subPod.Image.Src; picture.LoadAsync(image_src); return(new Task <int> (() => 1)); } } } return(new Task <int> (() => - 1)); } else { MessageBox.Show("Something went wrong"); return(new Task <int> (() => - 1)); } }
// show the image in the requsted picture box, according to the selects of the user in the list boxes private void listBoxSelectedIndexChanged <T>(ListBox i_ListBox, PictureBox i_PictureBox, T i_SelctedItem) { User friend = new User(); Event Event = new Event(); if (i_ListBox.SelectedItems.Count == 1) { if (i_SelctedItem is User) { friend = i_SelctedItem as User; if (friend != null) { i_PictureBox.LoadAsync(friend.PictureNormalURL); } } if (i_SelctedItem is Event) { Event = i_SelctedItem as Event; m_LoadPicture.LoadPicture(Event, i_PictureBox); } } }
public void GetPictureAsyc(PictureBox ResultOutput) { string s = BitConverter.ToString(BitConverter.GetBytes(this.ObjectId)).Replace("-", "") + ".png"; string lower = BitConverter.ToString(MD5.Create().ComputeHash(Encoding.ASCII.GetBytes(s))).Replace("-", "").ToLower(); ResultOutput.LoadAsync("http://florian.nouwt.com/wiki/images/" + (object)lower[0] + "/" + (object)lower[0] + (object)lower[1] + "/" + s); }
private async Task FindImages() { _foundImages.Clear(); _foundImagesEnumerator = null; try { _foundImages = await new TaskFactory().StartNew(() => _copyFileService.FindFiles(InputBarcodeBox.Text, StartsWithRadio.Checked)?.ToList()) ?? throw new IOException("Источник изображений не найден"); if (_foundImages?.Count > 0) { InputBarcodeBox.BackColor = Color.LimeGreen; _foundImagesEnumerator = _foundImages?.GetEnumerator(); _foundImagesEnumerator?.MoveNext(); PictureBox.ImageLocation = _foundImagesEnumerator?.Current?.Path; if (!string.IsNullOrWhiteSpace(PictureBox.ImageLocation)) { PictureBox.LoadAsync(); } NextBtnPanel.Visible = true; SearchModePanel.Visible = true; BarcodeLabel.Text = _foundImagesEnumerator?.Current?.Id; NextPicBtn.Visible = _foundImages?.Count > 1; } else { InputBarcodeBox.BackColor = Color.Red; ResetSearchControls(); } } catch (Exception ex) { ResetSourcePath(ex); } }
/* populate all user Photos in panelPictures */ private void populatePhotos() { try { int xCord = 12; int yCord = 12; Size smallSize = new Size(50, 50); Point stratPoint = new Point(xCord, yCord); if (m_FacebookAppEngine.FetchUserPhotos().Count == 0) { this.flowLayoutPanelPictures.Controls.Add(new Control("No Images Found")); } else { foreach (FacebookWrapper.ObjectModel.Photo photo in m_FacebookAppEngine.FetchUserPhotos()) { PictureBox pic = new PictureBox(); pic.LoadAsync(photo.PictureNormalURL); pic.Size = smallSize; pic.Location = stratPoint; pic.SizeMode = PictureBoxSizeMode.StretchImage; this.flowLayoutPanelPictures.Controls.Add(pic); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void AddToGrid(string fileName, string url) { PictureBox picBox = new PictureBox(); picBox.SizeMode = PictureBoxSizeMode.StretchImage; picBox.Height = 200; picBox.Width = 200; picBox.WaitOnLoad = false; picBox.LoadAsync(fileName); picBox.Name = url; picBox.Cursor = Cursors.Hand; picBox.MouseClick += new MouseEventHandler( (object picSender, MouseEventArgs evntArgs) => { PictureBox pic = (PictureBox)picSender; HideWindow(); ClipboardHelper.ClearText(_keyword.Length + _word.Length + 1); ClipboardHelper.PasteText(pic.Name); SendKeys.Send("{Enter}"); System.Diagnostics.Debug.WriteLine("Click => " + pic.Name); } ); gridImages.Controls.Add(picBox); }
private void LoadEmojis() { int counter = 0; int currentHeight = 12; int currentWidth = 12; foreach (KeyValuePair <string, string> entry in Emojione.map) { PictureBox pb = new PictureBox(); pb.Location = new Point(currentWidth, currentHeight); pb.Name = entry.Key; pb.Size = new Size(24, 24); pb.SizeMode = PictureBoxSizeMode.StretchImage; pb.LoadAsync(Emojione.UnicodeToUrl(entry.Value)); pb.Click += Pb_Click; pnl_main.Controls.Add(pb); currentWidth += 30; counter++; if (counter == 5) { counter = 0; currentWidth = 12; currentHeight += 30; } } }
// Load images with specific markup reserve public static void Load_Image1_reserve(string filename, string name, string id) { PictureBox Image1 = new PictureBox(); Label Image1_title = new Label(); string Jpeg = @"c:\tmp\"; using (WebClient wc = new WebClient()) { var client = new WebClient(); var uri = ("https://en.wikipedia.org/w/api.php?action=query&prop=imageinfo&iiprop=comment|url|dimensions&format=json&iiurlwidth=400&titles=File:" + name); var response = client.DownloadString(new Uri(uri)); JObject obj = JObject.Parse(response); string image1 = name; Image1.SizeMode = PictureBoxSizeMode.StretchImage; Image1.LoadAsync(image1); string image1_Title = (string)obj["query"]["pages"][id]["title"]; Image1_title.Text = image1_Title; var hash = uri.GetHashCode(); var path = Path.Combine(Jpeg, filename + ".jpg"); try { client.DownloadFile(image1, path); } catch { client.DownloadFile(image1.Replace("6400px", "800px"), path); } } }
private void fetchUserInfo() { profilePictureBox.LoadAsync(m_LoggedInUser.PictureNormalURL); fullNameUser.Text = m_LoggedInUser.Name; birthdayLabel.Text = m_LoggedInUser.Birthday; emailUserLabel.Text = m_LoggedInUser.Email; }
private async void frmProductos_Load(object sender, EventArgs e) { dataGridView1.Visible = false; //cargar barra de progreso pbox = new PictureBox(); pbox.SizeMode = PictureBoxSizeMode.StretchImage; pbox.Dock = DockStyle.Fill; string archivo = @"C:\Users\altamira\source\repos\ProgramacionAsincrona\archivos\loader.gif"; pbox.LoadAsync(archivo); pbox.LoadCompleted += new AsyncCompletedEventHandler(finCargaImagen); //cargar data daProducto pro = new daProducto(); List <beProducto> lista = null; await Task.Run(() => { lista = pro.Listar(); }); //renderizado dataGridView1.DataSource = lista; pbox.Visible = false; dataGridView1.Visible = true; }
private void populateImages() { List <string> list = new List <string>(); Point location = new Point(10, 10); for (int i = 0; i < m_CurrentAlbum.Photos.Count; i++) { PictureBox pb = new PictureBox(); string currentPictureUrl = m_CurrentAlbum.Photos[i].PictureNormalURL; pb.LoadAsync(currentPictureUrl); pb.SizeMode = PictureBoxSizeMode.Zoom; if (i % 5 == 0) { location.X = 10; location.Y += 100; } else { location.X = location.X + 100; } pb.Location = location; Controls.Add(pb); } }
public Map() { Footer footer = new Footer(Resources.Back); footer.SetCallback(0, (s, e) => { Close(); }); var url = DB.Execute.GetConfig("map"); Image loading = Tools.LoadImage("Waiting-2.gif"); PictureBox box = new PictureBox { Dock = DockStyle.Fill, BorderStyle = BorderStyle.None, SizeMode = PictureBoxSizeMode.CenterImage, Image = loading, }; bool fromInternet = Uri.TryCreate(url, UriKind.Absolute, out Uri uriResult) && (uriResult.Scheme == Uri.UriSchemeHttp || uriResult.Scheme == Uri.UriSchemeHttps); if (fromInternet) { box.WaitOnLoad = false; box.LoadAsync(url); } else { box.Image = Tools.LoadImage(url); } box.LoadCompleted += (s, e) => { box.SizeMode = PictureBoxSizeMode.StretchImage; }; Controls.AddRange(new Control[] { box, footer }); }
public void LoadPicture(Event i_Event, PictureBox i_PictureBox) { if (i_Event != null) { i_PictureBox.LoadAsync(i_Event.PictureNormalURL); } }
private void VipStatiy_Load(object sender, EventArgs e) { GetStata(label3, label4, name.Text); String[] d = s.Split('\n'); for (int i = 0; i < d.Length; i++) { if (d[d.Length - 1 - i].Contains("http://") || d[d.Length - 1 - i].Contains("https://")) { LinkLabel label1 = new LinkLabel(); label1.Location = new Point(0, 0); label1.Size = new Size(180, 20); label1.Text = d[d.Length - 1 - i]; label1.Click += new System.EventHandler(labelClick); label1.Dock = DockStyle.Top; panel1.Controls.Add(label1); PictureBox artImage = new PictureBox(); artImage.Location = new Point(0, 25); artImage.Size = new Size(panel1.Width, 150); artImage.Dock = DockStyle.Top; artImage.SizeMode = PictureBoxSizeMode.StretchImage; panel1.Controls.Add(artImage); String[] chasti_stroki = d[d.Length - 1 - i].Split(new char[] { ' ', '/' }); try { artImage.Image = new Bitmap(chasti_stroki[chasti_stroki.Length - 1]); } catch (Exception) { try { artImage.LoadAsync(d[d.Length - 1 - i]); Uri uri = new Uri(d[d.Length - 1 - i]); client.DownloadFileAsync(uri, chasti_stroki[chasti_stroki.Length - 1]); } catch (Exception) { artImage.Dispose(); } } } else { Label label1 = new Label(); label1.Location = new Point(0, 0); label1.Size = new Size(180, 20); label1.Text = d[d.Length - 1 - i]; label1.Dock = DockStyle.Top; panel1.Controls.Add(label1); } } List <String> countRecords = SQLClass.Select( "SELECT COUNT(*) FROM " + Tables.READ_OF_ARTICLES + " WHERE `name_of_article` = '" + name.Text + "'"); label1.Text = "Просмотров: " + countRecords[0]; }
//</snippet4> //<snippet3> private void startButton_Click(object sender, EventArgs e) { // Ensure WaitOnLoad is false. pictureBox1.WaitOnLoad = false; // Load the image asynchronously. pictureBox1.LoadAsync(@"http://localhost/print.gif"); }
void I(X o) { try{ if (C < (T = G.Length)) { F.LoadAsync((G = Directory.GetFiles(D))[B = (T + B + o) % T]); Text = Path.GetFileName(G[B]) + "— kasthack's Fast Photo Viewer"; } C = 0; }catch { C++; I(o == 0?1:o); } GC.Collect(); }
internal void UpdateImageURL() { StringBuilder imageURL = new StringBuilder(); imageURL.Append(@"https://picsum.photos/id/"); imageURL.Append(m_LogicMemoryGameCardReference.CardValue); imageURL.Append(@"/80"); r_ImageInCard.LoadAsync(imageURL.ToString()); }
public void LoadPicture() { date = DateTime.Now; if (!File.Exists(filename())) { pictureBox.LoadAsync("http://213.221.150.11:8882/record/current.jpg?counter=0"); } }
private PictureBox createPictureBoxInPanel(Photo i_Photo) { PictureBox pic = new PictureBox(); pic.Width = 100; pic.Height = 92; pic.LoadAsync(i_Photo.PictureAlbumURL); return(pic); }
public void LoadPictureAndNumberOfAttenders(ListBox i_Events, PictureBox i_PictureBox, TextBox i_TextBox) { if (i_Events.SelectedItems.Count == 1) { Event selectedEvent = i_Events.SelectedItem as Event; i_PictureBox.LoadAsync(selectedEvent.PictureNormalURL); i_TextBox.Clear(); i_TextBox.Text = selectedEvent.AttendingUsers.Count.ToString(); } }
private void ContactCardForm_Load(object sender, EventArgs e) { lblDisplayName.Text = card.DisplayName; lblSpaceTitle.Text = (card.Space != null) ? card.Space.Title : String.Empty; if (String.IsNullOrEmpty(card.DisplayImageUrl)) { picDisplayImage.Visible = false; } else { picDisplayImage.LoadAsync(card.DisplayImageUrl); } if (card.Album != null) { lnkAlbumName.Text = card.Album.Title; int col = 0; foreach (ThumbnailImage img in card.Album.Photos) //Setting the thumbnail pictures. { PictureBox lnkPic = new PictureBox(); lnkPic.Dock = DockStyle.Fill; lnkPic.Margin = new Padding(6); lnkPic.BorderStyle = BorderStyle.FixedSingle; lnkPic.SizeMode = PictureBoxSizeMode.Zoom; lnkPic.BackColor = Color.White; lnkPic.LoadAsync(img.ThumbnailUrl); tlpnlAlbum.Controls.Add(lnkPic, col, 0); lnkPic.Tag = col; lnkPic.Visible = true; lnkPic.Click += new EventHandler(lnkPic_Click); ttips.SetToolTip(lnkPic, img.ToolTip); col++; } } else { pnlAlbum.Visible = false; } if (card.NewPost != null) { lnkBlogTitle.Text = card.NewPost.Title; ttips.SetToolTip(lnkBlogTitle, card.NewPost.Description); lnkBlogContent.Text = card.NewPost.Description; ttips.SetToolTip(lnkBlogContent, card.NewPost.Description); } else { pnlBlog.Visible = false; } Text = card.DisplayName + "'s ContactCard"; }
private void fetchAlbumPictures() { foreach (Album album in r_FacebookManager.Albums) { foreach (Photo photo in album.Photos) { PictureBox picbox = new PictureBox(); picbox.LoadAsync(photo.PictureNormalURL); } } }
internal override Control GetValueControl() { PictureBox pic = new PictureBox(); try { pic.LoadAsync(directory.FullName + "\\" + pictureFileName); } catch (Exception e) { } pic.Tag = this; return(pic); }