StationUserControl.cs 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Drawing;
  5. using System.Data;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. using PMSUI.Model;
  11. namespace PMSUI
  12. {
  13. public partial class StationUserControl : UserControl
  14. {
  15. public StationUserControl()
  16. {
  17. InitializeComponent();
  18. }
  19. private int _id;
  20. private string name = "";
  21. private string type = "";
  22. private int status = 0;
  23. private int area = 0;
  24. public int ID
  25. {
  26. get { return _id; }
  27. set
  28. {
  29. _id = value;
  30. }
  31. }
  32. public string JobName
  33. {
  34. get { return name; }
  35. set
  36. {
  37. name = value;
  38. this.Invoke(new Action(() =>
  39. {
  40. this.lbname.Text = name;
  41. }));
  42. }
  43. }
  44. public string Materials
  45. {
  46. get { return type; }
  47. set
  48. {
  49. type = value;
  50. //if (type == 0 || this.area != VariableClass.DischargeArea)
  51. //{ lbtype.Visible = false; }
  52. //else
  53. //{
  54. // lbtype.Visible = true;
  55. //}
  56. this.Invoke(new Action(() =>
  57. {
  58. this.lbtype.Text = type.ToString();
  59. }));
  60. }
  61. }
  62. public int Status
  63. {
  64. get { return status; }
  65. set
  66. {
  67. status = value;
  68. if (!this.IsHandleCreated)
  69. { base.CreateHandle(); }
  70. this.Invoke(new Action(() =>
  71. {
  72. lbstatus.Text = status == VariableClass.StationEmpty ? VariableClass.Empty : (status == VariableClass.StationFill ? VariableClass.Fill : VariableClass.Tasking);
  73. switch (status)
  74. {
  75. case 1:
  76. this.BackColor = Color.AntiqueWhite;
  77. break;
  78. case 2:
  79. this.BackColor = Color.Green;
  80. break;
  81. case 3:
  82. this.BackColor = Color.Yellow;
  83. break;
  84. default:
  85. this.BackColor = Color.Yellow;
  86. break;
  87. }
  88. }));
  89. }
  90. }
  91. }
  92. }