Commit 3a49ef7e 几米阳光

扫码增加异常捕获

1 个父辈 6cb03ded
......@@ -100,7 +100,7 @@ namespace OnlineStore.Common
}
public static void error(ILog log, string errorMsg)
{
if (!lasErrorLogList.Contains(errorMsg))
//if (!lasErrorLogList.Contains(errorMsg))
{
log.Error(log.Logger.Name + " - " + errorMsg);
if (logBox == null)
......@@ -109,11 +109,11 @@ namespace OnlineStore.Common
}
AddToBox(errorMsg, Color.Red);
}
lasErrorLogList.Add(errorMsg);
if (lasErrorLogList.Count > errCount)
{
lasErrorLogList.RemoveAt(0);
}
//lasErrorLogList.Add(errorMsg);
//if (lasErrorLogList.Count > errCount)
//{
// lasErrorLogList.RemoveAt(0);
//}
}
private static void AddToBox(string msg, Color color)
{
......
......@@ -217,6 +217,8 @@ namespace OnlineStore.DeviceLibrary
#region 原点返回和复位处理
private void ReturnHome()
{
isNoAirCheck = false;
isInSuddenDown = false;
WarnMsg = "";
CurrInOutACount = 0;
CurrInOutCount = 0;
......
......@@ -6,6 +6,7 @@ using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Runtime.ExceptionServices;
using System.Text;
using System.Windows.Forms;
......@@ -90,7 +91,8 @@ namespace OnlineStore.DeviceLibrary
}
return bitm;
}
[HandleProcessCorruptedStateExceptions]
public static List<string> CameraScan( )
{
List<string> codeList = new List<string>();
......@@ -123,7 +125,13 @@ namespace OnlineStore.DeviceLibrary
}
allCodeList.AddRange(cc);
}
bitmap.Dispose();
}
}
catch (AccessViolationException e)
{
LogUtil.error("扫码出现AccessViolationException异常:" + e.ToString());
GC.Collect();
}
catch (Exception ex)
{
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!