views:

16

answers:

0

Hi all, I have a treeviews which look like this:

2. Header               << Play Video (a) [Duration 0:00 to 0:09] and (b) [Duration 0:10 to 0:44] on click
    a) sub header 1     << Play Video (a) only on click
    b) sub header 2     << Play Video (b) only on click

3. Header               << Play Video (a) [Duration 0:00 to 0:20] and (b) [Duration 0:21 to 0:50] on click
    a) sub header 1     << Play Video (a) only on click
    b) sub header 2     << Play Video (b) only on click

So when user click on 2) Header it will auto play the video with the autohighlight function, which means when it is still playing the video, the a) sub header 1 will auto highlight to so called indicate which part of the video is playing. When the part a) finishes, it will auto jump highlight to b) sub header 2. [In this code, 2) Header is named two, a) sub header 1 is named twoA, b) sub header 2 is named twoB]:

I have already done the following code, but still prompt abit of error:

private void SeekToMediaPosition(object sender, RoutedPropertyChangedEventArgs<double> args)
  {
   _timer.Stop();
   TimeSpan t = TimeSpan.FromSeconds(VideoTime.Value);
   Video.Position = t;
   _timer.Start();

   if (two.IsSelected == true)
   {
    if (t.TotalSeconds < 10)
    {
     twoA.IsSelected = true;
    }
    else
    {
     twoB.IsSelected = true;
    }
   }

   if (three.IsSelected == true)
   {
    if (t.TotalSeconds < 20)
    {
     threeA.IsSelected = true;
    }
    else
    {
     threeB.IsSelected = true;
    }
   }
  }

And I didn't get what I wanted because, at only the

if (two.IsSelected == true)
            {
                if (t.TotalSeconds < 10)
                {
                    twoA.IsSelected = true;
                }
                else
                {
                    twoB.IsSelected = true;
                }
            }

I already dun see the isSelected function to go to twoB after 10sec later... Any clue? ): Any kind person out there can help me? Thanks ^^