终端一体化运控平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

FuncParHelpClass.cs 2.4 KiB

1 year ago
1 year ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. using BPASmartClient.MorkCL.Server;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. namespace BPASmartClient.MorkCL.HelpClass
  8. {
  9. public class FuncParHelpClass:FuncPar
  10. {
  11. private bool _IsUseComboBox;
  12. /// <summary>
  13. /// 根据参数名称,判断是否使用组合框。
  14. /// </summary>
  15. public bool IsUseComboBox
  16. {
  17. get { return _IsUseComboBox; }
  18. set { _IsUseComboBox = value; }
  19. }
  20. private ObservableCollection<object> _ComboBoxItemsSource;
  21. public ObservableCollection<object> ComboBoxItemsSource
  22. {
  23. get { return _ComboBoxItemsSource; }
  24. set { _ComboBoxItemsSource = value;}
  25. }
  26. /// <summary>
  27. /// 参数数据源。
  28. /// </summary>
  29. public static Dictionary<string, ObservableCollection<object>> ParOptions { get; } = new Dictionary<string, ObservableCollection<object>>()
  30. {
  31. //{"搅拌速度",new ObservableCollection<object>(){10,20,30,40,50 } },
  32. //{"加热档位",new ObservableCollection<object> {1,2,3,4,5,6,7,8} },
  33. {"调料名称",new ObservableCollection<object>( SqliteHelper.GetInstance.GetSeasoning()) },
  34. {"主料名称",new ObservableCollection<object>( SqliteHelper.GetInstance.GetIngredients()) },
  35. {"辅料名称",new ObservableCollection<object>( SqliteHelper.GetInstance.GetAccessories()) },
  36. //{"设置炒制位",new ObservableCollection<object> {1,2,3,4} },
  37. };
  38. public static ObservableCollection<object> GetParOptions(string paramName)
  39. {
  40. if (paramName is null)
  41. {
  42. throw new ArgumentNullException("paramName", "参数名称不可为空");
  43. }
  44. ObservableCollection<object> parOption;
  45. switch (paramName)
  46. {
  47. case "调料名称": parOption = new ObservableCollection<object>(SqliteHelper.GetInstance.GetSeasoning());
  48. break;
  49. case "主料名称":
  50. parOption = new ObservableCollection<object>(SqliteHelper.GetInstance.GetIngredients());
  51. break;
  52. case "辅料名称":
  53. parOption = new ObservableCollection<object>(SqliteHelper.GetInstance.GetAccessories());
  54. break;
  55. default:
  56. parOption = new();
  57. break;
  58. }
  59. return parOption;
  60. }
  61. }
  62. }