menu.xaml.cs 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  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. namespace KFC
  15. {
  16. /// <summary>
  17. /// Логика взаимодействия для menu.xaml
  18. /// </summary>
  19. public partial class menu : Window
  20. {
  21. public long summ = 0;
  22. public menu()
  23. {
  24. InitializeComponent();
  25. }
  26. public void Update()
  27. {
  28. }
  29. private void Button_Pay(object sender, RoutedEventArgs e)
  30. {
  31. tabcontrol.Visibility = Visibility.Hidden;
  32. txt.Visibility = Visibility.Visible;
  33. txtsumm.Text = $"Итого: {summ}";
  34. btn_pay.Visibility = Visibility.Hidden;
  35. btn_exit.Visibility = Visibility.Visible;
  36. }
  37. #region Burger
  38. public void Burger1(object sender, MouseButtonEventArgs e)
  39. {
  40. summ += 149;
  41. txt.AppendText(Environment.NewLine + $"{"Шефбургер Де Люкс".PadRight(85, ' ')}149 p.");
  42. Update();
  43. }
  44. private void Burger2(object sender, MouseButtonEventArgs e)
  45. {
  46. summ += 99;
  47. txt.AppendText(Environment.NewLine + $"{"Шефбургер Джуниор".PadRight(86, ' ')}99 p.");
  48. Update();
  49. }
  50. private void Burger3(object sender, MouseButtonEventArgs e)
  51. {
  52. summ += 69;
  53. txt.AppendText(Environment.NewLine + $"{"Чизбургер с Луком".PadRight(90, ' ')}69 p.");
  54. Update();
  55. }
  56. private void Burger4(object sender, MouseButtonEventArgs e)
  57. {
  58. summ += 99;
  59. txt.AppendText(Environment.NewLine + $"{ "Шефбургер".PadRight(94, ' ')}99 p.");
  60. Update();
  61. }
  62. private void Burger5(object sender, MouseButtonEventArgs e)
  63. {
  64. summ += 129;
  65. txt.AppendText(Environment.NewLine + $"{"Чизбургер Де Люкс".PadRight(87, ' ')}129 p.");
  66. Update();
  67. }
  68. #endregion
  69. #region Tvister
  70. private void Tvister1(object sender, MouseButtonEventArgs e)
  71. {
  72. summ += 269;
  73. txt.AppendText(Environment.NewLine + $"{ "2 твистера".PadRight(95, ' ')}269 p.");
  74. Update();
  75. }
  76. private void Tvister2(object sender, MouseButtonEventArgs e)
  77. {
  78. summ += 189;
  79. txt.AppendText(Environment.NewLine + $"{"Твистер Де Люкс".PadRight(89, ' ')}189 p.");
  80. Update();
  81. }
  82. private void Tvister3(object sender, MouseButtonEventArgs e)
  83. {
  84. summ += 99;
  85. txt.AppendText(Environment.NewLine + $"{"Твистер Джуниор".PadRight(90, ' ')}99 p.");
  86. Update();
  87. }
  88. #endregion
  89. #region Potato
  90. private void Potato1(object sender, MouseButtonEventArgs e)
  91. {
  92. summ += 99;
  93. txt.AppendText(Environment.NewLine + $"{"Баскет фри".PadRight(96, ' ')}99 p.");
  94. Update();
  95. }
  96. private void Potato2(object sender, MouseButtonEventArgs e)
  97. {
  98. summ += 79;
  99. txt.AppendText(Environment.NewLine + $"{"Картофель по-деревенски".PadRight(83, ' ')}79 p.");
  100. Update();
  101. }
  102. #endregion
  103. #region Dessert
  104. private void Dessert1(object sender, MouseButtonEventArgs e)
  105. {
  106. summ += 55;
  107. txt.AppendText(Environment.NewLine + $"{"Пирожок с вишней".PadRight(88, ' ')}55 p.");
  108. Update();
  109. }
  110. private void Dessert2(object sender, MouseButtonEventArgs e)
  111. {
  112. summ += 79;
  113. txt.AppendText(Environment.NewLine + $"{"Донат Карамельный".PadRight(88, ' ')}79 p.");
  114. Update();
  115. }
  116. #endregion
  117. private void Button_Exit(object sender, RoutedEventArgs e)
  118. {
  119. Application.Current.Shutdown();
  120. }
  121. #region for tests
  122. public long Summ()
  123. {
  124. Burger1(null, null);
  125. Tvister1(null, null);
  126. Potato1(null, null);
  127. Dessert1(null, null);
  128. return summ;
  129. }
  130. public string Check()
  131. {
  132. Tvister1(null, null);
  133. Button_Pay(null, null);
  134. return txtsumm.Text;
  135. }
  136. public string CheckPuy()
  137. {
  138. Burger1(null, null);
  139. Button_Pay(null, null);
  140. return txt.Text;
  141. }
  142. public long CheckSumm2()
  143. {
  144. Burger1(null, null);
  145. Burger1(null, null);
  146. return summ;
  147. }
  148. #endregion
  149. }
  150. }