Client.xaml.cs 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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.Shapes;
  14. using System.Windows.Threading;
  15. namespace HotelCalifornia
  16. {
  17. /// <summary>
  18. /// Логика взаимодействия для Client.xaml
  19. /// </summary>
  20. public partial class Client : Window
  21. {
  22. public Client()
  23. {
  24. InitializeComponent();
  25. DispatcherTimer timer = new DispatcherTimer();
  26. timer.Tick += new EventHandler(Update_Timer_Tick);
  27. timer.Interval = new TimeSpan(0, 0, 1);
  28. timer.Start();
  29. }
  30. private void Update_Timer_Tick(object sender, EventArgs e)
  31. {
  32. timetxt.Text = DateTime.Now.ToString();
  33. }
  34. //Перетаскивание окна
  35. private void Grid_MouseDown(object sender, MouseButtonEventArgs e)
  36. {
  37. DragMove();
  38. }
  39. //Возврат к окну выбора функции
  40. private void Back(object sender, RoutedEventArgs e)
  41. {
  42. MessageBoxResult result = MessageBox.Show("Вы хотите вернуться к предыдущему окну?", "Предупреждение", MessageBoxButton.YesNo, MessageBoxImage.Question);
  43. switch (result)
  44. {
  45. case MessageBoxResult.Yes:
  46. Variant variant = new Variant();
  47. this.Close();
  48. variant.Show();
  49. break;
  50. case MessageBoxResult.No:
  51. break;
  52. }
  53. }
  54. //Выход из приложения
  55. private void Close(object sender, RoutedEventArgs e)
  56. {
  57. MessageBoxResult result = MessageBox.Show("Вы хотите выйти из приложения?", "Предупреждение", MessageBoxButton.YesNo, MessageBoxImage.Question);
  58. switch (result)
  59. {
  60. case MessageBoxResult.Yes:
  61. Application.Current.Shutdown();
  62. break;
  63. case MessageBoxResult.No:
  64. break;
  65. }
  66. }
  67. private void WindMin_Click(object sender, RoutedEventArgs e)
  68. {
  69. this.WindowState = WindowState.Minimized;
  70. }
  71. }
  72. }