korzinka.xaml.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data.Entity;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. using System.Windows;
  9. using System.Windows.Controls;
  10. using System.Windows.Data;
  11. using System.Windows.Documents;
  12. using System.Windows.Input;
  13. using System.Windows.Media;
  14. using System.Windows.Media.Imaging;
  15. using System.Windows.Navigation;
  16. using System.Windows.Shapes;
  17. namespace test
  18. {
  19. /// <summary>
  20. /// Логика взаимодействия для korzinka.xaml
  21. /// </summary>
  22. public partial class korzinka : Page
  23. {
  24. List<Books> bo = new List<Books>();
  25. public korzinka(List<Books> books, int sale)
  26. {
  27. InitializeComponent();
  28. ListZak.ItemsSource = books;
  29. ListZak.Items.Refresh();
  30. bo = books;
  31. if(sale==0)
  32. }
  33. private void menu_Click(object sender, RoutedEventArgs e)
  34. {
  35. ChangePage.Frame.Navigate(new books());
  36. }
  37. private void clear_Click(object sender, RoutedEventArgs e)
  38. {
  39. ListZak.ItemsSource = null;
  40. ListZak.Items.Refresh();
  41. }
  42. private void delit_Click(object sender, RoutedEventArgs e)
  43. {
  44. Button button = (Button)sender;
  45. int id = Convert.ToInt32(button.Uid);
  46. Books prov = Base.Entities.Books.FirstOrDefault(x => x.IdBook == id);
  47. bo.Remove(prov);
  48. ListZak.Items.Refresh();
  49. }
  50. }
  51. }