ProcessChamberView.xaml.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. using CyberX8_MainPages.ViewModels;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Diagnostics;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. using System.Windows;
  9. using System.Windows.Controls;
  10. using System.Windows.Data;
  11. using System.Windows.Documents;
  12. using System.Windows.Input;
  13. using System.Windows.Media;
  14. using System.Windows.Media.Imaging;
  15. using System.Windows.Navigation;
  16. using System.Windows.Shapes;
  17. namespace CyberX8_MainPages.Views
  18. {
  19. /// <summary>
  20. /// ProcessChamberView.xaml 的交互逻辑
  21. /// </summary>
  22. public partial class ProcessChamberView : UserControl
  23. {
  24. public ProcessChamberView()
  25. {
  26. InitializeComponent();
  27. }
  28. private void UserControl_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
  29. {
  30. if (e.NewValue != null)
  31. {
  32. bool isShow = (bool)e.NewValue;
  33. if (isShow)
  34. {
  35. if (this.DataContext != null)
  36. {
  37. (this.DataContext as ProcessChamberViewModel).LoadData(this.Tag);
  38. }
  39. }
  40. else
  41. {
  42. if (this.DataContext != null)
  43. {
  44. (this.DataContext as ProcessChamberViewModel).Hide();
  45. }
  46. }
  47. }
  48. else
  49. {
  50. if (this.DataContext != null)
  51. {
  52. (this.DataContext as ProcessChamberViewModel).Hide();
  53. }
  54. }
  55. }
  56. }
  57. }