AOCtrl.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. using Aitex.Core.RT.IOCore;
  10. namespace Aitex.Core.Backend
  11. {
  12. public partial class AOCtrl : UserControl
  13. {
  14. private string _ioName;
  15. public AOCtrl()
  16. {
  17. InitializeComponent();
  18. }
  19. public void SetIoName(string group, string ioName)
  20. {
  21. _ioName = ioName;
  22. }
  23. public void SetName(string name)
  24. {
  25. labelName.Text = name;
  26. }
  27. /// <summary>
  28. /// set value
  29. /// </summary>
  30. /// <param name="value"></param>
  31. public void SetValue(float value)
  32. {
  33. textBox1.Text = String.Format("{0:f2}", value);
  34. }
  35. private void button1_Click(object sender, EventArgs e)
  36. {
  37. double value;
  38. if (double.TryParse(textBox2.Text, out value ))
  39. IO.AO[_ioName].Value = (short) value;
  40. }
  41. }
  42. }