HistoryViewer.cs 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. namespace MinicsUI.Helper;
  2. public class HistoryViewer(MonitorHelper monitorHelper)
  3. {
  4. public bool StartChannelHistory(byte mini8Index, byte channelIndex)
  5. {
  6. if (!monitorHelper.Monitors.TryGetValue(monitorHelper.SelectedDisplay, out MonitorInfo? monitorInfo) || monitorInfo is null)
  7. return false;
  8. ProcessStartInfo startInfo = new()
  9. {
  10. FileName = FilePaths.HistoryExe,
  11. UseShellExecute = false,
  12. RedirectStandardOutput = true,
  13. };
  14. startInfo.ArgumentList.Add(monitorInfo.StartPixVertical.ToString());
  15. startInfo.ArgumentList.Add(monitorInfo.StartPixHorizontal.ToString());
  16. startInfo.ArgumentList.Add(monitorInfo.ResolutionVertical.ToString());
  17. startInfo.ArgumentList.Add(monitorInfo.ResolutionHorizontal.ToString());
  18. startInfo.ArgumentList.Add("1");
  19. startInfo.ArgumentList.Add(mini8Index.ToString());
  20. startInfo.ArgumentList.Add(channelIndex.ToString());
  21. try
  22. {
  23. Process.Start(startInfo);
  24. return true;
  25. }
  26. catch
  27. {
  28. return false;
  29. }
  30. }
  31. public bool StartMultiChannelHistory(byte mini8Index)
  32. {
  33. if (!monitorHelper.Monitors.TryGetValue(monitorHelper.SelectedDisplay, out MonitorInfo? monitorInfo) || monitorInfo is null)
  34. return false;
  35. ProcessStartInfo startInfo = new()
  36. {
  37. FileName = FilePaths.HistoryExe,
  38. UseShellExecute = false,
  39. RedirectStandardOutput = true,
  40. };
  41. startInfo.ArgumentList.Add(monitorInfo.StartPixVertical.ToString());
  42. startInfo.ArgumentList.Add(monitorInfo.StartPixHorizontal.ToString());
  43. startInfo.ArgumentList.Add(monitorInfo.ResolutionVertical.ToString());
  44. startInfo.ArgumentList.Add(monitorInfo.ResolutionHorizontal.ToString());
  45. startInfo.ArgumentList.Add("3");
  46. startInfo.ArgumentList.Add(mini8Index.ToString());
  47. startInfo.ArgumentList.Add("1");
  48. try
  49. {
  50. Process.Start(startInfo);
  51. return true;
  52. }
  53. catch
  54. {
  55. return false;
  56. }
  57. }
  58. public bool StartAlarmHistroy()
  59. {
  60. if (!monitorHelper.Monitors.TryGetValue(monitorHelper.SelectedDisplay, out MonitorInfo? monitorInfo) || monitorInfo is null)
  61. return false;
  62. ProcessStartInfo startInfo = new()
  63. {
  64. FileName = FilePaths.HistoryExe,
  65. UseShellExecute = false,
  66. RedirectStandardOutput = true,
  67. };
  68. startInfo.ArgumentList.Add(monitorInfo.StartPixVertical.ToString());
  69. startInfo.ArgumentList.Add(monitorInfo.StartPixHorizontal.ToString());
  70. startInfo.ArgumentList.Add(monitorInfo.ResolutionVertical.ToString());
  71. startInfo.ArgumentList.Add(monitorInfo.ResolutionHorizontal.ToString());
  72. startInfo.ArgumentList.Add("2");
  73. try
  74. {
  75. Process.Start(startInfo);
  76. return true;
  77. }
  78. catch
  79. {
  80. return false;
  81. }
  82. }
  83. }