GasPanelHolder.xaml.cs 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. namespace HistoryView.Views.Regions;
  2. public partial class GasPanelHolder : UserControl
  3. {
  4. public GasPanelHolder()
  5. {
  6. InitializeComponent();
  7. //LoadWindow();
  8. }
  9. private void LoadWindow()
  10. {
  11. Task.Run(() =>
  12. {
  13. if (!BaseConfigFileLoader.Load(out BasicInfo? basicInfo) || basicInfo is null || string.IsNullOrEmpty(basicInfo.GasPanelWindowName))
  14. return;
  15. this.Dispatcher.Invoke(() =>
  16. {
  17. if (!SetWindow.FindWindow(basicInfo.GasPanelWindowName))
  18. return;
  19. SetWindow.SetParent(panel.Handle);
  20. });
  21. });
  22. }
  23. private void Button_Click(object sender, RoutedEventArgs e)
  24. {
  25. LoadWindow();
  26. }
  27. private void UserControl_SizeChanged(object sender, SizeChangedEventArgs e)
  28. {
  29. Task.Factory.StartNew(SetWindow.ResizeWindow);
  30. }
  31. private void Button_Click_1(object sender, RoutedEventArgs e)
  32. {
  33. SetWindow.ExitParent();
  34. }
  35. }