终端一体化运控平台
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.
 
 
 

63 lines
2.2 KiB

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Reflection;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using System.Windows;
  8. using System.Windows.Controls;
  9. using System.Windows.Data;
  10. using System.Windows.Documents;
  11. using System.Windows.Input;
  12. using System.Windows.Media;
  13. using System.Windows.Media.Imaging;
  14. using System.Windows.Shapes;
  15. namespace BPASmartClient.CustomResource.Pages.View
  16. {
  17. /// <summary>
  18. /// MainView.xaml 的交互逻辑
  19. /// </summary>
  20. public partial class MainView : Window
  21. {
  22. public static double CurrentWidth { get; set; } = 800d;
  23. public static double CurrentHeight { get; set; } = 500d;
  24. public static double LeftLoc { get; set; } = 0d;
  25. public static double TopLoc { get; set; } = 0d;
  26. public string TitleName { get { return _mTitleName; } set { _mTitleName = value; this.tbTitle.Text = value; } }
  27. private string _mTitleName;
  28. public MainView()
  29. {
  30. InitializeComponent();
  31. this.WindowState = WindowState.Maximized;
  32. this.ButMin.Click += (o, e) => { this.WindowState = WindowState.Minimized; };
  33. this.ButMax.Click += (o, e) => { this.WindowState = this.WindowState == WindowState.Maximized ? WindowState.Normal : WindowState.Maximized; };
  34. this.ButClose.Click += (o, e) => { this.Close(); Application.Current.Shutdown(); };
  35. this.MoveBorder.MouseLeftButtonDown += (o, e) =>
  36. {
  37. if (e.ClickCount > 1)
  38. {
  39. if (this.WindowState == WindowState.Maximized)
  40. this.WindowState = WindowState.Normal;
  41. else if (this.WindowState == WindowState.Normal)
  42. this.WindowState = WindowState.Maximized;
  43. }
  44. if (e.LeftButton == MouseButtonState.Pressed) this.DragMove();
  45. LeftLoc = this.Left;
  46. TopLoc = this.Top;
  47. };
  48. this.SizeChanged += (o, e) =>
  49. {
  50. CurrentWidth = this.Width;
  51. CurrentHeight = this.Height;
  52. LeftLoc = this.Left;
  53. TopLoc = this.Top;
  54. };
  55. }
  56. }
  57. }