public static SyncableWord GetWord(this DMSentence sentence, TimeSpan timeSpan) { foreach (var syncObj in sentence.Syncables) { if (syncObj.ContainsTimeSpan(timeSpan)) { if (syncObj is SyncableWord) { return(syncObj as SyncableWord); } else if (syncObj is DMPhrase) { var phrase = syncObj as DMPhrase; foreach (var word in phrase.Words) { if (word.ContainsTimeSpan(timeSpan) == true) { return(word); } } } } } return(null); }
public static ISyncable GetSyncable(this DMSentence sentence, TimeSpan timeSpan) { foreach (var syncObj in sentence.Syncables) { if (syncObj.ContainsTimeSpan(timeSpan)) { return(syncObj); } } return(null); }
public static void CheckSentenceTimeRange(DMSentence sentence) { var isQuate = (bool)sentence.GetValue(SyncExtension.IsQuateProperty); if (isQuate == true) { if (sentence.BeginTime > TimeSpan.Zero && sentence.EndTime > sentence.BeginTime) { sentence.Foreground = Brushes.Blue; } else { sentence.Foreground = Brushes.Gray; } } else { sentence.Foreground = Brushes.Black; } }
public object Clone() { DMSentence newSentence = new DMSentence(this.Index); foreach (var inline in this.Inlines) { if (inline is SyncableWord) { var word = inline as SyncableWord; newSentence.Inlines.Add(word.Clone() as SyncableWord); } else if (inline is Run) { newSentence.Inlines.Add(new Run(((Run)inline).Text)); } } newSentence.BeginTime = this.BeginTime; newSentence.EndTime = this.EndTime; newSentence.Confidence = this.Confidence; return(newSentence); }