星火批注
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

MainWindow.xaml.cs 2.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Windows;
  7. using System.Windows.Controls;
  8. using System.Windows.Data;
  9. using System.Windows.Documents;
  10. using System.Windows.Input;
  11. using System.Windows.Media;
  12. using System.Windows.Media.Imaging;
  13. using System.Windows.Navigation;
  14. using System.Windows.Shapes;
  15. using Common.system;
  16. namespace XHPZ.Desktop
  17. {
  18. /// <summary>
  19. /// MainWindow.xaml 的交互逻辑
  20. /// </summary>
  21. public partial class MainWindow : Window
  22. {
  23. /// <summary>
  24. /// 屏幕宽
  25. /// </summary>
  26. internal double pwidth = SystemParameters.PrimaryScreenWidth;
  27. /// <summary>
  28. /// 屏幕高
  29. /// </summary>
  30. internal double pHeight = SystemParameters.PrimaryScreenHeight;
  31. public MainWindow()
  32. {
  33. InitializeComponent();
  34. LogHelper.WriteInfoLog("启动");
  35. if(APP.W_PracticeWindow==null)
  36. {
  37. APP.W_PracticeWindow = new PracticeWindow
  38. {
  39. Width = pwidth,
  40. Height = pHeight,
  41. Left = 0,
  42. Top = 0
  43. };
  44. }
  45. APP.W_PracticeWindow.Topmost = true;
  46. APP.W_PracticeWindow.Initialize();
  47. APP.W_PracticeWindow.Show();
  48. }
  49. private void Window_MouseMove(object sender, MouseEventArgs e)
  50. {
  51. if (e.LeftButton == MouseButtonState.Pressed)
  52. {
  53. //this.DragMove();
  54. DragMove();
  55. }
  56. }
  57. private void BtnClose_Click(object sender, RoutedEventArgs e)
  58. {
  59. MessageBoxResult br = MessageWindow.Show("确定退出系统?", "退出", MessageBoxButton.OKCancel);
  60. if (br == MessageBoxResult.OK)
  61. {
  62. System.Environment.Exit(0);
  63. }
  64. }
  65. private void BtnMin_Click(object sender, RoutedEventArgs e)
  66. {
  67. if (WindowState == WindowState.Minimized)
  68. {
  69. WindowState = WindowState.Normal;
  70. }
  71. else
  72. {
  73. WindowState = WindowState.Minimized;
  74. }
  75. }
  76. }
  77. }