Page view counter
The problem of control media position-----Death cycle
Last post 08-21-2008 9:50 PM by wbixd. 3 replies.
Sort Posts:
08-21-2008 1:50 AM
The problem of control media position-----Death cycle

My code:

void Media_MarkerReached(object sender, TimelineMarkerRoutedEventArgs e)
        {
            double time = e.Marker.Time.TotalSeconds;
            double seconds = Media.NaturalDuration.TimeSpan.TotalSeconds;
            if (time <= 0)
            {
                return;
            }
            double maker = time * SliderPosition.Maximum / seconds;
            //TxtTime.Text = e.Marker.Time.Minutes + ":" + e.Marker.Time.Seconds;
            TxtTime.Text = string.Format("{0:00}:{1:00}",Media.Position.Minutes,Media.Position.Seconds);
            if (Flage)
            {
                SliderPosition.Value = maker;
            }
        }
        void SliderPosition_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
        {
           
            double seconds = Media.NaturalDuration.TimeSpan.TotalSeconds;
            double tvalue = seconds / SliderPosition.Maximum * this.SliderPosition.Value;
            if (e.NewValue != tvalue)
            {
                double time = SliderPosition.Value / SliderPosition.Maximum * seconds;
                Media.Position = new TimeSpan(0, 0, (int)time);
            }
        }

The problem :MediaElement.MarkerReaded can change SliderPosition.Value  but change SliderPosition.Value 

Trigger SliderPosition.ValueChanged and in this function trigger MediaElement.MarkerReaded  so it runs Death cycle
 
I want to add a Signal variables   I dont know how to do it  or is there other way?   thanks
wbixd

Loading...
Joined on 06-30-2008
Posts 7
08-21-2008 2:41 AM
Re: The problem of control media position-----Death cycle

You can remove the Marker reached eventHandler in slider valuechanged event.

Thanks
Rajesh Shirpuram

(If this has answered your question, please click on "mark as answer" on this post. Thank you!)

rajesh shirpuram

Loading...
Joined on 08-13-2007
Pune,India
Posts 505
08-21-2008 3:36 AM
Re: The problem of control media position-----Death cycle

No,it is not my meaning,Iwant to change silder's value  At same time change media's position  and when media'position was changed  change silder's value  also

 

Can give an example?

wbixd

Loading...
Joined on 06-30-2008
Posts 7
08-21-2008 9:50 PM
Marked as Answer
Re: The problem of control media position-----Death cycle

I have to solve the problem 3Q

wbixd

Loading...
Joined on 06-30-2008
Posts 7
Microsoft Communities