Exemple #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);
 }
Exemple #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));
        }
 public CaptionEvent(Caption caption, TimeSpan time, double progress)
 {
     Caption  = caption;
     Time     = time;
     Progress = progress;
 }