using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; using 垂直剖面动态观测系统.ViewModel; namespace 垂直剖面动态观测系统.View { /// /// Interaction logic for MainWindow.xaml /// public partial class MainView : Window { public MainView() { InitializeComponent(); MainViewModel model = new MainViewModel(); this.DataContext = model; //设置当前窗口的最大高度为主屏幕的高度,防止遮住状态栏 一般也可以取消 在工控界面之下 this.MaxHeight = SystemParameters.PrimaryScreenHeight; } /// /// 顶部蓝色区域按钮按下事件 /// /// /// private void Border_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { if (e.LeftButton == MouseButtonState.Pressed) this.DragMove(); switch (e.ClickCount) { case 2: { WindowState = WindowState == WindowState.Maximized ? WindowState.Normal : WindowState.Maximized; break; } } } /// /// 窗体最小化按钮事件 /// /// /// private void btnMin_Click(object sender, RoutedEventArgs e) { this.WindowState = WindowState.Minimized; } /// /// 窗体最大化按钮事件 /// /// /// private void btnMax_Click(object sender, RoutedEventArgs e) { this.WindowState = this.WindowState == WindowState.Maximized ? WindowState.Normal : WindowState.Maximized; } /// /// 窗体关闭按钮事件 /// /// /// private void btnClose_Click(object sender, RoutedEventArgs e) { this.Close(); Application.Current.Shutdown(); } } }