AICtrl.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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.Windows.Forms;
  9. namespace Aitex.Core.Backend
  10. {
  11. public partial class AICtrl : UserControl
  12. {
  13. public AICtrl()
  14. {
  15. InitializeComponent();
  16. }
  17. public void SetName(string name)
  18. {
  19. labelName.Text = name;
  20. }
  21. /// <summary>
  22. /// is forced to some value
  23. /// </summary>
  24. public void SetForced(bool force)
  25. {
  26. if (force)
  27. {
  28. btnForce.BackColor = Color.Red;
  29. btnAuto.BackColor = Color.LightGray;
  30. }
  31. else
  32. {
  33. btnForce.BackColor = Color.LightGray;
  34. btnAuto.BackColor = Color.LightGray;
  35. }
  36. }
  37. /// <summary>
  38. /// set value
  39. /// </summary>
  40. /// <param name="value"></param>
  41. public void SetValue(float value)
  42. {
  43. string disp = String.Format("{0:f2}", value);
  44. if (textBoxCurr.Text != disp)
  45. textBoxCurr.Text = disp;
  46. }
  47. /// <summary>
  48. /// get value
  49. /// </summary>
  50. /// <returns></returns>
  51. public Int16 GetValue()
  52. {
  53. string hexString = textBoxSetPt.Text;
  54. Int16 resu = 0;
  55. if (!Int16.TryParse(hexString, System.Globalization.NumberStyles.HexNumber, null, out resu))
  56. resu = 0;
  57. return resu;
  58. }
  59. private void btnAuto_Click(object sender, EventArgs e)
  60. {
  61. //var sim = Aitex.FlyWheel.Simulation.Sim_TcAdsClient.Instance;
  62. //if (sim != null)
  63. // sim.AI_Forced[(int)Tag] = false;
  64. }
  65. private void btnForce_Click(object sender, EventArgs e)
  66. {
  67. //var sim = Aitex.FlyWheel.Simulation.Sim_TcAdsClient.Instance;
  68. //if (sim != null)
  69. //{
  70. // sim.AI_Forced[(int)Tag] = true;
  71. // sim.INPUT.AI[(int)Tag] = GetValue();
  72. //}
  73. }
  74. }
  75. }