You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

75 lines
1.7 KiB
C#

using Rs.Framework;
using Rs.MotionPlat.Flow;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace Rs.MotionPlat.Commom
{
/// <summary>
/// 蜂鸣器管理
/// </summary>
public class BuzzerManager
{
private static BuzzerManager instance;
public static BuzzerManager Instance
{
get
{
if(instance == null)
instance = new BuzzerManager();
return instance;
}
}
bool bexit = false;
bool bRun = false;
public void On()
{
bRun = true;
}
public void Off()
{
bRun=false;
}
public void Exit()
{
bexit = true;
}
public void Run()
{
Task.Run(() => {
while (!bexit)
{
if(!bRun)
{
Thread.Sleep(100);
}
if (bRun)
{
if(MachineManage.Instance.MachineStatus!= EMachineStatus.Stop)
{
if(!GlobalVar.DisableBuzzer)
{
Ops.On("蜂鸣器");
Thread.Sleep(500);
Ops.Off("蜂鸣器");
Thread.Sleep(1000);
}
}
}
Thread.Sleep(100);
}
});
}
}
}