Context.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. namespace DataAnalysisControl.Core
  6. {
  7. /// <summary>
  8. /// Context类,用于组件与外部交互,
  9. /// </summary>
  10. public static class CONTEXT
  11. {
  12. static IDataAnalysisControlContext _innerContext = new DefaultContext();
  13. public static void SetContext(IDataAnalysisControlContext context)
  14. {
  15. _innerContext = context;
  16. }
  17. public static void WriteLog(Exception ex)
  18. {
  19. _innerContext.Write(ex,"");
  20. }
  21. public static void WriteLog(Exception ex, string log)
  22. {
  23. _innerContext.Write(ex,"数据分析控件日志:" + log);
  24. }
  25. public static void WriteLog(string log)
  26. {
  27. _innerContext.Write(log);
  28. }
  29. /// <summary>
  30. /// 获取腔体的列表。<ChamberName,显示名称>
  31. /// </summary>
  32. /// <returns></returns>
  33. public static Dictionary<string, string> GetChamberList()
  34. {
  35. return _innerContext.GetChamberList();
  36. }
  37. /// <summary>
  38. /// 获取运行程序的腔体列表,用于按工艺程序查找数据时的过滤条件。<ChamberName,显示名称>
  39. /// </summary>
  40. /// <returns></returns>
  41. public static Dictionary<string, string> GetRecipeChamberList()
  42. {
  43. return _innerContext.GetRecipeChamberList();
  44. }
  45. public static string GetDBConnString()
  46. {
  47. return _innerContext.GetDBConnString();
  48. }
  49. }
  50. }