首页 新闻 会员 周边 捐助

怎样让图片显示的时间为读取服务器传过来的时间,图片依次显示,实现切换

0
悬赏园豆:10 [已关闭问题] 关闭于 2013-09-09 13:57

  
        <Grid Grid.Row="1" Name="advertGrid">
            <ListBox Name="advertListBox">
                <ListBox.ItemTemplate>
                    <DataTemplate>
                            <Image Name="imgAdvertisement"  

                                             Source="{Binding AdPic}"  Stretch="Fill"       Height="112">

                          </Image>
                        <!--</StackPanel>-->
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>

 public void ProcessAdvert(string[] result)    

     {          

      string resu = "";      

       List<Advert> list = new List<Advert>();           

       for (int i = 0; i < result.Length; i++)    

         {                        

        string adPic = array[2].Trim();         

         int duration = Convert.ToInt32(array[4].Trim());   广告显示的时间    

             DispatcherTimer timer = new DispatcherTimer();     

            timer.Interval = TimeSpan.FromSeconds(duration);    

             timer.Tick += timer_Tick;           

             timer.Start();

       list.Add(new Advert() {AdPic = "http://192.168.10.1/advert/" + adPic});

            }     

        advertListBox.ItemsSource = list;    

     }

 

  void timer_Tick(object sender, EventArgs e)
        {
           
            //this.advertListBox.Padding = new Thickness(0, -122, 0, 0);
        }

菜鸟_001的主页 菜鸟_001 | 初学一级 | 园豆:70
提问于:2013-09-09 10:00
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册