Windows phone 7 事件应该只发生在最后一部电影中

Windows phone 7 事件应该只发生在最后一部电影中,windows-phone-7,silverlight-4.0,windows-phone-7.1,Windows Phone 7,Silverlight 4.0,Windows Phone 7.1,我使用的scrollviewer具有10个低质量图像的stackpanel。当图像移动到下一个图像时,在该视图中加载所查看图像的高分辨率图像。问题是当连续轻弹6次,滚动移动6次,添加高分辨率的方法出现6次并加载视图中的图像时。我需要一个想法,等待完成的电影几秒钟,并执行一次高分辨率添加图像方法。有办法吗?您可以使用计时器延迟高分辨率图像的加载。 代码可能如下所示: DispatcherTimer timer = new DispatcherTimer(); public MainPage()

我使用的scrollviewer具有10个低质量图像的stackpanel。当图像移动到下一个图像时,在该视图中加载所查看图像的高分辨率图像。问题是当连续轻弹6次,滚动移动6次,添加高分辨率的方法出现6次并加载视图中的图像时。我需要一个想法,等待完成的电影几秒钟,并执行一次高分辨率添加图像方法。有办法吗?

您可以使用计时器延迟高分辨率图像的加载。 代码可能如下所示:


DispatcherTimer timer = new DispatcherTimer();

public MainPage()
{
    InitializeComponent();

    timer.Interval = TimeSpan.FromSeconds(1); //You can adjust the delay suitable to your needs
    timer.Tick += new EventHandler(timer_Tick);
}

void handle_Flick(object sender, GestureEventArgs args)
{
   //If timer is not running, start the timer 
   //and do everything else other than loading high-resolution image.
   if(timer.IsEnabled != true)
   {
      //start the timer
      timer.Start();
   }
}

void timer_Tick(object sender, EventArgs e)
{
    //Stop the timer
    timer.Stop();

    //Load the high resolution image
}
您如何定义“最后一个flick”?如果(e.HorizontalChange<0){var helper=DoubleAnimationHelper.Get(scroll,ScrollViewer.HorizontalOffsetProperty);helper.CurrentValue=scroll.HorizontalOffset;helper.TargetValue=y+480;helper.Duration=TimeSpan.From毫秒(250);scroll.HorizontalScrollBarVisibility=ScrollBarVisibility.Auto;helper.Animate();x=helper.TargetValue;AddhighresImage()}