using Chloe;
using DNSD_DB;
using DNSD_DB.Entity;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NDSD_Screwdriver
{
public class FormUtils
{
public static Random r = new Random();
///
/// 随机颜色测试
///
///
public static Brush TestRamColor()
{
int i = r.Next(0, 4);
if (i == 1)
{
return Brushes.Green;
}
else if (i == 2)
{
return Brushes.Yellow;
}
else /*if (i == 3)*/
{
return Brushes.Red;
}
//else return Brushes.Transparent;
}
///
/// 颜色枚举值转换为颜色
///
///
///
public static Brush EnumColorToBrush(LightState lightState)
{
switch (lightState)
{
case LightState.Green:
return Brushes.Green;
case LightState.Yellow:
return Brushes.Yellow;
case LightState.Red:
return Brushes.Red;
default: return Brushes.Transparent;
}
}
///
/// 插入无RFID编号日志
///
///
///
public static void LogInsert(IDbContext dbContext, string text)
{
dbContext.Insert(new RFIDLogsEntity()
{
CreateTime = DateTime.Now,
LogText = text,
});
}
///
/// 插入有RFID编号日志
///
///
///
public static void LogInsert(IDbContext dbContext, string text, string rfid)
{
dbContext.Insert(new RFIDLogsEntity()
{
CreateTime = DateTime.Now,
LogText = text,
RFIDId = rfid
});
}
public static void SignAnalysis(IDbContext dbContext)
{
}
}
public enum LightState
{
Green = 0,
Yellow,
Red,
}
}