public void AppendRecord(string record) { Dispatcher.Invoke(new Action(() => { RecordTextBox.AppendText(record); RecordTextBox.ScrollToEnd(); })); }
private void AddLyric(object sender, EventArgs e) { RecordTextBox.Clear(); var musicDir = MusicDirTextBox.Text; if (!new DirectoryInfo(musicDir).Exists) { RecordTextBox.AppendText(App.GetLocalizedString("MusicDirNotExist") + "\n"); return; } Properties.Settings.Default.MusicDir = musicDir; Properties.Settings.Default.Save(); if (_thread != null && _thread.ThreadState != ThreadState.Stopped && _thread.ThreadState != ThreadState.Aborted && _thread.ThreadState != ThreadState.AbortRequested) { return; } StartButton.IsEnabled = false; PauseResumeButton.Content = App.GetLocalizedString("ButtonPause"); PauseResumeButton.IsEnabled = true; HaltButton.IsEnabled = true; AddLyricForAllRadioButton.IsEnabled = false; AddLyricForEmptyRadioButton.IsEnabled = false; StatusLabel.Content = App.GetLocalizedString("StatusLabelAdding"); _lyricAdder.SetSongDir(musicDir); _lyricAdder.SetAddLyricRules(AddLyricForEmptyRadioButton.IsChecked ?? false); _thread = new Thread(AddLyric); _thread.Start(); }