DlgExample.xaml.cs 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. using MV485.model;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using System.Windows;
  8. using System.Windows.Controls;
  9. using System.Windows.Data;
  10. using System.Windows.Documents;
  11. using System.Windows.Input;
  12. using System.Windows.Media;
  13. using System.Windows.Media.Imaging;
  14. using System.Windows.Shapes;
  15. namespace MV485.Dlg
  16. {
  17. /// <summary>
  18. /// DlgExample.xaml 的交互逻辑
  19. /// </summary>
  20. public partial class DlgExample : Window
  21. {
  22. public DlgExample(ExampleType exampleType)
  23. {
  24. InitializeComponent();
  25. InitView(exampleType);
  26. }
  27. private void InitView(ExampleType exampleType)
  28. {
  29. string htmlPath;
  30. if(exampleType == ExampleType.MeterType)
  31. {
  32. htmlPath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "example", "水表类型.htm");
  33. docBrowser.Navigate(new Uri(htmlPath));
  34. //this.Title = Example.ExampleMap.Values.ge
  35. }
  36. else if(exampleType == ExampleType.DnValue)
  37. {
  38. htmlPath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "example", "meter_dn.htm");
  39. docBrowser.Navigate(new Uri(htmlPath));
  40. }
  41. else if (exampleType == ExampleType.DigitCount)
  42. {
  43. htmlPath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "example", "数字个数.htm");
  44. docBrowser.Navigate(new Uri(htmlPath));
  45. }
  46. else if (exampleType == ExampleType.IndicatorCount)
  47. {
  48. htmlPath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "example", "指针个数.htm");
  49. docBrowser.Navigate(new Uri(htmlPath));
  50. }
  51. else if (exampleType == ExampleType.LastUnit)
  52. {
  53. htmlPath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "example", "尾数单位.htm");
  54. docBrowser.Navigate(new Uri(htmlPath));
  55. }
  56. else if (exampleType == ExampleType.LastValue)
  57. {
  58. htmlPath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "example", "表底读数.htm");
  59. docBrowser.Navigate(new Uri(htmlPath));
  60. }
  61. else if (exampleType == ExampleType.LastTime)
  62. {
  63. htmlPath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "example", "读数时间.htm");
  64. docBrowser.Navigate(new Uri(htmlPath));
  65. }
  66. else if (exampleType == ExampleType.MeterRegion)
  67. {
  68. htmlPath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "example", "表盘范围.htm");
  69. docBrowser.Navigate(new Uri(htmlPath));
  70. }
  71. else if (exampleType == ExampleType.DigitRegion)
  72. {
  73. htmlPath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "example", "数字区域坐标.htm");
  74. docBrowser.Navigate(new Uri(htmlPath));
  75. }
  76. else if (exampleType == ExampleType.FWRegion)
  77. {
  78. htmlPath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "example", "首尾指针同刻度坐标.htm");
  79. docBrowser.Navigate(new Uri(htmlPath));
  80. }
  81. else if (exampleType == ExampleType.SampleInterval)
  82. {
  83. htmlPath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "example", "采样周期.htm");
  84. docBrowser.Navigate(new Uri(htmlPath));
  85. }
  86. else if (exampleType == ExampleType.SampleFirstHour)
  87. {
  88. htmlPath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "example", "首采时间.htm");
  89. docBrowser.Navigate(new Uri(htmlPath));
  90. }
  91. else if (exampleType == ExampleType.BrightVal)
  92. {
  93. htmlPath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "example", "亮度系数.htm");
  94. docBrowser.Navigate(new Uri(htmlPath));
  95. }
  96. else if(exampleType == ExampleType.UploadRedind)
  97. {
  98. htmlPath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "example", "是否上传红色指针读数.htm");
  99. docBrowser.Navigate(new Uri(htmlPath));
  100. }
  101. if (Example.ExampleMap.TryGetValue(exampleType, out string title))
  102. {
  103. this.Title = $"{title} - 说明示例";
  104. }
  105. }
  106. //-----------------------------
  107. }
  108. }