//private Thread ThreadRecordCheck; private void BtnRecord_Clicked(object sender, RoutedEventArgs e) { FrameworkElement src = e.Source as FrameworkElement; if (src != null) { switch (src.Name) { case "btn_record": if (!UserFile.Exists("ffmpeg.exe")) { MsgBox("没能找到ffmpeg.exe,录制停止"); return; } if (btn_auto_record_clicked) { MsgBox("自动录制中..."); return; } if (!btn_record_clicked) { if (DouYuUrl.Text.Length == 0) { MsgBox("空网址"); return; } btn_record.Content = "停止录制"; opdata.RecordStart(); btn_record_clicked = true; } else { btn_record.Content = "手动录制"; opdata.RecordStop(); btn_record_clicked = false; } break; case "btn_auto_record": if (!UserFile.Exists("ffmpeg.exe")) { MsgBox("没能找到ffmpeg.exe,录制停止"); return; } if (btn_record_clicked) { MsgBox("手动录制中..."); return; } if (DouYuUrl.Text.Length == 0) { MsgBox("空网址"); return; } if (btn_auto_record_clicked) { btn_auto_record_clicked = false; btn_auto_record.Content = "自动录制"; opdata.bAutoRecord = false; } else { btn_auto_record_clicked = true; btn_auto_record.Content = "停止录制"; opdata.bAutoRecord = true; opdata.AutoRecord(); } break; case "SelectPath": var fbd = new System.Windows.Forms.FolderBrowserDialog(); if (fbd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { FileSavePathTextBox.Text = fbd.SelectedPath; SaveConfig(); } break; case "WindowClose": opdata.bAutoRecord = false; opdata.RecordStop(); //opdata.StartDanmu = false; nficon.Visible = false; Close(); break; case "WindowMinimized": WindowState = WindowState.Minimized; ShowInTaskbar = false; break; case "ShowDanmu": System.Windows.Controls.CheckBox c = sender as System.Windows.Controls.CheckBox; opdata.ShowDanmu = c.IsChecked.Value; break; //case "btn_test": // WpfMessageBox child = new WpfMessageBox(this,"test"); //child.Show(); //break; } } }