MainWindow.xaml.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using Showlicense.ViewModel;
  2. using System.Windows;
  3. using System.Windows.Input;
  4. namespace Showlicense
  5. {
  6. /// <summary>
  7. /// MainWindow.xaml 的交互逻辑
  8. /// </summary>
  9. public partial class MainWindow
  10. {
  11. public MainWindow()
  12. {
  13. WindowStartupLocation = WindowStartupLocation.CenterScreen;
  14. InitializeComponent();
  15. DataContext = new MainWindowViewModel();
  16. }
  17. /// <summary>
  18. /// 关闭按钮
  19. /// </summary>
  20. /// <param name="sender"></param>
  21. /// <param name="e"></param>
  22. private void Button_Click(object sender, RoutedEventArgs e)
  23. {
  24. this.Close();
  25. }
  26. /// <summary>
  27. /// 鼠标拖动标题栏时整个窗口跟随移动
  28. /// </summary>
  29. /// <param name="sender"></param>
  30. /// <param name="e"></param>
  31. private void Window_MouseMove(object sender, MouseEventArgs e)
  32. {
  33. if (e.LeftButton == MouseButtonState.Pressed)
  34. {
  35. this.DragMove();
  36. }
  37. }
  38. }
  39. }