示例#1
0
        private void WebVTTSetNewVoiceTextBox(object sender, EventArgs e)
        {
            using (var form = new WebVttNewVoice())
            {
                if (form.ShowDialog(this) == DialogResult.OK)
                {
                    string voice = form.VoiceName;
                    if (!string.IsNullOrEmpty(voice))
                    {
                        var tb = GetFocusedTextBox();

                        if (tb.SelectionLength > 0)
                        {
                            string s = tb.SelectedText;
                            s = WebVTT.RemoveTag("v", s);
                            if (tb.SelectedText == tb.Text)
                                s = string.Format("<v {0}>{1}", voice, s);
                            else
                                s = string.Format("<v {0}>{1}</v>", voice, s);
                            tb.SelectedText = s;
                        }
                    }
                }
            }
        }
示例#2
0
 private void WebVTTSetNewVoice(object sender, EventArgs e)
 {
     using (var form = new WebVttNewVoice())
     {
         if (form.ShowDialog(this) == DialogResult.OK)
         {
             string voice = form.VoiceName;
             if (!string.IsNullOrEmpty(voice))
             {
                 foreach (int index in SubtitleListview1.SelectedIndices)
                 {
                     _subtitle.Paragraphs[index].Text = WebVTT.RemoveTag("v", _subtitle.Paragraphs[index].Text);
                     _subtitle.Paragraphs[index].Text = string.Format("<v {0}>{1}", voice, _subtitle.Paragraphs[index].Text);
                     SubtitleListview1.SetText(index, _subtitle.Paragraphs[index].Text);
                 }
                 RefreshSelectedParagraph();
             }
         }
     }
 }