private void Dt_Tick(object sender, object e) { try { if (SubtitleList != null && SubtitleList.Any() && showSubtitle) { var v = (from item in SubtitleList where item != null && item.StartTime + seekDouble <= mediaElement.Position.TotalMilliseconds && item.EndTime + seekDouble >= mediaElement.Position.TotalMilliseconds orderby item descending select item).FirstOrDefault(); CurrentSubtitleItem = v; if (v != null) { customMTC.SubtitleText.Blocks.Clear(); Paragraph myParagraph = new Paragraph(); int nextParagraph = 1; foreach (string item in v.Lines) { if (GetRun(item) != null) { myParagraph.Inlines.Add(GetRun(item.Replace("ي", "ی"))); try { if (v.Lines.Count < nextParagraph && v.Lines[nextParagraph] != null) { myParagraph.Inlines.Add(new LineBreak()); } } catch (Exception ex) { HelperUP.Output("nextParagraph ex: " + ex.Message); } } nextParagraph++; } customMTC.SubtitleText.Blocks.Add(myParagraph); customMTC.ShadowBorder.Visibility = customMTC.SubtitleText.Visibility = Windows.UI.Xaml.Visibility.Visible; } else { customMTC.ShadowBorder.Visibility = customMTC.SubtitleText.Visibility = Windows.UI.Xaml.Visibility.Collapsed; customMTC.SubtitleText.Blocks.Clear(); } } else { customMTC.SubtitleText.Blocks.Clear(); } } catch (Exception ex) { HelperUP.Output("mediaPlayer_PositionChanged ex: " + ex.Message); } }