开发者

How to get a list of photos from Server and Bind it to ListBox

开发者 https://www.devze.com 2023-02-18 21:03 出处:网络
How to get and bind a list of photo from Server with wildcard add to the name like开发者_如何学编程 Cities*. ThanksThis question really is very vague.

How to get and bind a list of photo from Server with wildcard add to the name like开发者_如何学编程 Cities*. Thanks


This question really is very vague.

However, luckily I have a script to hand :)

This iron7 script allows you to search for images on flickr - and then displays the returned images inside a WrapPanel:

http://script.iron7.com/#/Script/Detail?scriptId=Flickr&userLowerCaseName=iron7

It's Ruby - but it's less than 100 lines long so you should be able to understand it - if not then download iron7 and run the script on your phone.

The important lines are:

Host.call_text_web_service("flickr", "http://api.flickr.com/services/feeds/photos_public.gne?format=json&tags=" + $textbox_1.text, "web_listener")

and then the code that adds the images:

def process_flickr(response)
  $wrap_panel.children.clear()
  $big_image.visibility = Visibility.collapsed

  image_urls =  read_flickr_urls_from_response(response)
  image_urls.each { |image_url|

    image = Image.new
    image.stretch = Stretch.fill
    image.horizontal_alignment = HorizontalAlignment.left;
    image.vertical_alignment = VerticalAlignment.top;
    image.height = 160
    image.width = 160
    bitmap_image_source = BitmapImage.new
    bitmap_image_source.uri_source = System::Uri.new(image_url)
    image.source = bitmap_image_source

    $wrap_panel.children.add(image)
  }
end
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号