WindturbineInfoWindow.xaml.cs 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. using NEIntelligentControl2.Models.Windturbine;
  2. using NEIntelligentControl2.Service.Station;
  3. using NEIntelligentControl2.Service.Windturbine;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows;
  10. using System.Windows.Controls;
  11. using System.Windows.Data;
  12. using System.Windows.Documents;
  13. using System.Windows.Input;
  14. using System.Windows.Media;
  15. using System.Windows.Media.Imaging;
  16. using System.Windows.Shapes;
  17. namespace NEIntelligentControl2.Windows
  18. {
  19. /// <summary>
  20. /// 风机详情页
  21. /// </summary>
  22. public partial class WindturbineInfoWindow : Window
  23. {
  24. public WindturbineInfo WindturbineInfo { get; set; }
  25. private StationManager _StationManager;
  26. public WindturbineInfoWindow(StationManager sm)
  27. {
  28. InitializeComponent();
  29. _StationManager = sm;
  30. }
  31. private void Button_Click(object sender, RoutedEventArgs e)
  32. {
  33. switch (((Control)sender).Tag)
  34. {
  35. case "close":
  36. this.Close();
  37. break;
  38. default: return;
  39. }
  40. }
  41. public static void ShowWindow(WindturbineInfo info)
  42. {
  43. WindturbineInfoWindow wiw = App.ServiceProvider.GetService(typeof(WindturbineInfoWindow)) as WindturbineInfoWindow;
  44. wiw.Owner = Application.Current.MainWindow;
  45. wiw.WindturbineInfo = info;
  46. wiw.ShowDialog();
  47. }
  48. private void Window_Loaded(object sender, RoutedEventArgs e)
  49. {
  50. Init();
  51. }
  52. private void Init()
  53. {
  54. string title = $"{_StationManager.GetStatonInfo(WindturbineInfo.StationId)?.Name} {WindturbineInfo.WindturbineId} 风机型号:{WindturbineInfo.ModelId}";
  55. _TBTitle.Text = title;
  56. _WDMain.WindturbineInfo = WindturbineInfo;
  57. _PDMain.WindturbineInfo = WindturbineInfo;
  58. //_WAR.WindturbineInfo = WindturbineInfo;
  59. //_WAH.WindturbineInfo = WindturbineInfo;
  60. _WAC.WindturbineInfo = WindturbineInfo;
  61. //_SC.WindturbineInfo = WindturbineInfo;
  62. _WAC.IsCustom = true;
  63. }
  64. }
  65. }