📄 faxheartbeat.cs
字号:
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Runtime.CompilerServices;
using System.Threading;
/// <summary>
/// Summary description for FaxHeartBeat
/// </summary>
///
namespace IFS.ReportFax
{
public class FaxHeartBeat
{
public FaxHeartBeat()
{
//detectHeartBeat();
//new System.Threading.Thread();
}
[MethodImpl(MethodImplOptions.Synchronized)]
public static void detectHeartBeat()
{
int senderStatus = FaxSender.status;
while (senderStatus != FaxStatus.SENDER_ERROR)
{
//if (FaxSender.status != FaxStatus.SENDER_SENDING)
//{
if (!isEmpty())
{
if (FaxSender.status == FaxStatus.SENDER_IDLE)
{
FaxSender.status = FaxStatus.SENDER_SENDING;
// what if wakeSender throws exception?
//FaxSender.sendAll();
if (FaxSender.status != FaxStatus.SENDER_ERROR)
FaxSender.status = FaxStatus.SENDER_IDLE;
else
break;
}
//files[0].Delete();
}
//}
System.Threading.Thread.Sleep(1000);
}
FaxService.turnOff();
}
public static void detectDel()
{
while (true)
{
System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo(FaxUtil.tempDir);
System.IO.FileInfo[] files = dir.GetFiles();
if (files.Length != 0)
{
if (FaxSender.status == FaxStatus.SENDER_IDLE)
{
FaxSender.status = FaxStatus.FAX_SENDING;
FaxSender.sendAll();
}
else if (FaxSender.status == FaxStatus.SENDER_SENDING)
{
}
//files[0].Delete();
}
Thread.Sleep(10000);
}
}
private static bool isEmpty()
{
System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo(FaxUtil.tempDir);
System.IO.FileInfo[] files = dir.GetFiles();
if (files.Length == 0)
return true;
return false;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -