private void BackwardB_Click(object sender, RoutedEventArgs e) { (sender as FrameworkElement).Cursor = Cursors.Wait; switch (CurrentState) { case State.Stop: if (SelectPreviousRunWord()) { CurrentRunWord.PlayCachedSound(); } break; case State.Play: CurrentState = State.Stop; StopSound(); if (SelectPreviousRunWord()) { CurrentRunWord.PlayCachedSound(); } break; case State.Segment: break; case State.Edit: CurrentState = State.Stop; if (SelectPreviousRunWord()) { CurrentRunWord.PlayCachedSound(); } break; case State.Caption: break; } (sender as FrameworkElement).Cursor = Cursors.Hand; }
private void Apply_Click(object sender, RoutedEventArgs e) { (sender as FrameworkElement).Cursor = Cursors.Wait; switch (CurrentState) { case State.Stop: break; case State.Play: break; case State.Segment: break; case State.Edit: int selectIndex = DictComboBox.Items.IndexOf(DictComboBox.Text); if (selectIndex == -1) { selectIndex = DictComboBox.Items.Add(DictComboBox.Text); if (!ProjectInfo.Dictionary.ContainsKey(CurrentRunWord.Text)) { ProjectInfo.Dictionary.Add(CurrentRunWord.Text, new List <String>() { CurrentRunWord.Text }); } ProjectInfo.Dictionary[CurrentRunWord.Text].Add(DictComboBox.Text); } if (ApplyOnlyThisWord.IsChecked == true) { CurrentRunWord.SelectDictAt(selectIndex); } else if (ApplyAll.IsChecked == true) { foreach (Content content in ProjectInfo.Contents) { foreach (Block block in content.Blocks) { foreach (Sentence sentence in block.Sentences) { foreach (Word word in sentence.Words) { if (word.OriginalText.Equals(CurrentRunWord.Text)) { if (ExceptLockWord.IsChecked == false || !word.Locked) { word.ChangeDictIndex(selectIndex); } } } } } } } else if (ApplyAllFromHere.IsChecked == true) { bool foundFirstWord = false; foreach (Content content in ProjectInfo.Contents) { if (content.ID < CurrentContent.ID) { continue; } foreach (Block block in content.Blocks) { foreach (Sentence sentence in block.Sentences) { foreach (Word word in sentence.Words) { if (word == ProjectInfo.CurrentWord) { CurrentRunWord.SelectDictAt(selectIndex); foundFirstWord = true; } else if (foundFirstWord && word.OriginalText.Equals(CurrentRunWord.Text)) { if (ExceptLockWord.IsChecked == false || !word.Locked) { word.ChangeDictIndex(selectIndex); } } } } } } } CurrentRunWord.PlayCachedSound(); break; case State.Caption: break; } (sender as FrameworkElement).Cursor = Cursors.Hand; }