diff --git a/.idea/.idea.calculator/.idea/.gitignore b/.idea/.idea.calculator/.idea/.gitignore
new file mode 100644
index 0000000..ba2741c
--- /dev/null
+++ b/.idea/.idea.calculator/.idea/.gitignore
@@ -0,0 +1,13 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Rider ignored files
+/modules.xml
+/contentModel.xml
+/projectSettingsUpdater.xml
+/.idea.calculator.iml
+# Editor-based HTTP Client requests
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
diff --git a/.idea/.idea.calculator/.idea/.name b/.idea/.idea.calculator/.idea/.name
new file mode 100644
index 0000000..afa6020
--- /dev/null
+++ b/.idea/.idea.calculator/.idea/.name
@@ -0,0 +1 @@
+calculator
\ No newline at end of file
diff --git a/.idea/.idea.calculator/.idea/encodings.xml b/.idea/.idea.calculator/.idea/encodings.xml
new file mode 100644
index 0000000..df87cf9
--- /dev/null
+++ b/.idea/.idea.calculator/.idea/encodings.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/.idea/.idea.calculator/.idea/indexLayout.xml b/.idea/.idea.calculator/.idea/indexLayout.xml
new file mode 100644
index 0000000..7b08163
--- /dev/null
+++ b/.idea/.idea.calculator/.idea/indexLayout.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/8cc9f128-5008-40be-a6a7-0cf2658ed379.jfif b/8cc9f128-5008-40be-a6a7-0cf2658ed379.jfif
new file mode 100644
index 0000000..d6c0a45
Binary files /dev/null and b/8cc9f128-5008-40be-a6a7-0cf2658ed379.jfif differ
diff --git a/Controller/CaculatorController.cs b/Controller/CaculatorController.cs
new file mode 100644
index 0000000..8cd7ca1
--- /dev/null
+++ b/Controller/CaculatorController.cs
@@ -0,0 +1,134 @@
+using calculator.Model;
+using calculator.Services;
+using calculator.View;
+
+namespace calculator.Controller;
+
+public class CaculatorController
+{
+ private readonly ICaculator _caculator;
+ private readonly IInputService _inputService;
+ private readonly ICaculatorView _view;
+ private readonly CaculatorData _data;
+
+ public CaculatorController(ICaculator caculator, IInputService inputService, ICaculatorView view,
+ CaculatorData data)
+ {
+ _caculator = caculator;
+ _inputService = inputService;
+ _view = view;
+ _data = data;
+
+ _view.OperandPressed += OnOperandPressed;
+ _view.OperatorPressed += OnOperatorPressed;
+ _view.ClearPressed += OnFullClearPressed;
+ _view.CalculatePressed += OnCalculatePressed;
+ _view.SingleOperatorPressed += OnSingleOperationPressed;
+ OnFullClearPressed();
+ }
+
+ private void OnSingleOperationPressed(string obj)
+ {
+ _data.Operation = null;
+ if (_data.Operands.Count == 2 && _data.Caculated == false)
+ {
+ OnCalculatePressed();
+ }
+
+ _data.Caculated = true;
+ _data.SingleOperation = obj;
+ var operand = _data.Operands.Pop();
+ _data.Operands.Push(_caculator.SingleOperation(operand, obj));
+ _view.UpdateView(_data.Operands.Peek());
+ }
+
+ private void OnFullClearPressed()
+ {
+ Clear();
+ }
+
+ private void OnCalculatePressed()
+ {
+ if (_data.Operation is null)
+ return;
+
+ if (_data.SingleOperation is not null)
+ {
+ var singleOperand = _data.Operands.Pop();
+ _data.Operands.Push(_caculator.SingleOperation(singleOperand, _data.SingleOperation));
+ _view.UpdateView(_data.Operands.Peek());
+ return;
+ }
+
+ if (_data.Operands.Count < 2)
+ {
+ var (lastOperand, lastOperation) = (_data.LastOperand, _data.Operation);
+ if (lastOperand is not null && lastOperation is not null)
+ {
+ Calculate(_data.Operands.Pop(), lastOperand, lastOperation);
+ }
+ return;
+ }
+
+ var operand = _data.Operands.Pop();
+ var operand2 = _data.Operands.Pop();
+ Calculate(operand2, operand, _data.Operation);
+ }
+
+ private void Calculate(string operand1, string operand2, string operation)
+ {
+ _data.Caculated = true;
+ _data.LastOperand = operand2;
+ _data.Operands.Push(_caculator.Calculate(operand1, operand2, operation));
+ _view.UpdateView(_data.Operands.Peek());
+ }
+
+ private void Clear(string value = "0", bool full = true)
+ {
+ if (full)
+ {
+ _data.Operands.Clear();
+ _data.Operation = null;
+ _data.SingleOperation = null;
+ }
+ else
+ {
+ _data.Operands.TryPop(out _);
+ }
+
+ _data.Caculated = false;
+ _data.LastOperand = null;
+ _data.Operands.Push(value);
+ _view.UpdateView(_data.Operands.Peek());
+ }
+
+ private void OnOperatorPressed(string operation)
+ {
+ _data.SingleOperation = null;
+ if (_data.LastOperand is not null && _data.Caculated == false)
+ {
+ OnCalculatePressed();
+ }
+
+ _data.Operation = operation;
+ }
+
+ private void OnOperandPressed(char obj)
+ {
+
+ if (_data is { Operands.Count: 1, Operation: not null })
+ {
+ _data.Operands.Push("0");
+ }
+ else if (_data is { Caculated: true })
+ {
+ Clear();
+ }
+
+ var operand = _data.Operands.Pop();
+
+
+ _data.Operands.Push(_inputService.TryInput(operand + obj));
+ _view.UpdateView(_data.Operands.Peek());
+ }
+}
\ No newline at end of file
diff --git a/Form1.Designer.cs b/Form1.Designer.cs
new file mode 100644
index 0000000..f106db9
--- /dev/null
+++ b/Form1.Designer.cs
@@ -0,0 +1,948 @@
+namespace calculator
+{
+ partial class Form1
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ panel1=new Panel();
+ button49=new Button();
+ button50=new Button();
+ button51=new Button();
+ button52=new Button();
+ button53=new Button();
+ button44=new Button();
+ button45=new Button();
+ button46=new Button();
+ button47=new Button();
+ button48=new Button();
+ button39=new Button();
+ button40=new Button();
+ button41=new Button();
+ button42=new Button();
+ button43=new Button();
+ button34=new Button();
+ button35=new Button();
+ button36=new Button();
+ button37=new Button();
+ button38=new Button();
+ button23=new Button();
+ button30=new Button();
+ button31=new Button();
+ button32=new Button();
+ button33=new Button();
+ InverseButton=new Button();
+ MultButton=new Button();
+ SixButton=new Button();
+ FiveButton=new Button();
+ FourButton=new Button();
+ EqualButton=new Button();
+ PlusButton=new Button();
+ DotButton=new Button();
+ ZeroButton=new Button();
+ MinusButton=new Button();
+ ThreeButton=new Button();
+ TwoButton=new Button();
+ OneButton=new Button();
+ PercentButton=new Button();
+ DivideButton=new Button();
+ NineButton=new Button();
+ EightButton=new Button();
+ SevenButton=new Button();
+ SqrtButton=new Button();
+ NegativeButton=new Button();
+ button8=new Button();
+ CE_button=new Button();
+ button10=new Button();
+ button5=new Button();
+ button4=new Button();
+ button3=new Button();
+ button2=new Button();
+ button1=new Button();
+ groupBox1=new GroupBox();
+ radioButton3=new RadioButton();
+ radioButton2=new RadioButton();
+ radioButton1=new RadioButton();
+ textBox1=new TextBox();
+ linkLabel1=new LinkLabel();
+ linkLabel2=new LinkLabel();
+ linkLabel3=new LinkLabel();
+ panel1.SuspendLayout();
+ groupBox1.SuspendLayout();
+ SuspendLayout();
+ //
+ // panel1
+ //
+ panel1.BackColor=Color.MediumSlateBlue;
+ panel1.Controls.Add(button49);
+ panel1.Controls.Add(button50);
+ panel1.Controls.Add(button51);
+ panel1.Controls.Add(button52);
+ panel1.Controls.Add(button53);
+ panel1.Controls.Add(button44);
+ panel1.Controls.Add(button45);
+ panel1.Controls.Add(button46);
+ panel1.Controls.Add(button47);
+ panel1.Controls.Add(button48);
+ panel1.Controls.Add(button39);
+ panel1.Controls.Add(button40);
+ panel1.Controls.Add(button41);
+ panel1.Controls.Add(button42);
+ panel1.Controls.Add(button43);
+ panel1.Controls.Add(button34);
+ panel1.Controls.Add(button35);
+ panel1.Controls.Add(button36);
+ panel1.Controls.Add(button37);
+ panel1.Controls.Add(button38);
+ panel1.Controls.Add(button23);
+ panel1.Controls.Add(button30);
+ panel1.Controls.Add(button31);
+ panel1.Controls.Add(button32);
+ panel1.Controls.Add(button33);
+ panel1.Controls.Add(InverseButton);
+ panel1.Controls.Add(MultButton);
+ panel1.Controls.Add(SixButton);
+ panel1.Controls.Add(FiveButton);
+ panel1.Controls.Add(FourButton);
+ panel1.Controls.Add(EqualButton);
+ panel1.Controls.Add(PlusButton);
+ panel1.Controls.Add(DotButton);
+ panel1.Controls.Add(ZeroButton);
+ panel1.Controls.Add(MinusButton);
+ panel1.Controls.Add(ThreeButton);
+ panel1.Controls.Add(TwoButton);
+ panel1.Controls.Add(OneButton);
+ panel1.Controls.Add(PercentButton);
+ panel1.Controls.Add(DivideButton);
+ panel1.Controls.Add(NineButton);
+ panel1.Controls.Add(EightButton);
+ panel1.Controls.Add(SevenButton);
+ panel1.Controls.Add(SqrtButton);
+ panel1.Controls.Add(NegativeButton);
+ panel1.Controls.Add(button8);
+ panel1.Controls.Add(CE_button);
+ panel1.Controls.Add(button10);
+ panel1.Controls.Add(button5);
+ panel1.Controls.Add(button4);
+ panel1.Controls.Add(button3);
+ panel1.Controls.Add(button2);
+ panel1.Controls.Add(button1);
+ panel1.Controls.Add(groupBox1);
+ panel1.Controls.Add(textBox1);
+ panel1.Location=new Point(16, 28);
+ panel1.Name="panel1";
+ panel1.Size=new Size(573, 338);
+ panel1.TabIndex=0;
+ //
+ // button49
+ //
+ button49.FlatStyle=FlatStyle.Flat;
+ button49.Font=new Font("Segoe UI", 9.75F, FontStyle.Bold, GraphicsUnit.Point);
+ button49.Location=new Point(232, 296);
+ button49.Name="button49";
+ button49.Size=new Size(51, 37);
+ button49.TabIndex=55;
+ button49.Text="10ᵜ";
+ button49.UseVisualStyleBackColor=true;
+ //
+ // button50
+ //
+ button50.FlatStyle=FlatStyle.Flat;
+ button50.Font=new Font("Segoe UI", 9.75F, FontStyle.Bold, GraphicsUnit.Point);
+ button50.Location=new Point(175, 296);
+ button50.Name="button50";
+ button50.Size=new Size(51, 37);
+ button50.TabIndex=54;
+ button50.Text="log";
+ button50.UseVisualStyleBackColor=true;
+ //
+ // button51
+ //
+ button51.FlatStyle=FlatStyle.Flat;
+ button51.Font=new Font("Segoe UI", 9.75F, FontStyle.Bold, GraphicsUnit.Point);
+ button51.Location=new Point(118, 296);
+ button51.Name="button51";
+ button51.Size=new Size(51, 37);
+ button51.TabIndex=53;
+ button51.Text="Mod";
+ button51.UseVisualStyleBackColor=true;
+ //
+ // button52
+ //
+ button52.FlatStyle=FlatStyle.Flat;
+ button52.Font=new Font("Segoe UI", 9.75F, FontStyle.Bold, GraphicsUnit.Point);
+ button52.Location=new Point(61, 296);
+ button52.Name="button52";
+ button52.Size=new Size(51, 37);
+ button52.TabIndex=52;
+ button52.Text="Exp";
+ button52.UseVisualStyleBackColor=true;
+ //
+ // button53
+ //
+ button53.FlatStyle=FlatStyle.Flat;
+ button53.Font=new Font("Segoe UI", 9.75F, FontStyle.Bold, GraphicsUnit.Point);
+ button53.Location=new Point(4, 296);
+ button53.Name="button53";
+ button53.Size=new Size(51, 37);
+ button53.TabIndex=51;
+ button53.Text="F-E";
+ button53.UseVisualStyleBackColor=true;
+ //
+ // button44
+ //
+ button44.FlatStyle=FlatStyle.Flat;
+ button44.Font=new Font("Segoe UI", 9.75F, FontStyle.Bold, GraphicsUnit.Point);
+ button44.Location=new Point(232, 253);
+ button44.Name="button44";
+ button44.Size=new Size(51, 37);
+ button44.TabIndex=50;
+ button44.Text="∛x";
+ button44.UseVisualStyleBackColor=true;
+ //
+ // button45
+ //
+ button45.FlatStyle=FlatStyle.Flat;
+ button45.Font=new Font("Segoe UI", 9.75F, FontStyle.Bold, GraphicsUnit.Point);
+ button45.Location=new Point(175, 253);
+ button45.Name="button45";
+ button45.Size=new Size(51, 37);
+ button45.TabIndex=49;
+ button45.Text="x³";
+ button45.UseVisualStyleBackColor=true;
+ //
+ // button46
+ //
+ button46.FlatStyle=FlatStyle.Flat;
+ button46.Font=new Font("Segoe UI", 9.75F, FontStyle.Bold, GraphicsUnit.Point);
+ button46.Location=new Point(118, 253);
+ button46.Name="button46";
+ button46.Size=new Size(51, 37);
+ button46.TabIndex=48;
+ button46.Text="tan";
+ button46.UseVisualStyleBackColor=true;
+ //
+ // button47
+ //
+ button47.FlatStyle=FlatStyle.Flat;
+ button47.Font=new Font("Segoe UI", 9.75F, FontStyle.Bold, GraphicsUnit.Point);
+ button47.Location=new Point(61, 253);
+ button47.Name="button47";
+ button47.Size=new Size(51, 37);
+ button47.TabIndex=47;
+ button47.Text="tanh";
+ button47.UseVisualStyleBackColor=true;
+ //
+ // button48
+ //
+ button48.FlatStyle=FlatStyle.Flat;
+ button48.Font=new Font("Segoe UI", 9.75F, FontStyle.Bold, GraphicsUnit.Point);
+ button48.Location=new Point(4, 253);
+ button48.Name="button48";
+ button48.Size=new Size(51, 37);
+ button48.TabIndex=46;
+ button48.Text="π";
+ button48.UseVisualStyleBackColor=true;
+ //
+ // button39
+ //
+ button39.FlatStyle=FlatStyle.Flat;
+ button39.Font=new Font("Segoe UI", 9.75F, FontStyle.Bold, GraphicsUnit.Point);
+ button39.Location=new Point(232, 210);
+ button39.Name="button39";
+ button39.Size=new Size(51, 37);
+ button39.TabIndex=45;
+ button39.Text="y√x";
+ button39.UseVisualStyleBackColor=true;
+ button39.Click+=button39_Click;
+ //
+ // button40
+ //
+ button40.FlatStyle=FlatStyle.Flat;
+ button40.Font=new Font("Segoe UI", 9.75F, FontStyle.Bold, GraphicsUnit.Point);
+ button40.Location=new Point(175, 210);
+ button40.Name="button40";
+ button40.Size=new Size(51, 37);
+ button40.TabIndex=44;
+ button40.Text="xᵜ";
+ button40.UseVisualStyleBackColor=true;
+ //
+ // button41
+ //
+ button41.FlatStyle=FlatStyle.Flat;
+ button41.Font=new Font("Segoe UI", 9.75F, FontStyle.Bold, GraphicsUnit.Point);
+ button41.Location=new Point(118, 210);
+ button41.Name="button41";
+ button41.Size=new Size(51, 37);
+ button41.TabIndex=43;
+ button41.Text="cos";
+ button41.UseVisualStyleBackColor=true;
+ //
+ // button42
+ //
+ button42.FlatStyle=FlatStyle.Flat;
+ button42.Font=new Font("Segoe UI", 9.75F, FontStyle.Bold, GraphicsUnit.Point);
+ button42.Location=new Point(61, 210);
+ button42.Name="button42";
+ button42.Size=new Size(51, 37);
+ button42.TabIndex=42;
+ button42.Text="cosh";
+ button42.UseVisualStyleBackColor=true;
+ //
+ // button43
+ //
+ button43.FlatStyle=FlatStyle.Flat;
+ button43.Font=new Font("Segoe UI", 9.75F, FontStyle.Bold, GraphicsUnit.Point);
+ button43.Location=new Point(4, 210);
+ button43.Name="button43";
+ button43.Size=new Size(51, 37);
+ button43.TabIndex=41;
+ button43.Text="dms";
+ button43.UseVisualStyleBackColor=true;
+ //
+ // button34
+ //
+ button34.FlatStyle=FlatStyle.Flat;
+ button34.Font=new Font("Segoe UI", 9.75F, FontStyle.Bold, GraphicsUnit.Point);
+ button34.Location=new Point(232, 167);
+ button34.Name="button34";
+ button34.Size=new Size(51, 37);
+ button34.TabIndex=40;
+ button34.Text="n!";
+ button34.UseVisualStyleBackColor=true;
+ //
+ // button35
+ //
+ button35.FlatStyle=FlatStyle.Flat;
+ button35.Font=new Font("Segoe UI", 9.75F, FontStyle.Bold, GraphicsUnit.Point);
+ button35.Location=new Point(175, 167);
+ button35.Name="button35";
+ button35.Size=new Size(51, 37);
+ button35.TabIndex=39;
+ button35.Text="Х²";
+ button35.UseVisualStyleBackColor=true;
+ //
+ // button36
+ //
+ button36.FlatStyle=FlatStyle.Flat;
+ button36.Font=new Font("Segoe UI", 9.75F, FontStyle.Bold, GraphicsUnit.Point);
+ button36.Location=new Point(118, 167);
+ button36.Name="button36";
+ button36.Size=new Size(51, 37);
+ button36.TabIndex=38;
+ button36.Text="sin";
+ button36.UseVisualStyleBackColor=true;
+ //
+ // button37
+ //
+ button37.FlatStyle=FlatStyle.Flat;
+ button37.Font=new Font("Segoe UI", 9.75F, FontStyle.Bold, GraphicsUnit.Point);
+ button37.Location=new Point(61, 167);
+ button37.Name="button37";
+ button37.Size=new Size(51, 37);
+ button37.TabIndex=37;
+ button37.Text="sinh";
+ button37.UseVisualStyleBackColor=true;
+ //
+ // button38
+ //
+ button38.FlatStyle=FlatStyle.Flat;
+ button38.Font=new Font("Segoe UI", 9.75F, FontStyle.Bold, GraphicsUnit.Point);
+ button38.Location=new Point(4, 167);
+ button38.Name="button38";
+ button38.Size=new Size(51, 37);
+ button38.TabIndex=36;
+ button38.Text="Int";
+ button38.UseVisualStyleBackColor=true;
+ //
+ // button23
+ //
+ button23.FlatStyle=FlatStyle.Flat;
+ button23.Font=new Font("Segoe UI", 9.75F, FontStyle.Bold, GraphicsUnit.Point);
+ button23.Location=new Point(232, 124);
+ button23.Name="button23";
+ button23.Size=new Size(51, 37);
+ button23.TabIndex=35;
+ button23.Text=")";
+ button23.UseVisualStyleBackColor=true;
+ //
+ // button30
+ //
+ button30.FlatStyle=FlatStyle.Flat;
+ button30.Font=new Font("Segoe UI", 9.75F, FontStyle.Bold, GraphicsUnit.Point);
+ button30.Location=new Point(175, 124);
+ button30.Name="button30";
+ button30.Size=new Size(51, 37);
+ button30.TabIndex=34;
+ button30.Text="(";
+ button30.UseVisualStyleBackColor=true;
+ //
+ // button31
+ //
+ button31.FlatStyle=FlatStyle.Flat;
+ button31.Font=new Font("Segoe UI", 9.75F, FontStyle.Bold, GraphicsUnit.Point);
+ button31.Location=new Point(118, 124);
+ button31.Name="button31";
+ button31.Size=new Size(51, 37);
+ button31.TabIndex=33;
+ button31.Text="In";
+ button31.UseVisualStyleBackColor=true;
+ //
+ // button32
+ //
+ button32.FlatStyle=FlatStyle.Flat;
+ button32.Font=new Font("Segoe UI", 9.75F, FontStyle.Bold, GraphicsUnit.Point);
+ button32.Location=new Point(61, 124);
+ button32.Name="button32";
+ button32.Size=new Size(51, 37);
+ button32.TabIndex=32;
+ button32.Text="Inv";
+ button32.UseVisualStyleBackColor=true;
+ //
+ // button33
+ //
+ button33.BackColor=Color.SlateBlue;
+ button33.BackgroundImageLayout=ImageLayout.None;
+ button33.Cursor=Cursors.No;
+ button33.Enabled=false;
+ button33.Font=new Font("Segoe UI", 9.75F, FontStyle.Bold, GraphicsUnit.Point);
+ button33.Location=new Point(4, 124);
+ button33.Name="button33";
+ button33.Size=new Size(51, 37);
+ button33.TabIndex=31;
+ button33.UseVisualStyleBackColor=false;
+ //
+ // InverseButton
+ //
+ InverseButton.FlatStyle=FlatStyle.Flat;
+ InverseButton.Font=new Font("Segoe UI", 9.75F, FontStyle.Bold, GraphicsUnit.Point);
+ InverseButton.Location=new Point(517, 210);
+ InverseButton.Name="InverseButton";
+ InverseButton.Size=new Size(51, 37);
+ InverseButton.TabIndex=30;
+ InverseButton.Text="1/x";
+ InverseButton.UseVisualStyleBackColor=true;
+ InverseButton.Click+=OnInverseButtonClick;
+ //
+ // MultButton
+ //
+ MultButton.FlatStyle=FlatStyle.Flat;
+ MultButton.Font=new Font("Segoe UI", 9.75F, FontStyle.Bold, GraphicsUnit.Point);
+ MultButton.Location=new Point(460, 210);
+ MultButton.Name="MultButton";
+ MultButton.Size=new Size(51, 37);
+ MultButton.TabIndex=29;
+ MultButton.Text="*";
+ MultButton.UseVisualStyleBackColor=true;
+ MultButton.Click+=OnMultButtonClick;
+ //
+ // SixButton
+ //
+ SixButton.FlatStyle=FlatStyle.Flat;
+ SixButton.Font=new Font("Segoe UI", 9.75F, FontStyle.Bold, GraphicsUnit.Point);
+ SixButton.Location=new Point(403, 210);
+ SixButton.Name="SixButton";
+ SixButton.Size=new Size(51, 37);
+ SixButton.TabIndex=28;
+ SixButton.Text="6";
+ SixButton.UseVisualStyleBackColor=true;
+ SixButton.Click+=OnSixButtonClick;
+ //
+ // FiveButton
+ //
+ FiveButton.FlatStyle=FlatStyle.Flat;
+ FiveButton.Font=new Font("Segoe UI", 9.75F, FontStyle.Bold, GraphicsUnit.Point);
+ FiveButton.Location=new Point(346, 210);
+ FiveButton.Name="FiveButton";
+ FiveButton.Size=new Size(51, 37);
+ FiveButton.TabIndex=27;
+ FiveButton.Text="5";
+ FiveButton.UseVisualStyleBackColor=true;
+ FiveButton.Click+=OnFiveButtonClick;
+ //
+ // FourButton
+ //
+ FourButton.FlatStyle=FlatStyle.Flat;
+ FourButton.Font=new Font("Segoe UI", 9.75F, FontStyle.Bold, GraphicsUnit.Point);
+ FourButton.Location=new Point(289, 210);
+ FourButton.Name="FourButton";
+ FourButton.Size=new Size(51, 37);
+ FourButton.TabIndex=26;
+ FourButton.Text="4";
+ FourButton.UseVisualStyleBackColor=true;
+ FourButton.Click+=OnFourButtonClick;
+ //
+ // EqualButton
+ //
+ EqualButton.FlatStyle=FlatStyle.Flat;
+ EqualButton.Font=new Font("Segoe UI", 9.75F, FontStyle.Bold, GraphicsUnit.Point);
+ EqualButton.Location=new Point(517, 253);
+ EqualButton.Name="EqualButton";
+ EqualButton.Size=new Size(51, 80);
+ EqualButton.TabIndex=25;
+ EqualButton.Text="=";
+ EqualButton.UseVisualStyleBackColor=true;
+ EqualButton.Click+=OnEqualButtonClick;
+ //
+ // PlusButton
+ //
+ PlusButton.FlatStyle=FlatStyle.Flat;
+ PlusButton.Font=new Font("Segoe UI", 9.75F, FontStyle.Bold, GraphicsUnit.Point);
+ PlusButton.Location=new Point(460, 296);
+ PlusButton.Name="PlusButton";
+ PlusButton.Size=new Size(51, 37);
+ PlusButton.TabIndex=24;
+ PlusButton.Text="+";
+ PlusButton.UseVisualStyleBackColor=true;
+ PlusButton.Click+=OnPlusButtonClick;
+ //
+ // DotButton
+ //
+ DotButton.FlatStyle=FlatStyle.Flat;
+ DotButton.Font=new Font("Segoe UI", 9.75F, FontStyle.Bold, GraphicsUnit.Point);
+ DotButton.Location=new Point(403, 296);
+ DotButton.Name="DotButton";
+ DotButton.Size=new Size(51, 37);
+ DotButton.TabIndex=23;
+ DotButton.Text=",";
+ DotButton.UseVisualStyleBackColor=true;
+ DotButton.Click+=OnDotButtonClick;
+ //
+ // ZeroButton
+ //
+ ZeroButton.FlatStyle=FlatStyle.Flat;
+ ZeroButton.Font=new Font("Segoe UI", 9.75F, FontStyle.Bold, GraphicsUnit.Point);
+ ZeroButton.Location=new Point(289, 296);
+ ZeroButton.Name="ZeroButton";
+ ZeroButton.Size=new Size(108, 37);
+ ZeroButton.TabIndex=22;
+ ZeroButton.Text="0";
+ ZeroButton.UseVisualStyleBackColor=true;
+ ZeroButton.Click+=OnZeroButtonClick;
+ //
+ // MinusButton
+ //
+ MinusButton.FlatStyle=FlatStyle.Flat;
+ MinusButton.Font=new Font("Segoe UI", 9.75F, FontStyle.Bold, GraphicsUnit.Point);
+ MinusButton.Location=new Point(460, 253);
+ MinusButton.Name="MinusButton";
+ MinusButton.Size=new Size(51, 37);
+ MinusButton.TabIndex=20;
+ MinusButton.Text="-";
+ MinusButton.UseVisualStyleBackColor=true;
+ MinusButton.Click+=OnMinusButtonClick;
+ //
+ // ThreeButton
+ //
+ ThreeButton.FlatStyle=FlatStyle.Flat;
+ ThreeButton.Font=new Font("Segoe UI", 9.75F, FontStyle.Bold, GraphicsUnit.Point);
+ ThreeButton.Location=new Point(403, 253);
+ ThreeButton.Name="ThreeButton";
+ ThreeButton.Size=new Size(51, 37);
+ ThreeButton.TabIndex=19;
+ ThreeButton.Text="3";
+ ThreeButton.UseVisualStyleBackColor=true;
+ ThreeButton.Click+=OnThreeButtonClick;
+ //
+ // TwoButton
+ //
+ TwoButton.FlatStyle=FlatStyle.Flat;
+ TwoButton.Font=new Font("Segoe UI", 9.75F, FontStyle.Bold, GraphicsUnit.Point);
+ TwoButton.Location=new Point(346, 253);
+ TwoButton.Name="TwoButton";
+ TwoButton.Size=new Size(51, 37);
+ TwoButton.TabIndex=18;
+ TwoButton.Text="2";
+ TwoButton.UseVisualStyleBackColor=true;
+ TwoButton.Click+=OnTwoButtonClick;
+ //
+ // OneButton
+ //
+ OneButton.FlatStyle=FlatStyle.Flat;
+ OneButton.Font=new Font("Segoe UI", 9.75F, FontStyle.Bold, GraphicsUnit.Point);
+ OneButton.Location=new Point(289, 253);
+ OneButton.Name="OneButton";
+ OneButton.Size=new Size(51, 37);
+ OneButton.TabIndex=17;
+ OneButton.Text="1";
+ OneButton.UseVisualStyleBackColor=true;
+ OneButton.Click+=OnOneButtonClick;
+ //
+ // PercentButton
+ //
+ PercentButton.FlatStyle=FlatStyle.Flat;
+ PercentButton.Font=new Font("Segoe UI", 9.75F, FontStyle.Bold, GraphicsUnit.Point);
+ PercentButton.Location=new Point(517, 167);
+ PercentButton.Name="PercentButton";
+ PercentButton.Size=new Size(51, 37);
+ PercentButton.TabIndex=16;
+ PercentButton.Text="%";
+ PercentButton.UseVisualStyleBackColor=true;
+ PercentButton.Click+=OnPercentButtonClick;
+ //
+ // DivideButton
+ //
+ DivideButton.FlatStyle=FlatStyle.Flat;
+ DivideButton.Font=new Font("Segoe UI", 9.75F, FontStyle.Bold, GraphicsUnit.Point);
+ DivideButton.Location=new Point(460, 167);
+ DivideButton.Name="DivideButton";
+ DivideButton.Size=new Size(51, 37);
+ DivideButton.TabIndex=15;
+ DivideButton.Text="/";
+ DivideButton.UseVisualStyleBackColor=true;
+ DivideButton.Click+=OnDivideButtonClick;
+ //
+ // NineButton
+ //
+ NineButton.FlatStyle=FlatStyle.Flat;
+ NineButton.Font=new Font("Segoe UI", 9.75F, FontStyle.Bold, GraphicsUnit.Point);
+ NineButton.Location=new Point(403, 167);
+ NineButton.Name="NineButton";
+ NineButton.Size=new Size(51, 37);
+ NineButton.TabIndex=14;
+ NineButton.Text="9";
+ NineButton.UseVisualStyleBackColor=true;
+ NineButton.Click+=OnNineButtonClick;
+ //
+ // EightButton
+ //
+ EightButton.FlatStyle=FlatStyle.Flat;
+ EightButton.Font=new Font("Segoe UI", 9.75F, FontStyle.Bold, GraphicsUnit.Point);
+ EightButton.Location=new Point(346, 167);
+ EightButton.Name="EightButton";
+ EightButton.Size=new Size(51, 37);
+ EightButton.TabIndex=13;
+ EightButton.Text="8";
+ EightButton.UseVisualStyleBackColor=true;
+ EightButton.Click+=OnEightButtonClick;
+ //
+ // SevenButton
+ //
+ SevenButton.FlatStyle=FlatStyle.Flat;
+ SevenButton.Font=new Font("Segoe UI", 9.75F, FontStyle.Bold, GraphicsUnit.Point);
+ SevenButton.Location=new Point(289, 167);
+ SevenButton.Name="SevenButton";
+ SevenButton.Size=new Size(51, 37);
+ SevenButton.TabIndex=12;
+ SevenButton.Text="7";
+ SevenButton.UseVisualStyleBackColor=true;
+ SevenButton.Click+=OnSevenButtonClick;
+ //
+ // SqrtButton
+ //
+ SqrtButton.FlatStyle=FlatStyle.Flat;
+ SqrtButton.Font=new Font("Segoe UI", 9.75F, FontStyle.Bold, GraphicsUnit.Point);
+ SqrtButton.Location=new Point(517, 124);
+ SqrtButton.Name="SqrtButton";
+ SqrtButton.Size=new Size(51, 37);
+ SqrtButton.TabIndex=11;
+ SqrtButton.Text="√";
+ SqrtButton.UseVisualStyleBackColor=true;
+ SqrtButton.Click+=OnSqrtButtonClick;
+ //
+ // NegativeButton
+ //
+ NegativeButton.FlatStyle=FlatStyle.Flat;
+ NegativeButton.Font=new Font("Segoe UI", 9.75F, FontStyle.Bold, GraphicsUnit.Point);
+ NegativeButton.Location=new Point(460, 124);
+ NegativeButton.Name="NegativeButton";
+ NegativeButton.Size=new Size(51, 37);
+ NegativeButton.TabIndex=10;
+ NegativeButton.Text="±";
+ NegativeButton.UseVisualStyleBackColor=true;
+ NegativeButton.Click+=OnNegativeButtonClick;
+ //
+ // button8
+ //
+ button8.FlatStyle=FlatStyle.Flat;
+ button8.Font=new Font("Segoe UI", 9.75F, FontStyle.Bold, GraphicsUnit.Point);
+ button8.Location=new Point(403, 124);
+ button8.Name="button8";
+ button8.Size=new Size(51, 37);
+ button8.TabIndex=9;
+ button8.Text="C";
+ button8.UseVisualStyleBackColor=true;
+ //
+ // CE_button
+ //
+ CE_button.FlatStyle=FlatStyle.Flat;
+ CE_button.Font=new Font("Segoe UI", 9.75F, FontStyle.Bold, GraphicsUnit.Point);
+ CE_button.Location=new Point(346, 124);
+ CE_button.Name="CE_button";
+ CE_button.Size=new Size(51, 37);
+ CE_button.TabIndex=8;
+ CE_button.Text="CE";
+ CE_button.UseVisualStyleBackColor=true;
+ CE_button.Click+=OnCEButtonClick;
+ //
+ // button10
+ //
+ button10.FlatStyle=FlatStyle.Flat;
+ button10.Font=new Font("Segoe UI", 9.75F, FontStyle.Bold, GraphicsUnit.Point);
+ button10.Location=new Point(289, 124);
+ button10.Name="button10";
+ button10.Size=new Size(51, 37);
+ button10.TabIndex=7;
+ button10.Text="←";
+ button10.UseVisualStyleBackColor=true;
+ //
+ // button5
+ //
+ button5.FlatStyle=FlatStyle.Flat;
+ button5.Font=new Font("Segoe UI", 9.75F, FontStyle.Bold, GraphicsUnit.Point);
+ button5.Location=new Point(517, 81);
+ button5.Name="button5";
+ button5.Size=new Size(51, 37);
+ button5.TabIndex=6;
+ button5.Text="M-";
+ button5.UseVisualStyleBackColor=true;
+ //
+ // button4
+ //
+ button4.FlatStyle=FlatStyle.Flat;
+ button4.Font=new Font("Segoe UI", 9.75F, FontStyle.Bold, GraphicsUnit.Point);
+ button4.Location=new Point(460, 81);
+ button4.Name="button4";
+ button4.Size=new Size(51, 37);
+ button4.TabIndex=5;
+ button4.Text="M+";
+ button4.UseVisualStyleBackColor=true;
+ //
+ // button3
+ //
+ button3.FlatStyle=FlatStyle.Flat;
+ button3.Font=new Font("Segoe UI", 9.75F, FontStyle.Bold, GraphicsUnit.Point);
+ button3.Location=new Point(403, 81);
+ button3.Name="button3";
+ button3.Size=new Size(51, 37);
+ button3.TabIndex=4;
+ button3.Text="MS";
+ button3.UseVisualStyleBackColor=true;
+ //
+ // button2
+ //
+ button2.FlatStyle=FlatStyle.Flat;
+ button2.Font=new Font("Segoe UI", 9.75F, FontStyle.Bold, GraphicsUnit.Point);
+ button2.Location=new Point(346, 81);
+ button2.Name="button2";
+ button2.Size=new Size(51, 37);
+ button2.TabIndex=3;
+ button2.Text="MR";
+ button2.UseVisualStyleBackColor=true;
+ //
+ // button1
+ //
+ button1.FlatStyle=FlatStyle.Flat;
+ button1.Font=new Font("Segoe UI", 9.75F, FontStyle.Bold, GraphicsUnit.Point);
+ button1.Location=new Point(289, 81);
+ button1.Name="button1";
+ button1.Size=new Size(51, 37);
+ button1.TabIndex=2;
+ button1.Text="MC";
+ button1.UseVisualStyleBackColor=true;
+ //
+ // groupBox1
+ //
+ groupBox1.Controls.Add(radioButton3);
+ groupBox1.Controls.Add(radioButton2);
+ groupBox1.Controls.Add(radioButton1);
+ groupBox1.Location=new Point(4, 75);
+ groupBox1.Name="groupBox1";
+ groupBox1.Size=new Size(279, 43);
+ groupBox1.TabIndex=1;
+ groupBox1.TabStop=false;
+ //
+ // radioButton3
+ //
+ radioButton3.AutoSize=true;
+ radioButton3.Font=new Font("Roboto", 11.25F, FontStyle.Bold|FontStyle.Italic, GraphicsUnit.Point);
+ radioButton3.ForeColor=Color.FromArgb(255, 192, 255);
+ radioButton3.Location=new Point(197, 13);
+ radioButton3.Name="radioButton3";
+ radioButton3.Size=new Size(74, 22);
+ radioButton3.TabIndex=2;
+ radioButton3.TabStop=true;
+ radioButton3.Text="Грады";
+ radioButton3.UseVisualStyleBackColor=true;
+ //
+ // radioButton2
+ //
+ radioButton2.AutoSize=true;
+ radioButton2.Font=new Font("Roboto", 11.25F, FontStyle.Bold|FontStyle.Italic, GraphicsUnit.Point);
+ radioButton2.ForeColor=Color.FromArgb(255, 192, 255);
+ radioButton2.Location=new Point(98, 13);
+ radioButton2.Name="radioButton2";
+ radioButton2.Size=new Size(97, 22);
+ radioButton2.TabIndex=1;
+ radioButton2.TabStop=true;
+ radioButton2.Text="Радианы";
+ radioButton2.UseVisualStyleBackColor=true;
+ //
+ // radioButton1
+ //
+ radioButton1.AutoSize=true;
+ radioButton1.Font=new Font("Roboto", 11.25F, FontStyle.Bold|FontStyle.Italic, GraphicsUnit.Point);
+ radioButton1.ForeColor=Color.FromArgb(255, 192, 255);
+ radioButton1.Location=new Point(6, 13);
+ radioButton1.Name="radioButton1";
+ radioButton1.Size=new Size(91, 22);
+ radioButton1.TabIndex=0;
+ radioButton1.TabStop=true;
+ radioButton1.Text="Градусы";
+ radioButton1.UseVisualStyleBackColor=true;
+ //
+ // textBox1
+ //
+ textBox1.BackColor=Color.FromArgb(192, 192, 255);
+ textBox1.Cursor=Cursors.No;
+ textBox1.Enabled=false;
+ textBox1.Font=new Font("Myanmar Text", 27.75F, FontStyle.Bold, GraphicsUnit.Point);
+ textBox1.ForeColor=Color.FromArgb(255, 192, 255);
+ textBox1.Location=new Point(3, 3);
+ textBox1.Multiline=true;
+ textBox1.Name="textBox1";
+ textBox1.Size=new Size(567, 72);
+ textBox1.TabIndex=0;
+ //
+ // linkLabel1
+ //
+ linkLabel1.AutoSize=true;
+ linkLabel1.LinkColor=Color.FromArgb(255, 192, 255);
+ linkLabel1.Location=new Point(16, 6);
+ linkLabel1.Name="linkLabel1";
+ linkLabel1.Size=new Size(27, 15);
+ linkLabel1.TabIndex=1;
+ linkLabel1.TabStop=true;
+ linkLabel1.Text="Вид";
+ //
+ // linkLabel2
+ //
+ linkLabel2.AutoSize=true;
+ linkLabel2.LinkColor=Color.FromArgb(255, 192, 255);
+ linkLabel2.Location=new Point(49, 6);
+ linkLabel2.Name="linkLabel2";
+ linkLabel2.Size=new Size(47, 15);
+ linkLabel2.TabIndex=2;
+ linkLabel2.TabStop=true;
+ linkLabel2.Text="Правка";
+ //
+ // linkLabel3
+ //
+ linkLabel3.AutoSize=true;
+ linkLabel3.LinkColor=Color.FromArgb(255, 192, 255);
+ linkLabel3.Location=new Point(102, 6);
+ linkLabel3.Name="linkLabel3";
+ linkLabel3.Size=new Size(53, 15);
+ linkLabel3.TabIndex=3;
+ linkLabel3.TabStop=true;
+ linkLabel3.Text="Справка";
+ //
+ // Form1
+ //
+ AutoScaleDimensions=new SizeF(7F, 15F);
+ AutoScaleMode=AutoScaleMode.Font;
+ BackColor=Color.Indigo;
+ ClientSize=new Size(607, 378);
+ Controls.Add(linkLabel3);
+ Controls.Add(linkLabel2);
+ Controls.Add(linkLabel1);
+ Controls.Add(panel1);
+ Name="Form1";
+ Text="Form1";
+ panel1.ResumeLayout(false);
+ panel1.PerformLayout();
+ groupBox1.ResumeLayout(false);
+ groupBox1.PerformLayout();
+ ResumeLayout(false);
+ PerformLayout();
+ }
+
+ #endregion
+
+ private Panel panel1;
+ private Button button5;
+ private Button button4;
+ private Button button3;
+ private Button button2;
+ private Button button1;
+ private GroupBox groupBox1;
+ private RadioButton radioButton3;
+ private RadioButton radioButton2;
+ private RadioButton radioButton1;
+ private TextBox textBox1;
+ private LinkLabel linkLabel1;
+ private LinkLabel linkLabel2;
+ private LinkLabel linkLabel3;
+ private Button button49;
+ private Button button50;
+ private Button button51;
+ private Button button52;
+ private Button button53;
+ private Button button44;
+ private Button button45;
+ private Button button46;
+ private Button button47;
+ private Button button48;
+ private Button button39;
+ private Button button40;
+ private Button button41;
+ private Button button42;
+ private Button button43;
+ private Button button34;
+ private Button button35;
+ private Button button36;
+ private Button button37;
+ private Button button38;
+ private Button button23;
+ private Button button30;
+ private Button button31;
+ private Button button32;
+ private Button button33;
+ private Button InverseButton;
+ private Button MultButton;
+ private Button SixButton;
+ private Button FiveButton;
+ private Button FourButton;
+ private Button EqualButton;
+ private Button PlusButton;
+ private Button DotButton;
+ private Button ZeroButton;
+ private Button MinusButton;
+ private Button ThreeButton;
+ private Button TwoButton;
+ private Button OneButton;
+ private Button PercentButton;
+ private Button DivideButton;
+ private Button NineButton;
+ private Button EightButton;
+ private Button SevenButton;
+ private Button SqrtButton;
+ private Button NegativeButton;
+ private Button button8;
+ private Button CE_button;
+ private Button button10;
+ }
+}
\ No newline at end of file
diff --git a/Form1.cs b/Form1.cs
new file mode 100644
index 0000000..33a3211
--- /dev/null
+++ b/Form1.cs
@@ -0,0 +1,133 @@
+using calculator.View;
+
+namespace calculator
+{
+ public partial class Form1 : Form, ICaculatorView
+ {
+ public Form1()
+ {
+ InitializeComponent();
+ }
+
+ public event Action? OperandPressed;
+ public event Action? OperatorPressed;
+ public event Action? SingleOperatorPressed;
+ public event Action? ClearPressed;
+ public event Action? CalculatePressed;
+
+ public void UpdateView(string input)
+ {
+ textBox1.Text = input;
+ }
+
+ private void OnCEButtonClick(object sender, EventArgs e)
+ {
+ ClearPressed?.Invoke();
+ }
+
+ private void OnZeroButtonClick(object sender, EventArgs e)
+ {
+ OperandPressed?.Invoke('0');
+ }
+
+ private void OnOneButtonClick(object sender, EventArgs e)
+ {
+ OperandPressed?.Invoke('1');
+ }
+
+ private void OnTwoButtonClick(object sender, EventArgs e)
+ {
+ OperandPressed?.Invoke('2');
+ }
+
+ private void OnThreeButtonClick(object sender, EventArgs e)
+ {
+ OperandPressed?.Invoke('3');
+ }
+
+ private void OnFourButtonClick(object sender, EventArgs e)
+ {
+ OperandPressed?.Invoke('4');
+ }
+
+ private void OnFiveButtonClick(object sender, EventArgs e)
+ {
+ OperandPressed?.Invoke('5');
+ }
+
+ private void OnSixButtonClick(object sender, EventArgs e)
+ {
+ OperandPressed?.Invoke('6');
+ }
+
+ private void OnSevenButtonClick(object sender, EventArgs e)
+ {
+ OperandPressed?.Invoke('7');
+ }
+
+ private void OnEightButtonClick(object sender, EventArgs e)
+ {
+ OperandPressed?.Invoke('8');
+ }
+
+ private void OnNineButtonClick(object sender, EventArgs e)
+ {
+ OperandPressed?.Invoke('9');
+ }
+
+ private void OnDotButtonClick(object sender, EventArgs e)
+ {
+ OperandPressed?.Invoke('.');
+ }
+
+ private void OnNegativeButtonClick(object sender, EventArgs e)
+ {
+ SingleOperatorPressed?.Invoke("-1");
+ }
+
+ private void OnPlusButtonClick(object sender, EventArgs e)
+ {
+ OperatorPressed?.Invoke("+");
+ }
+
+ private void OnMinusButtonClick(object sender, EventArgs e)
+ {
+ OperatorPressed?.Invoke("-");
+ }
+
+ private void OnMultButtonClick(object sender, EventArgs e)
+ {
+ OperatorPressed?.Invoke("*");
+ }
+
+ private void OnDivideButtonClick(object sender, EventArgs e)
+ {
+ OperatorPressed?.Invoke("/");
+ }
+
+ private void OnSqrtButtonClick(object sender, EventArgs e)
+ {
+ SingleOperatorPressed?.Invoke("√");
+ }
+
+ private void OnPercentButtonClick(object sender, EventArgs e)
+ {
+ SingleOperatorPressed?.Invoke("%");
+ }
+
+ private void OnInverseButtonClick(object sender, EventArgs e)
+ {
+ SingleOperatorPressed?.Invoke("1/");
+ }
+
+ private void OnEqualButtonClick(object sender, EventArgs e)
+ {
+ CalculatePressed?.Invoke();
+ }
+
+ private void button39_Click(object sender, EventArgs e)
+ {
+
+ }
+ }
+}
\ No newline at end of file
diff --git a/Form1.resx b/Form1.resx
new file mode 100644
index 0000000..2a5f517
--- /dev/null
+++ b/Form1.resx
@@ -0,0 +1,306 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
\ No newline at end of file
diff --git a/GlobalUsings.cs b/GlobalUsings.cs
new file mode 100644
index 0000000..933204c
--- /dev/null
+++ b/GlobalUsings.cs
@@ -0,0 +1,3 @@
+// Global using directives
+
+global using System.Collections.Generic;
\ No newline at end of file
diff --git a/Model/CaculatorData.cs b/Model/CaculatorData.cs
new file mode 100644
index 0000000..4f6480a
--- /dev/null
+++ b/Model/CaculatorData.cs
@@ -0,0 +1,10 @@
+namespace calculator.Model;
+
+public class CaculatorData
+{
+ public Stack Operands { get; set; } = new();
+ public string? Operation { get; set; }
+ public string? SingleOperation { get; set; }
+ public bool Caculated { get; set; }
+ public string? LastOperand { get; set; }
+}
\ No newline at end of file
diff --git a/Program.cs b/Program.cs
new file mode 100644
index 0000000..a1e82ce
--- /dev/null
+++ b/Program.cs
@@ -0,0 +1,26 @@
+using calculator.Controller;
+using calculator.Model;
+using calculator.Services;
+
+namespace calculator
+{
+ internal static class Program
+ {
+ ///
+ /// The main entry point for the application.
+ ///
+ [STAThread]
+ static void Main()
+ {
+ // To customize application configuration such as set high DPI settings or default font,
+ // see https://aka.ms/applicationconfiguration.
+ var inputService = new InputService();
+ var caculator = new Caculyator();
+ ApplicationConfiguration.Initialize();
+ var data = new CaculatorData();
+ var view = new Form1();
+ var controller = new CaculatorController(caculator, inputService, view, data);
+ Application.Run(view);
+ }
+ }
+}
\ No newline at end of file
diff --git a/Properties/Resources.Designer.cs b/Properties/Resources.Designer.cs
new file mode 100644
index 0000000..23bb63b
--- /dev/null
+++ b/Properties/Resources.Designer.cs
@@ -0,0 +1,63 @@
+//------------------------------------------------------------------------------
+//
+// Этот код создан программой.
+// Исполняемая версия:4.0.30319.42000
+//
+// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
+// повторной генерации кода.
+//
+//------------------------------------------------------------------------------
+
+namespace calculator.Properties {
+ using System;
+
+
+ ///
+ /// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д.
+ ///
+ // Этот класс создан автоматически классом StronglyTypedResourceBuilder
+ // с помощью такого средства, как ResGen или Visual Studio.
+ // Чтобы добавить или удалить член, измените файл .ResX и снова запустите ResGen
+ // с параметром /str или перестройте свой проект VS.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources() {
+ }
+
+ ///
+ /// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("calculator.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ ///
+ /// Перезаписывает свойство CurrentUICulture текущего потока для всех
+ /// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+ }
+}
diff --git a/Properties/Resources.resx b/Properties/Resources.resx
new file mode 100644
index 0000000..1af7de1
--- /dev/null
+++ b/Properties/Resources.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/Services/Caculyator.cs b/Services/Caculyator.cs
new file mode 100644
index 0000000..499eda5
--- /dev/null
+++ b/Services/Caculyator.cs
@@ -0,0 +1,60 @@
+using System.Globalization;
+
+namespace calculator.Services
+{
+ internal class Caculyator : ICaculator
+ {
+ public string Calculate(string n, string m, string operation)
+ {
+ if (double.TryParse(n, out var numberone) == false)
+ return string.Empty;
+ if (double.TryParse(m, out var numbertwo) == false)
+ return string.Empty;
+
+ return ApplyOperator(operation, numberone, numbertwo).ToString("0.#####");
+ }
+
+ public string SingleOperation(string operand, string operation)
+ {
+ if (double.TryParse(operand, out var numberone) == false)
+ return string.Empty;
+ return ApplyOperator(operation, numberone).ToString("0.#####");
+ }
+
+ private static double ApplyOperator(string token, double operand1, double operand2)
+ {
+ switch (token)
+ {
+ case "+":
+ return operand1 + operand2;
+ case "-":
+ return operand1 - operand2;
+ case "*":
+ return operand1 * operand2;
+ case "/":
+ return operand1 / operand2;
+ case "^":
+ return Math.Pow(operand1, operand2);
+ default:
+ throw new ArgumentException($"Invalid operator: {token}");
+ }
+ }
+
+ private static double ApplyOperator(string token, double operand1)
+ {
+ switch (token)
+ {
+ case "1/":
+ return 1 / operand1;
+ case "√":
+ return Math.Sqrt(operand1);
+ case "%":
+ return operand1 / 100;
+ case "-1":
+ return operand1 * -1;
+ default:
+ throw new ArgumentException($"Invalid operator: {token}");
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/Services/ICaculator.cs b/Services/ICaculator.cs
new file mode 100644
index 0000000..8353f64
--- /dev/null
+++ b/Services/ICaculator.cs
@@ -0,0 +1,7 @@
+namespace calculator.Services;
+
+public interface ICaculator
+{
+ string Calculate(string op1, string op2, string operation);
+ string SingleOperation(string operand, string operation);
+}
\ No newline at end of file
diff --git a/Services/IInputService.cs b/Services/IInputService.cs
new file mode 100644
index 0000000..72fefb8
--- /dev/null
+++ b/Services/IInputService.cs
@@ -0,0 +1,7 @@
+namespace calculator.Services
+{
+ public interface IInputService
+ {
+ public string TryInput(string input);
+ }
+}
diff --git a/Services/InputService.cs b/Services/InputService.cs
new file mode 100644
index 0000000..0d7dbf4
--- /dev/null
+++ b/Services/InputService.cs
@@ -0,0 +1,23 @@
+namespace calculator.Services
+{
+ internal class InputService : IInputService
+ {
+ public string TryInput(string input)
+ {
+ //если есть знак "бесконечность" - не даёт писать цифры после него
+ if (input.Contains('∞'))
+ {
+ input = input[..^1];
+ }
+
+ //ситуация: слева ноль, а после него НЕ запятая, тогда ноль можно удалить
+ if (input[0] == '0' && (input.IndexOf(".", StringComparison.Ordinal) != 1))
+ {
+ input = input.Remove(0, 1);
+ }
+
+ return input;
+ }
+
+ }
+}
diff --git a/View/ICaculatorView.cs b/View/ICaculatorView.cs
new file mode 100644
index 0000000..44cc442
--- /dev/null
+++ b/View/ICaculatorView.cs
@@ -0,0 +1,11 @@
+namespace calculator.View;
+
+public interface ICaculatorView
+{
+ public event Action OperandPressed;
+ public event Action OperatorPressed;
+ public event Action SingleOperatorPressed;
+ public event Action ClearPressed;
+ public event Action CalculatePressed;
+ public void UpdateView(string input);
+}
\ No newline at end of file
diff --git a/calculator.csproj b/calculator.csproj
new file mode 100644
index 0000000..13ee123
--- /dev/null
+++ b/calculator.csproj
@@ -0,0 +1,26 @@
+
+
+
+ WinExe
+ net6.0-windows
+ enable
+ true
+ enable
+
+
+
+
+ True
+ True
+ Resources.resx
+
+
+
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+
+
+
+
\ No newline at end of file
diff --git a/calculator.sln b/calculator.sln
new file mode 100644
index 0000000..2215a32
--- /dev/null
+++ b/calculator.sln
@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.5.33516.290
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "calculator", "calculator.csproj", "{FC5416F2-1AED-4C75-A82D-60774657A984}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {FC5416F2-1AED-4C75-A82D-60774657A984}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {FC5416F2-1AED-4C75-A82D-60774657A984}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {FC5416F2-1AED-4C75-A82D-60774657A984}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {FC5416F2-1AED-4C75-A82D-60774657A984}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {4631776A-E30A-4C14-947E-859DF03FE2B7}
+ EndGlobalSection
+EndGlobal