MIL.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Drawing;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using Uestc.Auto6.Dso.ComModel;
  8. using Uestc.Auto6.Dso.Core;
  9. using Uestc.Auto6.Dso.Core.Decode;
  10. using Uni_Trend.MSO7000X.Common.Helper;
  11. using System.Windows.Forms;
  12. namespace Uestc.Auto6.Dso.Protocol.MIL
  13. {
  14. internal class MIL : DecodeView
  15. {
  16. public override IProtocolView ProtocolView => new MILSetControl();
  17. public override ITriggerSerialView TriggerSerialView => new MILTriggerSetControl();
  18. public override SerialProtocolType ProtocolType => SerialProtocolType.MIL;
  19. public override void DrawDecodeInfo(Graphics graphics, Rectangle rectangle, IProtocolPrsnt prsnt, Color ForeColor, Font font)
  20. {
  21. if (prsnt is MILDecodePrsnt decodePrsnt)
  22. {
  23. TextRenderer.DrawText(graphics, SIHelper.ValueChangeToSI(decodePrsnt.RealSignalRate, 2, "bps"), font, GetRowRectangle(), ForeColor, TextFormatFlags.Right | TextFormatFlags.VerticalCenter);
  24. String tempstr = decodePrsnt.Source.ToString();
  25. if(decodePrsnt.Polarity == ProtocolMIL.Polarity.Neg)
  26. {
  27. tempstr += "⬇";
  28. }
  29. TextRenderer.DrawText(graphics, tempstr, font, GetRowRectangle(1), ForeColor, TextFormatFlags.Left | TextFormatFlags.VerticalCenter);
  30. TextRenderer.DrawText(graphics, SIHelper.ValueChangeToSI(decodePrsnt.Threshold, 2, "V"), font, GetRowRectangle(1), ForeColor, TextFormatFlags.Right | TextFormatFlags.VerticalCenter);
  31. }
  32. }
  33. }
  34. }