Example #1
0
 public void showAtTime(double timeInSecond)
 {
     if (currentLine < allLyricByLine.Count - 2)
     {
         if (timeInSecond > allLyricByLine[currentLine + 1].BeginTime - 2)
         {
             currentLine += 1;
             Debug.WriteLine(string.Format("Current line playing is {0}/{1}", currentLine + 1, allLyricByLine.Count));
             if (currentLine % 2 == 0)
             {
                 lineOne.setTextAndTimes(allLyricByLine[currentLine].LyricLRC);
             }
             else
             {
                 lineTwo.setTextAndTimes(allLyricByLine[currentLine].LyricLRC);
             }
         }
     }
     try
     {
         if (lineOne.BeginTime.TotalSeconds - 1 <= timeInSecond && lineOne.EndTime.TotalSeconds + 1 >= timeInSecond)
         {
             lineOne.setCurrentTime(timeInSecond);
         }
         if (lineTwo.BeginTime.TotalSeconds - 1 <= timeInSecond && lineTwo.EndTime.TotalSeconds + 1 >= timeInSecond)
         {
             lineTwo.setCurrentTime(timeInSecond);
         }
     }
     catch (Exception ex)
     {
         Debug.WriteLine("showAtTime error: " + ex.Message);
     }
 }