/
n1kolas
/
AdamusCleanCode
Обзор
Документация
Войти
/
n1kolas
/
AdamusCleanCode
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
codeCleanup
WpfApp2/WindowCalc.xaml.cs
80 строк
2 KB
Adam
'aksdfj'
14 окт 2025, 00:03
14 окт 2025, 00:03
cfc7608
Код
Авторство
О чём код?
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.Shapes; using System.Data; using System.ComponentModel; namespace WpfApp2 { public partial class WindowCalc : Window { public WindowCalc() { InitializeComponent(); } private void Button_Click(object sender, RoutedEventArgs e) { Button btn = (Button)sender; string value = btn.Content.ToString(); Console.WriteLine(Display.Text); if (Display.Text == "0") Display.Text = value; else Display.Text += value; } private void ClearBtn_Click(object sender, RoutedEventArgs e) { Display.Text = ""; } private void DeleteBtn_Click(object sender, RoutedEventArgs e) { if (Display.Text == "Ошибка" || Display.Text.Contains("Ошибка")) { Display.Text = ""; } if (Display.Text.Length != 0) { Display.Text = Display.Text.Substring(0, Display.Text.Length - 1); } } private void EqualBtn_Click(object sender, RoutedEventArgs e) { try { var result = new DataTable().Compute(Display.Text, ""); Display.Text = result.ToString(); } catch { Display.Text = "Ошибка"; } } private void WindowCalc_Closed(object sender, CancelEventArgs e) { MessageBox.Show("Окно закрыто!"); } } }