Initial commit: C# 学习笔记和示例代码
- Lesson 01-10: C# 基础语法 - WebView2: 集成示例 - notes/: 详细笔记
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
|
||||
namespace Lesson05.Services
|
||||
{
|
||||
class AudioService
|
||||
{
|
||||
private bool isListening;
|
||||
private string deviceName;
|
||||
|
||||
public AudioService()
|
||||
{
|
||||
this.deviceName = "默认麦克风";
|
||||
this.isListening = false;
|
||||
}
|
||||
|
||||
public void StartListening()
|
||||
{
|
||||
if (!isListening)
|
||||
{
|
||||
isListening = true;
|
||||
Console.WriteLine($"[{deviceName}] 开始监听...");
|
||||
}
|
||||
}
|
||||
|
||||
public void StopListening()
|
||||
{
|
||||
if (isListening)
|
||||
{
|
||||
isListening = false;
|
||||
Console.WriteLine($"[{deviceName}] 停止监听");
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsListening()
|
||||
{
|
||||
return isListening;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user