zoukankan      html  css  js  c++  java
  • CaseStudy(showcase)数据篇加载图片

    做silvelight也有一段时间了,相册、游戏,刚刚完成的showcase这个小程序算是一个阶段了。这里就以showcase这个项目来做一下CaseStudy。

    数据篇-加载图片

    beta1到beta2中加载图片的方法有些改变。

            private void LoadImage(String MediaUrl)
            {
                Uri uri 
    = new Uri(HtmlPage.Document.DocumentUri, MediaUrl);
                
                WebClient imgClient 
    = new WebClient();
                imgClient.OpenReadCompleted 
    += new OpenReadCompletedEventHandler(imgClient_OpenReadCompleted);
                imgClient.OpenReadAsync(uri);
            }

            
    void imgClient_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e)
            {
                
    if (e.Error == null)
                {
                    BitmapImage bi 
    = new BitmapImage();
                    bi.SetSource(e.Result);
                    xImage.Source 
    = bi;
                }
            }

     另一种方法

                Uri uri = new Uri(HtmlPage.Document.DocumentUri, MediaUrl);
                ImageSource img 
    = new System.Windows.Media.Imaging.BitmapImage(uri);
                xImage.SetValue(Image.SourceProperty, img);


    作者:nasa
    出处:nasa.cnblogs.com
    联系:nasa_wz@hotmail.com
    QQ:12446006

  • 相关阅读:
    requests-验证码登录
    python接口
    Xmanager6
    jmeter提取变量注意事项
    badboy录制
    Config 多账户多区域数据聚合
    AWS Aurora数据库 Multi-Master
    确定客户主密钥的过去使用情况
    将应用程序部署到 AWS Elastic Beanstalk 环境
    VPC Peering 具有特定路由的配置
  • 原文地址:https://www.cnblogs.com/nasa/p/1248972.html
Copyright © 2011-2022 走看看