예제 #1
0
 public void UpdateProgress(double progress)
 {
     if (captions == null)
     {
         return;
     }
     elapsed   = TimeSpan.FromMilliseconds(progress * subtitleTotalLength.TotalMilliseconds);
     beginTime = DateTime.Now - elapsed;
     current   = null;
     TimerTick(null, null);
 }
예제 #2
0
        private void TimerTick(object o, EventArgs e)
        {
            TimeSpan diff = DateTime.Now - beginTime;

            elapsed = diff;

            foreach (var c in captions)
            {
                if (current != null && current.To < diff)
                {
                    current = null;
                }
                if (diff < c.From)
                {
                    break;
                }
                if (diff >= c.From && diff <= c.To)
                {
                    current = c;
                }
            }
            eventDelegate(new CaptionEvent(current, diff, diff.TotalMilliseconds / subtitleTotalLength.TotalMilliseconds));
        }
예제 #3
0
 public CaptionEvent(Caption caption, TimeSpan time, double progress)
 {
     Caption  = caption;
     Time     = time;
     Progress = progress;
 }