MainWindow.xaml.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. using System.Windows;
  2. using System.Windows.Input;
  3. namespace MyTests
  4. {
  5. public partial class MainWindow : Window
  6. {
  7. public MainWindow()
  8. {
  9. InitializeComponent();
  10. MainFrame.Content = new Pages.LoginPage();
  11. }
  12. #region Кнопки закрытия и скрытия приложения
  13. private void Border_MouseDown(object sender, MouseButtonEventArgs e)
  14. {
  15. if (e.LeftButton == MouseButtonState.Pressed)
  16. DragMove(); // Возможность перетаскивать
  17. }
  18. private void ButtonMininize_Click(object sender, RoutedEventArgs e)
  19. {
  20. Application.Current.MainWindow.WindowState = WindowState.Minimized; //Скрытие
  21. }
  22. private void WindowStateButton_Click(object sender, RoutedEventArgs e)
  23. {
  24. if (Application.Current.MainWindow.WindowState != WindowState.Maximized)
  25. Application.Current.MainWindow.WindowState = WindowState.Maximized;
  26. else
  27. Application.Current.MainWindow.WindowState = WindowState.Normal;
  28. }
  29. private void CloseButton_Click(object sender, RoutedEventArgs e)
  30. {
  31. Application.Current.Shutdown(); // Закрытие программы
  32. }
  33. #endregion
  34. }
  35. }