SystemConfiguration.cs 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. using Prism.Mvvm;
  2. using System;
  3. using System.Reflection;
  4. using TeamAAS_VP.Enums;
  5. namespace TeamAAS_VP.Models
  6. {
  7. /// <summary>
  8. /// 系统配置:保存软件版本、标题、语言、字体大小等全局设置。
  9. /// </summary>
  10. public class SystemConfiguration : BindableBase
  11. {
  12. public SystemConfiguration()
  13. {
  14. // 尝试从程序集信息读取版本号作为默认值
  15. try
  16. {
  17. var version = Assembly.GetEntryAssembly()?.GetName()?.Version?.ToString();
  18. if (string.IsNullOrEmpty(version))
  19. {
  20. version = Assembly.GetExecutingAssembly()?.GetName()?.Version?.ToString();
  21. }
  22. SoftwareVersion = version ?? "1.0.0.0";
  23. }
  24. catch
  25. {
  26. SoftwareVersion = "1.0.0.0";
  27. }
  28. Title = "Team Vision";
  29. CompanyTitle = "江苏新惕姆智能装备有限公司";
  30. CurrentLanguage = Language.ChineseSimplified;
  31. Font = new FontSizeSettings();
  32. }
  33. private string _softwareVersion;
  34. /// <summary>
  35. /// 软件版本号
  36. /// </summary>
  37. public string SoftwareVersion
  38. {
  39. get => _softwareVersion;
  40. set => SetProperty(ref _softwareVersion, value);
  41. }
  42. private string _title;
  43. /// <summary>
  44. /// 软件标题
  45. /// </summary>
  46. public string Title
  47. {
  48. get => _title;
  49. set => SetProperty(ref _title, value);
  50. }
  51. private string _companyTitle;
  52. /// <summary>
  53. /// 公司名称/标题
  54. /// </summary>
  55. public string CompanyTitle
  56. {
  57. get => _companyTitle;
  58. set => SetProperty(ref _companyTitle, value);
  59. }
  60. private Language _currentLanguage;
  61. /// <summary>
  62. /// 当前语言
  63. /// </summary>
  64. public Language CurrentLanguage
  65. {
  66. get => _currentLanguage;
  67. set => SetProperty(ref _currentLanguage, value);
  68. }
  69. private FontSizeSettings _font;
  70. /// <summary>
  71. /// 字体大小配置
  72. /// </summary>
  73. public FontSizeSettings Font
  74. {
  75. get => _font;
  76. set => SetProperty(ref _font, value);
  77. }
  78. private Guid _lastOpenedProductId = Guid.Empty;
  79. /// <summary>
  80. /// 最近打开的产品 ID(可用于自动加载)
  81. /// </summary>
  82. public Guid LastOpenedProductId
  83. {
  84. get => _lastOpenedProductId;
  85. set => SetProperty(ref _lastOpenedProductId, value);
  86. }
  87. // 新增相机/拍照/检测计数属性
  88. private Int16 _WorkMode = 0;
  89. /// <summary>
  90. /// 工作模式 =1 拍1打1 =2 拍1打所有
  91. /// </summary>
  92. public Int16 WorkMode
  93. {
  94. get { return _WorkMode; }
  95. set { SetProperty(ref _WorkMode, value); }
  96. }
  97. private Int16 _PickPointNum = 0;
  98. /// <summary>
  99. /// 取料位置 =0 不需要取料 =1 需要取料
  100. /// </summary>
  101. public Int16 PickPointNum
  102. {
  103. get { return _PickPointNum; }
  104. set { SetProperty(ref _PickPointNum, value); }
  105. }
  106. private Int16 _DowmCameraNum = 0;
  107. /// <summary>
  108. /// 相机拍照次数
  109. /// </summary>
  110. public Int16 DowmCameraNum
  111. {
  112. get => _DowmCameraNum;
  113. set => SetProperty(ref _DowmCameraNum, value);
  114. }
  115. private Int16 _UpCameraPickNum = 0;
  116. /// <summary>
  117. /// 上相机取料拍照次数
  118. /// </summary>
  119. public Int16 UpCameraPickNum
  120. {
  121. get => _UpCameraPickNum;
  122. set => SetProperty(ref _UpCameraPickNum, value);
  123. }
  124. private Int16 _UpCameraPutNum = 0;
  125. /// <summary>
  126. /// 上相机放料拍照次数
  127. /// </summary>
  128. public Int16 UpCameraPutNum
  129. {
  130. get => _UpCameraPutNum;
  131. set => SetProperty(ref _UpCameraPutNum, value);
  132. }
  133. private Int16 _UPCameracheckNum = 0;
  134. /// <summary>
  135. /// 上相机锁附/组装次数
  136. /// </summary>
  137. public Int16 UPCameracheckNum
  138. {
  139. get => _UPCameracheckNum;
  140. set => SetProperty(ref _UPCameracheckNum, value);
  141. }
  142. private Int16 _FixedCameraPickNum = 0;
  143. /// <summary>
  144. /// 取料固定位置拍产品相机数量
  145. /// </summary>
  146. public Int16 FixedCameraPickNum
  147. {
  148. get => _FixedCameraPickNum;
  149. set => SetProperty(ref _FixedCameraPickNum, value);
  150. }
  151. private Int16 _FixedCameraPutNum = 0;
  152. /// <summary>
  153. /// 锁附/组装固定位置拍产品相机数量
  154. /// </summary>
  155. public Int16 FixedCameraPutNum
  156. {
  157. get => _FixedCameraPutNum;
  158. set => SetProperty(ref _FixedCameraPutNum, value);
  159. }
  160. private Int16 _FixedCameracheckNum = 0;
  161. /// <summary>
  162. /// 固定相机检测锁附/组装次数
  163. /// </summary>
  164. public Int16 FixedCameracheckNum
  165. {
  166. get => _FixedCameracheckNum;
  167. set => SetProperty(ref _FixedCameracheckNum, value);
  168. }
  169. private Int16 _ScrewTeachNum = 0;
  170. /// <summary>
  171. /// 披头矫正的模式,1:初始化时矫正,2:每个产品矫正一次,3:每颗螺丝矫正一次
  172. /// </summary>
  173. public Int16 ScrewTeachNum
  174. {
  175. get => _ScrewTeachNum;
  176. set => SetProperty(ref _ScrewTeachNum, value);
  177. }
  178. /// <summary>
  179. /// 字体大小子设置
  180. /// </summary>
  181. public class FontSizeSettings : BindableBase
  182. {
  183. private double _title1 = 20;
  184. public double Title1 { get => _title1; set => SetProperty(ref _title1, value); }
  185. private double _title2 = 18;
  186. public double Title2 { get => _title2; set => SetProperty(ref _title2, value); }
  187. private double _title3 = 16;
  188. public double Title3 { get => _title3; set => SetProperty(ref _title3, value); }
  189. private double _title4 = 14;
  190. public double Title4 { get => _title4; set => SetProperty(ref _title4, value); }
  191. private double _body1 = 15;
  192. public double Body1 { get => _body1; set => SetProperty(ref _body1, value); }
  193. private double _body2 = 14;
  194. public double Body2 { get => _body2; set => SetProperty(ref _body2, value); }
  195. private double _body3 = 13;
  196. public double Body3 { get => _body3; set => SetProperty(ref _body3, value); }
  197. private double _body4 = 12;
  198. public double Body4 { get => _body4; set => SetProperty(ref _body4, value); }
  199. private double _captions1 = 11;
  200. public double Captions1 { get => _captions1; set => SetProperty(ref _captions1, value); }
  201. private double _captions2 = 10;
  202. public double Captions2 { get => _captions2; set => SetProperty(ref _captions2, value); }
  203. private double _captions3 = 9;
  204. public double Captions3 { get => _captions3; set => SetProperty(ref _captions3, value); }
  205. private double _captions4 = 8;
  206. public double Captions4 { get => _captions4; set => SetProperty(ref _captions4, value); }
  207. }
  208. }
  209. }