123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178 |
- 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 kursach3
- {
- /// <summary>
- /// Логика взаимодействия для MainWindow.xaml
- /// </summary>
- public partial class MainWindow : Window
- {
- public MainWindow()
- {
- InitializeComponent();
- }
- public void ClearTextBox()
- {
- lblFirst.Text = "";
- lblSecond.Text = "";
- lblAction.Content = "";
- lblResult.Text = "";
- }
- private void btn1_Click(object sender, RoutedEventArgs e)
- {
- if (lblAction.Content == "")
- {
- lblFirst.Text += Numbers.One();
- }
- else
- {
- lblSecond.Text += Numbers.One();
- }
- }
- private void btn2_Click(object sender, RoutedEventArgs e)
- {
- if (lblAction.Content == "")
- {
- lblFirst.Text += Numbers.Two();
- }
- else
- {
- lblSecond.Text += Numbers.Two();
- }
- }
- private void btn3_Click(object sender, RoutedEventArgs e)
- {
- if (lblAction.Content == "")
- {
- lblFirst.Text += Numbers.Three();
- }
- else
- {
- lblSecond.Text += Numbers.Three();
- }
- }
- private void btn4_Click(object sender, RoutedEventArgs e)
- {
- if (lblAction.Content == "")
- {
- lblFirst.Text += Numbers.Four();
- }
- else
- {
- lblSecond.Text += Numbers.Four();
- }
- }
- private void btn5_Click(object sender, RoutedEventArgs e)
- {
- if (lblAction.Content == "")
- {
- lblFirst.Text += Numbers.Five();
- }
- else
- {
- lblSecond.Text += Numbers.Five();
- }
- }
- private void btn6_Click(object sender, RoutedEventArgs e)
- {
- if (lblAction.Content == "")
- {
- lblFirst.Text += Numbers.Six();
- }
- else
- {
- lblSecond.Text += Numbers.Six();
- }
- }
- private void btn7_Click(object sender, RoutedEventArgs e)
- {
- if (lblAction.Content == "")
- {
- lblFirst.Text += Numbers.Seven();
- }
- else
- {
- lblSecond.Text += Numbers.Seven();
- }
- }
- private void btn8_Click(object sender, RoutedEventArgs e)
- {
- if (lblAction.Content == "")
- {
- lblFirst.Text += Numbers.Eight();
- }
- else
- {
- lblSecond.Text += Numbers.Eight();
- }
- }
- private void btn9_Click(object sender, RoutedEventArgs e)
- {
- if (lblAction.Content == "")
- {
- lblFirst.Text += Numbers.Nine();
- }
- else
- {
- lblSecond.Text += Numbers.Nine();
- }
- }
- private void btn0_Click(object sender, RoutedEventArgs e)
- {
-
- if (lblAction.Content == "")
- {
- lblFirst.Text += Numbers.Zero();
- }
- else
- {
- lblSecond.Text += Numbers.Zero();
- }
- }
- private void btnClear_Click(object sender, RoutedEventArgs e)
- {
- ClearTextBox();
- }
- private void btnPlus_Click(object sender, RoutedEventArgs e)
- {
- lblAction.Content = "+";
- }
- private void btnMinus_Click(object sender, RoutedEventArgs e)
- {
- lblAction.Content = "-";
- }
- private void btnMult_Click(object sender, RoutedEventArgs e)
- {
- lblAction.Content = "*";
- }
- }
- }
|