/// <summary> /// 保存错误 /// </summary> /// <param name="ex"></param> internal static void SaveError(StaticPageException ex) { if (OnError != null) { try { OnError(ex); } catch (Exception e) { } } }
static void RunUpdate(DateTime updateTime) { lock (staticPageItems) { foreach (IStaticPageItem sti in staticPageItems) { //需要生成才启动线程 if (sti.NeedUpdate(updateTime)) { var thread = new Thread(state => { if (state == null) { return; } ArrayList arr = state as ArrayList; IStaticPageItem item = arr[0] as IStaticPageItem; DateTime time = (DateTime)arr[1]; try { item.Update(time); } catch (Exception ex) { var exception = new StaticPageException("执行页面生成出现异常:" + ex.Message, ex); if (OnError != null) { try { OnError(exception); } catch { } } } }); //启动线程 thread.Start(new ArrayList { sti, updateTime }); } } } }
static void RunUpdate(DateTime updateTime) { lock (staticPageItems) { foreach (IStaticPageItem sti in staticPageItems) { //需要生成才启动线程 if (sti.NeedUpdate(updateTime)) { var thread = new Thread(state => { if (state == null) return; ArrayList arr = state as ArrayList; IStaticPageItem item = arr[0] as IStaticPageItem; DateTime time = (DateTime)arr[1]; try { item.Update(time); } catch (Exception ex) { var exception = new StaticPageException("执行页面生成出现异常:" + ex.Message, ex); if (OnError != null) { try { OnError(exception); } catch { } } } }); //启动线程 thread.Start(new ArrayList { sti, updateTime }); } } } }
/// <summary> /// 保存错误 /// </summary> /// <param name="ex"></param> internal static void SaveError(StaticPageException ex) { if (OnError != null) { try { OnError(ex); } catch (Exception e) { } } }