OneWindow.xaml.cs 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. using nukakto.Models;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  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 nukakto
  16. {
  17. /// <summary>
  18. /// Логика взаимодействия для OneWindow.xaml
  19. /// </summary>
  20. public partial class OneWindow : Window
  21. {
  22. public OneWindow()
  23. {
  24. InitializeComponent();
  25. gr606_kusanContext context = new gr606_kusanContext();
  26. AttractionsView.ItemsSource = context.Attractions.ToList();
  27. }
  28. private void Button_Click(object sender, RoutedEventArgs e)
  29. {
  30. this.Hide();
  31. Maps map = new Maps();
  32. map.Show();
  33. }
  34. private void Button_Click_1(object sender, RoutedEventArgs e)
  35. {
  36. this.Hide();
  37. StockWindow sto = new StockWindow();
  38. sto.Show();
  39. }
  40. private void Button_Click_2(object sender, RoutedEventArgs e)
  41. {
  42. this.Hide();
  43. Setting at = new Setting();
  44. at.Show();
  45. }
  46. private void Button_Click_3(object sender, RoutedEventArgs e)
  47. {
  48. gr606_kusanContext context = new gr606_kusanContext();
  49. var attraction = (sender as Button).DataContext as Attraction;
  50. var stock = context.Stocks.SingleOrDefault(x => x.IdAttractions == attraction.IdAttractions);
  51. MessageBox.Show("Название: " + attraction.Name + "\n" + "Номер: " + attraction.IdAttractions + "\n" + "Акции на аттракцион " + stock.IdStock);
  52. }
  53. }
  54. }