Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Data;
- using System.Windows.Documents;
- using System.Windows.Input;
- using System.Windows.Media;
- using System.Windows.Media.Imaging;
- using System.Windows.Navigation;
- using System.Windows.Shapes;
- namespace WpfApp2
- {
- /// <summary>
- /// Logika interakcji dla klasy MainWindow.xaml
- /// </summary>
- public partial class MainWindow : Window
- {
- public MainWindow()
- {
- InitializeComponent();
- }
- int cena = 0, cena2 = 0, cena3 = 0;
- int kwota = 2, kwota2 = 0, kwota3 = 0;
- private void klik(Object sender, RoutedEventArgs e)
- {
- string stri = "Wielkość:\n ";
- foreach (RadioButton cbx in wielkosc.Children)
- {
- if (cbx.IsChecked == true)
- {
- stri += cbx.Tag;
- }
- }
- wybor.Content = stri;
- if (radiobutton1.IsChecked == true) kwota2 = 20;
- else if (radiobutton2.IsChecked == true) kwota2 = 27;
- else if (radiobutton3.IsChecked == true) kwota2 = 32;
- else kwota2 = 40;
- string str = "Dodatki:\n ";
- foreach (CheckBox cbx in Dodatki.Children)
- {
- if (cbx.IsChecked == true)
- {
- str += cbx.Tag + ",\n ";
- cena += kwota;
- }
- }
- cena2 = cena;
- cena = 0;
- wybor2.Content = str;
- }
- private void zamow_Click(object sender, RoutedEventArgs e)
- {
- cena2 = cena2 + kwota2;
- if (cena2 > 40)
- {
- MessageBoxResult result = MessageBox.Show("Koszt Pizzy: " + cena2 + "zł",
- "Zamów",
- MessageBoxButton.YesNo,
- MessageBoxImage.Question);
- if (result == MessageBoxResult.Yes)
- {
- Application.Current.Shutdown();
- }
- }
- else
- {
- MessageBoxResult result = MessageBox.Show("Koszt Pizzy: " + cena2+ "zł\n" + "koszta dostawy: " + 5 + "zł",
- "Zamów",
- MessageBoxButton.YesNo,
- MessageBoxImage.Question);
- if (result == MessageBoxResult.Yes)
- {
- Application.Current.Shutdown();
- }
- }
- }
- private void rodzaj_SelectionChanged(object sender, SelectionChangedEventArgs e)
- {
- switch (rodzaj.SelectedIndex)
- {
- case 0:
- zamow.IsEnabled = true;
- break;
- case 1:
- zamow.IsEnabled = true;
- break;
- case 2:
- zamow.IsEnabled = true;
- break;
- case 3:
- zamow.IsEnabled = true;
- break;
- case 4:
- zamow.IsEnabled = true;
- break;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement