From d3836d6cfc2b35c3bbaabb08f93deeb08a6106f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D1=80=D0=B8=D1=8F?= Date: Thu, 4 Apr 2024 22:49:32 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D1=8B=20=D0=BE=D0=BF=D0=B5=D1=80=D0=B0=D1=86=D0=B8:=20Sq?= =?UTF-8?q?rtY,=20Factorial,=20CubeRoot,=20Square,=20Cube,=20PowY,=20Log,?= =?UTF-8?q?=20Ln,=20Exp,=20Inv,=20Pi,=20Sinh,=20Sin,=20Cosh,=20Cos,=20Tanh?= =?UTF-8?q?,=20Tan?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 56 +- .idea/.idea.calculator/.idea/vcs.xml | 6 + Commands/CalculateCommand.cs | 38 + Commands/ICommand.cs | 7 + Common/Operation.cs | 32 + Controller/CaculatorController.cs | 110 +-- Form1.Designer.cs | 1318 +++++++++++++------------- Form1.cs | 121 ++- Form1.resx | 49 +- Model/CaculatorData.cs | 11 +- Services/Caculyator.cs | 103 +- Services/ICaculator.cs | 7 +- View/ICaculatorView.cs | 10 +- calculator.csproj | 2 +- 14 files changed, 1072 insertions(+), 798 deletions(-) create mode 100644 .idea/.idea.calculator/.idea/vcs.xml create mode 100644 Commands/CalculateCommand.cs create mode 100644 Commands/ICommand.cs create mode 100644 Common/Operation.cs diff --git a/.gitignore b/.gitignore index 9491a2f..8d26131 100644 --- a/.gitignore +++ b/.gitignore @@ -360,4 +360,58 @@ MigrationBackup/ .ionide/ # Fody - auto-generated XML schema -FodyWeavers.xsd \ No newline at end of file +FodyWeavers.xsd +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +!.vscode/*.code-snippets +.history/ +*.vsix +bin/ +obj/ +/node_modules +/wwwroot/node_modules +*.tlog +*.vbp +*.dsw +*.dsp +.vshistory/ +*.code-workspace +*.cab +*.msi +*.msix +*.msm +*.msp +*.sln.iml +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf +.idea/**/aws.xml +.idea/**/contentModel.xml +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml +.idea/**/gradle.xml +.idea/**/libraries +cmake-build-*/ +.idea/**/mongoSettings.xml +*.iws +out/ +.idea_modules/ +atlassian-ide-plugin.xml +.idea/replstate.xml +.idea/sonarlint/ +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties +.idea/httpRequests +.idea/caches/build_file_checksums.ser diff --git a/.idea/.idea.calculator/.idea/vcs.xml b/.idea/.idea.calculator/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/.idea.calculator/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Commands/CalculateCommand.cs b/Commands/CalculateCommand.cs new file mode 100644 index 0000000..782282f --- /dev/null +++ b/Commands/CalculateCommand.cs @@ -0,0 +1,38 @@ +using calculator.Common; +using calculator.Model; +using calculator.Services; + +namespace calculator.Commands; + +public class CalculateCommand : ICommand +{ + private readonly ICaculator _caculator; + private readonly CaculatorData _data; + private readonly double? _b; + private readonly Operation _operation; + private double? _previousValue; + + public CalculateCommand(ICaculator caculator, CaculatorData data) + { + _caculator = caculator; + _data = data; + _operation = data.Operation.Value; + + if (double.TryParse(data.Input, out var b)) + _b = b; + } + + public void Execute() + { + if (_data.Value is null) + return; + _previousValue = _data.Value; + _data.Value = _caculator.Calculate(_operation, _data.Value.Value, _b); + _data.Input = null; + } + + public void Undo() + { + _data.Value = _previousValue; + } +} \ No newline at end of file diff --git a/Commands/ICommand.cs b/Commands/ICommand.cs new file mode 100644 index 0000000..b2ed28b --- /dev/null +++ b/Commands/ICommand.cs @@ -0,0 +1,7 @@ +namespace calculator.Commands; + +public interface ICommand +{ + void Execute(); + void Undo(); +} \ No newline at end of file diff --git a/Common/Operation.cs b/Common/Operation.cs new file mode 100644 index 0000000..b969da4 --- /dev/null +++ b/Common/Operation.cs @@ -0,0 +1,32 @@ +namespace calculator.Common; + +public enum Operation +{ + Add, + Sub, + Mul, + Div, + Pow, + Sqrt, + SqrtY, + Factorial, + CubeRoot, + Square, + Cube, + PowY, + Log, + Ln, + Exp, + Inv, + Pi, + OneDiv, + Mod, + Neg, + Percent, + Sinh, + Sin, + Cosh, + Cos, + Tanh, + Tan +} \ No newline at end of file diff --git a/Controller/CaculatorController.cs b/Controller/CaculatorController.cs index 8cd7ca1..268cfa7 100644 --- a/Controller/CaculatorController.cs +++ b/Controller/CaculatorController.cs @@ -1,4 +1,6 @@ -using calculator.Model; +using calculator.Commands; +using calculator.Common; +using calculator.Model; using calculator.Services; using calculator.View; @@ -10,6 +12,7 @@ public class CaculatorController private readonly IInputService _inputService; private readonly ICaculatorView _view; private readonly CaculatorData _data; + private ICommand? _currentCommand; public CaculatorController(ICaculator caculator, IInputService inputService, ICaculatorView view, CaculatorData data) @@ -21,30 +24,22 @@ public class CaculatorController _view.OperandPressed += OnOperandPressed; _view.OperatorPressed += OnOperatorPressed; - _view.ClearPressed += OnFullClearPressed; + _view.ClearPressed += OnClearPressed; _view.CalculatePressed += OnCalculatePressed; _view.SingleOperatorPressed += OnSingleOperationPressed; - OnFullClearPressed(); + OnClearPressed(true); } - private void OnSingleOperationPressed(string obj) + private void OnSingleOperationPressed(Operation operation) { - _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()); + OnOperatorPressed(operation); + _currentCommand = new CalculateCommand(_caculator, _data); + OnCalculatePressed(); } - private void OnFullClearPressed() + private void OnClearPressed(bool full) { - Clear(); + Clear(full: full); } private void OnCalculatePressed() @@ -52,83 +47,70 @@ public class CaculatorController 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()); + if (_data.Value is null) return; - } - if (_data.Operands.Count < 2) + if (_data is not { Caculated: true, Input: null } || _currentCommand == null) { - var (lastOperand, lastOperation) = (_data.LastOperand, _data.Operation); - if (lastOperand is not null && lastOperation is not null) - { - Calculate(_data.Operands.Pop(), lastOperand, lastOperation); - } - return; + _currentCommand = new CalculateCommand(_caculator, _data); } - - var operand = _data.Operands.Pop(); - var operand2 = _data.Operands.Pop(); - Calculate(operand2, operand, _data.Operation); - } - - private void Calculate(string operand1, string operand2, string operation) - { + + _currentCommand?.Execute(); _data.Caculated = true; - _data.LastOperand = operand2; - _data.Operands.Push(_caculator.Calculate(operand1, operand2, operation)); - _view.UpdateView(_data.Operands.Peek()); + UpdateView(_data.Value.Value); } private void Clear(string value = "0", bool full = true) { if (full) { - _data.Operands.Clear(); + _data.Value = null; _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()); + _data.Input = null; + _view.UpdateView(value); } - private void OnOperatorPressed(string operation) + private void OnOperatorPressed(Operation operation) { - _data.SingleOperation = null; - if (_data.LastOperand is not null && _data.Caculated == false) + if (_data.Input == null && _data.Value == null) + return; + + if (_data is { Caculated: false, Input: not null, Value: not null }) { OnCalculatePressed(); } _data.Operation = operation; + + if (_data.Input != null) + { + _data.Value = double.Parse(_data.Input); + } + + _data.Input = null; } private void OnOperandPressed(char obj) { - - if (_data is { Operands.Count: 1, Operation: not null }) + if (_data.Caculated) { - _data.Operands.Push("0"); - } - else if (_data is { Caculated: true }) - { - Clear(); + Clear(full: false); } - var operand = _data.Operands.Pop(); + _data.Input = _inputService.TryInput(_data.Input + obj); + UpdateView(_data.Input); + } + private void UpdateView(double input) + { + _view.UpdateView(input.ToString("0.#####")); + } - _data.Operands.Push(_inputService.TryInput(operand + obj)); - _view.UpdateView(_data.Operands.Peek()); + private void UpdateView(string input) + { + _view.UpdateView(input); } } \ No newline at end of file diff --git a/Form1.Designer.cs b/Form1.Designer.cs index f106db9..53bd2c3 100644 --- a/Form1.Designer.cs +++ b/Form1.Designer.cs @@ -28,99 +28,99 @@ /// 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 = new Panel(); + button49 = new Button(); + Log_button = new Button(); + Mod_button = new Button(); + Exp_button = new Button(); + button53 = new Button(); + CubeRoot_Button = new Button(); + Cube_button = new Button(); + Tan_button = new Button(); + Tanh_button = new Button(); + Pi_button = new Button(); + SqrtY_button = new Button(); + PowY_button = new Button(); + Cos_button = new Button(); + Cosh_button = new Button(); + dms_button = new Button(); + Factorial_button = new Button(); + Square_button = new Button(); + Sin_button = new Button(); + Sinh_button = new Button(); + Int_button = new Button(); + button23 = new Button(); + button30 = new Button(); + Ln_button = new Button(); + Inv_button = 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.BackColor = Color.MediumSlateBlue; panel1.Controls.Add(button49); - panel1.Controls.Add(button50); - panel1.Controls.Add(button51); - panel1.Controls.Add(button52); + panel1.Controls.Add(Log_button); + panel1.Controls.Add(Mod_button); + panel1.Controls.Add(Exp_button); 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(CubeRoot_Button); + panel1.Controls.Add(Cube_button); + panel1.Controls.Add(Tan_button); + panel1.Controls.Add(Tanh_button); + panel1.Controls.Add(Pi_button); + panel1.Controls.Add(SqrtY_button); + panel1.Controls.Add(PowY_button); + panel1.Controls.Add(Cos_button); + panel1.Controls.Add(Cosh_button); + panel1.Controls.Add(dms_button); + panel1.Controls.Add(Factorial_button); + panel1.Controls.Add(Square_button); + panel1.Controls.Add(Sin_button); + panel1.Controls.Add(Sinh_button); + panel1.Controls.Add(Int_button); panel1.Controls.Add(button23); panel1.Controls.Add(button30); - panel1.Controls.Add(button31); - panel1.Controls.Add(button32); + panel1.Controls.Add(Ln_button); + panel1.Controls.Add(Inv_button); panel1.Controls.Add(button33); panel1.Controls.Add(InverseButton); panel1.Controls.Add(MultButton); @@ -152,726 +152,744 @@ 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; + 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; + 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 + // Log_button // - 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; + Log_button.FlatStyle = FlatStyle.Flat; + Log_button.Font = new Font("Segoe UI", 9.75F, FontStyle.Bold, GraphicsUnit.Point); + Log_button.Location = new Point(175, 296); + Log_button.Name = "Log_button"; + Log_button.Size = new Size(51, 37); + Log_button.TabIndex = 54; + Log_button.Text = "log"; + Log_button.UseVisualStyleBackColor = true; + Log_button.Click += OnLogButtonClick; // - // button51 + // Mod_button // - 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; + Mod_button.FlatStyle = FlatStyle.Flat; + Mod_button.Font = new Font("Segoe UI", 9.75F, FontStyle.Bold, GraphicsUnit.Point); + Mod_button.Location = new Point(118, 296); + Mod_button.Name = "Mod_button"; + Mod_button.Size = new Size(51, 37); + Mod_button.TabIndex = 53; + Mod_button.Text = "Mod"; + Mod_button.UseVisualStyleBackColor = true; + Mod_button.Click += OnModButtonClick; // - // button52 + // Exp_button // - 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; + Exp_button.FlatStyle = FlatStyle.Flat; + Exp_button.Font = new Font("Segoe UI", 9.75F, FontStyle.Bold, GraphicsUnit.Point); + Exp_button.Location = new Point(61, 296); + Exp_button.Name = "Exp_button"; + Exp_button.Size = new Size(51, 37); + Exp_button.TabIndex = 52; + Exp_button.Text = "Exp"; + Exp_button.UseVisualStyleBackColor = true; + Exp_button.Click += OnExpButtonClick; // // 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; + 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 + // CubeRoot_Button // - 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; + CubeRoot_Button.FlatStyle = FlatStyle.Flat; + CubeRoot_Button.Font = new Font("Segoe UI", 9.75F, FontStyle.Bold, GraphicsUnit.Point); + CubeRoot_Button.Location = new Point(232, 253); + CubeRoot_Button.Name = "CubeRoot_Button"; + CubeRoot_Button.Size = new Size(51, 37); + CubeRoot_Button.TabIndex = 50; + CubeRoot_Button.Text = "∛x"; + CubeRoot_Button.UseVisualStyleBackColor = true; + CubeRoot_Button.Click += OnCubeRootButtonClick; // - // button45 + // Cube_button // - 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; + Cube_button.FlatStyle = FlatStyle.Flat; + Cube_button.Font = new Font("Segoe UI", 9.75F, FontStyle.Bold, GraphicsUnit.Point); + Cube_button.Location = new Point(175, 253); + Cube_button.Name = "Cube_button"; + Cube_button.Size = new Size(51, 37); + Cube_button.TabIndex = 49; + Cube_button.Text = "x³"; + Cube_button.UseVisualStyleBackColor = true; + Cube_button.Click += OnCubeButtonClick; // - // button46 + // Tan_button // - 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; + Tan_button.FlatStyle = FlatStyle.Flat; + Tan_button.Font = new Font("Segoe UI", 9.75F, FontStyle.Bold, GraphicsUnit.Point); + Tan_button.Location = new Point(118, 253); + Tan_button.Name = "Tan_button"; + Tan_button.Size = new Size(51, 37); + Tan_button.TabIndex = 48; + Tan_button.Text = "tan"; + Tan_button.UseVisualStyleBackColor = true; + Tan_button.Click += OnTanButtonClick; // - // button47 + // Tanh_button // - 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; + Tanh_button.FlatStyle = FlatStyle.Flat; + Tanh_button.Font = new Font("Segoe UI", 9.75F, FontStyle.Bold, GraphicsUnit.Point); + Tanh_button.Location = new Point(61, 253); + Tanh_button.Name = "Tanh_button"; + Tanh_button.Size = new Size(51, 37); + Tanh_button.TabIndex = 47; + Tanh_button.Text = "tanh"; + Tanh_button.UseVisualStyleBackColor = true; + Tanh_button.Click += OnTanhButtonClick; // - // button48 + // Pi_button // - 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; + Pi_button.FlatStyle = FlatStyle.Flat; + Pi_button.Font = new Font("Segoe UI", 9.75F, FontStyle.Bold, GraphicsUnit.Point); + Pi_button.Location = new Point(4, 253); + Pi_button.Name = "Pi_button"; + Pi_button.Size = new Size(51, 37); + Pi_button.TabIndex = 46; + Pi_button.Text = "π"; + Pi_button.UseVisualStyleBackColor = true; + Pi_button.Click += OnPiButtonClick; // - // button39 + // SqrtY_button // - 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; + SqrtY_button.FlatStyle = FlatStyle.Flat; + SqrtY_button.Font = new Font("Segoe UI", 9.75F, FontStyle.Bold, GraphicsUnit.Point); + SqrtY_button.Location = new Point(232, 210); + SqrtY_button.Name = "SqrtY_button"; + SqrtY_button.Size = new Size(51, 37); + SqrtY_button.TabIndex = 45; + SqrtY_button.Text = "y√x"; + SqrtY_button.UseVisualStyleBackColor = true; + SqrtY_button.Click += OnSqrtYButtonClick; // - // button40 + // PowY_button // - 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; + PowY_button.FlatStyle = FlatStyle.Flat; + PowY_button.Font = new Font("Segoe UI", 9.75F, FontStyle.Bold, GraphicsUnit.Point); + PowY_button.Location = new Point(175, 210); + PowY_button.Name = "PowY_button"; + PowY_button.Size = new Size(51, 37); + PowY_button.TabIndex = 44; + PowY_button.Text = "xᵜ"; + PowY_button.UseVisualStyleBackColor = true; + PowY_button.Click += OnPowYButtonClick; // - // button41 + // Cos_button // - 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; + Cos_button.FlatStyle = FlatStyle.Flat; + Cos_button.Font = new Font("Segoe UI", 9.75F, FontStyle.Bold, GraphicsUnit.Point); + Cos_button.Location = new Point(118, 210); + Cos_button.Name = "Cos_button"; + Cos_button.Size = new Size(51, 37); + Cos_button.TabIndex = 43; + Cos_button.Text = "cos"; + Cos_button.UseVisualStyleBackColor = true; + Cos_button.Click += OnCosButtonClick; // - // button42 + // Cosh_button // - 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; + Cosh_button.FlatStyle = FlatStyle.Flat; + Cosh_button.Font = new Font("Segoe UI", 9.75F, FontStyle.Bold, GraphicsUnit.Point); + Cosh_button.Location = new Point(61, 210); + Cosh_button.Name = "Cosh_button"; + Cosh_button.Size = new Size(51, 37); + Cosh_button.TabIndex = 42; + Cosh_button.Text = "cosh"; + Cosh_button.UseVisualStyleBackColor = true; + Cosh_button.Click += OnCoshButtonClick; // - // button43 + // dms_button // - 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; + dms_button.FlatStyle = FlatStyle.Flat; + dms_button.Font = new Font("Segoe UI", 9.75F, FontStyle.Bold, GraphicsUnit.Point); + dms_button.Location = new Point(4, 210); + dms_button.Name = "dms_button"; + dms_button.Size = new Size(51, 37); + dms_button.TabIndex = 41; + dms_button.Text = "dms"; + dms_button.UseVisualStyleBackColor = true; // - // button34 + // Factorial_button // - 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; + Factorial_button.FlatStyle = FlatStyle.Flat; + Factorial_button.Font = new Font("Segoe UI", 9.75F, FontStyle.Bold, GraphicsUnit.Point); + Factorial_button.Location = new Point(232, 167); + Factorial_button.Name = "Factorial_button"; + Factorial_button.Size = new Size(51, 37); + Factorial_button.TabIndex = 40; + Factorial_button.Text = "n!"; + Factorial_button.UseVisualStyleBackColor = true; + Factorial_button.Click += OnFactorialButtonClick; // - // button35 + // Square_button // - 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; + Square_button.FlatStyle = FlatStyle.Flat; + Square_button.Font = new Font("Segoe UI", 9.75F, FontStyle.Bold, GraphicsUnit.Point); + Square_button.Location = new Point(175, 167); + Square_button.Name = "Square_button"; + Square_button.Size = new Size(51, 37); + Square_button.TabIndex = 39; + Square_button.Text = "Х²"; + Square_button.UseVisualStyleBackColor = true; + Square_button.Click += OnSquareButtonClick; // - // button36 + // Sin_button // - 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; + Sin_button.FlatStyle = FlatStyle.Flat; + Sin_button.Font = new Font("Segoe UI", 9.75F, FontStyle.Bold, GraphicsUnit.Point); + Sin_button.Location = new Point(118, 167); + Sin_button.Name = "Sin_button"; + Sin_button.Size = new Size(51, 37); + Sin_button.TabIndex = 38; + Sin_button.Text = "sin"; + Sin_button.UseVisualStyleBackColor = true; + Sin_button.Click += OnSinButtonClick; // - // button37 + // Sinh_button // - 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; + Sinh_button.FlatStyle = FlatStyle.Flat; + Sinh_button.Font = new Font("Segoe UI", 9.75F, FontStyle.Bold, GraphicsUnit.Point); + Sinh_button.Location = new Point(61, 167); + Sinh_button.Name = "Sinh_button"; + Sinh_button.Size = new Size(51, 37); + Sinh_button.TabIndex = 37; + Sinh_button.Text = "sinh"; + Sinh_button.UseVisualStyleBackColor = true; + Sinh_button.Click += OnSinhButtonClick; // - // button38 + // Int_button // - 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; + Int_button.FlatStyle = FlatStyle.Flat; + Int_button.Font = new Font("Segoe UI", 9.75F, FontStyle.Bold, GraphicsUnit.Point); + Int_button.Location = new Point(4, 167); + Int_button.Name = "Int_button"; + Int_button.Size = new Size(51, 37); + Int_button.TabIndex = 36; + Int_button.Text = "Int"; + Int_button.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; + 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; + 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 + // Ln_button // - 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; + Ln_button.FlatStyle = FlatStyle.Flat; + Ln_button.Font = new Font("Segoe UI", 9.75F, FontStyle.Bold, GraphicsUnit.Point); + Ln_button.Location = new Point(118, 124); + Ln_button.Name = "Ln_button"; + Ln_button.Size = new Size(51, 37); + Ln_button.TabIndex = 33; + Ln_button.Text = "Ln"; + Ln_button.UseVisualStyleBackColor = true; + Ln_button.Click += OnLnButtonClick; // - // button32 + // Inv_button // - 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; + Inv_button.FlatStyle = FlatStyle.Flat; + Inv_button.Font = new Font("Segoe UI", 9.75F, FontStyle.Bold, GraphicsUnit.Point); + Inv_button.Location = new Point(61, 124); + Inv_button.Name = "Inv_button"; + Inv_button.Size = new Size(51, 37); + Inv_button.TabIndex = 32; + Inv_button.Text = "Inv"; + Inv_button.UseVisualStyleBackColor = true; + Inv_button.Click += OnInvButtonClick; // // 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; + 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; + 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; + 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; + 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; + 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; + 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; + 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; + 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; + 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; + 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; + 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; + 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; + 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; + 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; + 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; + 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; + 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; + 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; + 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; + 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; + 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; + 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; + button8.Click += CButtonClick; // // 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; + 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; + 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; + 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; + 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; + 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; + 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; + 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; + 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; + radioButton3.AutoSize = true; + radioButton3.Font = new Font("Microsoft Sans Serif", 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(76, 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; + radioButton2.AutoSize = true; + radioButton2.Font = new Font("Microsoft Sans Serif", 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(95, 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; + radioButton1.AutoSize = true; + radioButton1.Font = new Font("Microsoft Sans Serif", 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(93, 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; + 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="Вид"; + 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="Правка"; + 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="Справка"; + 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); + 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"; + Name = "Form1"; + Text = "Form1"; panel1.ResumeLayout(false); panel1.PerformLayout(); groupBox1.ResumeLayout(false); @@ -897,29 +915,29 @@ private LinkLabel linkLabel2; private LinkLabel linkLabel3; private Button button49; - private Button button50; - private Button button51; - private Button button52; + private Button Log_button; + private Button Mod_button; + private Button Exp_button; 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 CubeRoot_Button; + private Button Cube_button; + private Button Tan_button; + private Button Tanh_button; + private Button Pi_button; + private Button SqrtY_button; + private Button PowY_button; + private Button Cos_button; + private Button Cosh_button; + private Button dms_button; + private Button Factorial_button; + private Button Square_button; + private Button Sin_button; + private Button Sinh_button; + private Button Int_button; private Button button23; private Button button30; - private Button button31; - private Button button32; + private Button Ln_button; + private Button Inv_button; private Button button33; private Button InverseButton; private Button MultButton; diff --git a/Form1.cs b/Form1.cs index 33a3211..aca05e3 100644 --- a/Form1.cs +++ b/Form1.cs @@ -1,4 +1,5 @@ -using calculator.View; +using calculator.Common; +using calculator.View; namespace calculator { @@ -10,9 +11,9 @@ namespace calculator } public event Action? OperandPressed; - public event Action? OperatorPressed; - public event Action? SingleOperatorPressed; - public event Action? ClearPressed; + public event Action? OperatorPressed; + public event Action? SingleOperatorPressed; + public event Action? ClearPressed; public event Action? CalculatePressed; public void UpdateView(string input) @@ -22,7 +23,12 @@ namespace calculator private void OnCEButtonClick(object sender, EventArgs e) { - ClearPressed?.Invoke(); + ClearPressed?.Invoke(false); + } + + private void CButtonClick(object sender, EventArgs e) + { + ClearPressed?.Invoke(true); } private void OnZeroButtonClick(object sender, EventArgs e) @@ -82,42 +88,77 @@ namespace calculator private void OnNegativeButtonClick(object sender, EventArgs e) { - SingleOperatorPressed?.Invoke("-1"); + SingleOperatorPressed?.Invoke(Operation.Neg); } private void OnPlusButtonClick(object sender, EventArgs e) { - OperatorPressed?.Invoke("+"); + OperatorPressed?.Invoke(Operation.Add); } private void OnMinusButtonClick(object sender, EventArgs e) { - OperatorPressed?.Invoke("-"); + OperatorPressed?.Invoke(Operation.Sub); } private void OnMultButtonClick(object sender, EventArgs e) { - OperatorPressed?.Invoke("*"); + OperatorPressed?.Invoke(Operation.Mul); } private void OnDivideButtonClick(object sender, EventArgs e) { - OperatorPressed?.Invoke("/"); + OperatorPressed?.Invoke(Operation.Div); } private void OnSqrtButtonClick(object sender, EventArgs e) { - SingleOperatorPressed?.Invoke("√"); + SingleOperatorPressed?.Invoke(Operation.Sqrt); } private void OnPercentButtonClick(object sender, EventArgs e) { - SingleOperatorPressed?.Invoke("%"); + SingleOperatorPressed?.Invoke(Operation.Percent); } private void OnInverseButtonClick(object sender, EventArgs e) { - SingleOperatorPressed?.Invoke("1/"); + SingleOperatorPressed?.Invoke(Operation.OneDiv); + } + + private void OnSinhButtonClick(object sender, EventArgs e) + { + SingleOperatorPressed?.Invoke(Operation.Sinh); + } + + private void OnSinButtonClick(object sender, EventArgs e) + { + SingleOperatorPressed?.Invoke(Operation.Sin); + } + + private void OnCoshButtonClick(object sender, EventArgs e) + { + SingleOperatorPressed?.Invoke(Operation.Cosh); + } + + private void OnCosButtonClick(object sender, EventArgs e) + { + SingleOperatorPressed?.Invoke(Operation.Cos); + } + + private void OnTanhButtonClick(object sender, EventArgs e) + { + SingleOperatorPressed?.Invoke(Operation.Tanh); + } + + private void OnTanButtonClick(object sender, EventArgs e) + { + SingleOperatorPressed?.Invoke(Operation.Tan); + } + + private void OnSqrtYButtonClick(object sender, EventArgs e) + { + SingleOperatorPressed?.Invoke(Operation.SqrtY); } private void OnEqualButtonClick(object sender, EventArgs e) @@ -125,9 +166,59 @@ namespace calculator CalculatePressed?.Invoke(); } - private void button39_Click(object sender, EventArgs e) + private void OnFactorialButtonClick(object sender, EventArgs e) { - + SingleOperatorPressed?.Invoke(Operation.Factorial); + } + + private void OnModButtonClick(object sender, EventArgs e) + { + + } + + private void OnCubeRootButtonClick(object sender, EventArgs e) + { + SingleOperatorPressed?.Invoke(Operation.CubeRoot); + } + + private void OnSquareButtonClick(object sender, EventArgs e) + { + SingleOperatorPressed?.Invoke(Operation.Square); + } + + private void OnPowYButtonClick(object sender, EventArgs e) + { + SingleOperatorPressed?.Invoke(Operation.PowY); + } + + private void OnCubeButtonClick(object sender, EventArgs e) + { + SingleOperatorPressed?.Invoke(Operation.Cube); + } + + private void OnLogButtonClick(object sender, EventArgs e) + { + SingleOperatorPressed?.Invoke(Operation.Log); + } + + private void OnInvButtonClick(object sender, EventArgs e) + { + SingleOperatorPressed?.Invoke(Operation.Inv); + } + + private void OnLnButtonClick(object sender, EventArgs e) + { + SingleOperatorPressed?.Invoke(Operation.Ln); + } + + private void OnExpButtonClick(object sender, EventArgs e) + { + SingleOperatorPressed?.Invoke(Operation.Exp); + } + + private void OnPiButtonClick(object sender, EventArgs e) + { + SingleOperatorPressed?.Invoke(Operation.Pi); } } } \ No newline at end of file diff --git a/Form1.resx b/Form1.resx index 2a5f517..0c27f79 100644 --- a/Form1.resx +++ b/Form1.resx @@ -123,61 +123,61 @@ True - + True - + True - + True True - + True - + True - + True - + True - + True - + True - + True - + True - + True - + True - + True - + True - + True - + True - + True @@ -186,10 +186,10 @@ True - + True - + True @@ -291,6 +291,15 @@ True + + True + + + True + + + True + True diff --git a/Model/CaculatorData.cs b/Model/CaculatorData.cs index 4f6480a..ddcd271 100644 --- a/Model/CaculatorData.cs +++ b/Model/CaculatorData.cs @@ -1,10 +1,11 @@ -namespace calculator.Model; +using calculator.Common; + +namespace calculator.Model; public class CaculatorData { - public Stack Operands { get; set; } = new(); - public string? Operation { get; set; } - public string? SingleOperation { get; set; } + public string? Input { get; set; } + public double? Value { get; set; } + public Operation? Operation { get; set; } public bool Caculated { get; set; } - public string? LastOperand { get; set; } } \ No newline at end of file diff --git a/Services/Caculyator.cs b/Services/Caculyator.cs index 499eda5..ea95d7f 100644 --- a/Services/Caculyator.cs +++ b/Services/Caculyator.cs @@ -1,57 +1,90 @@ -using System.Globalization; +using calculator.Common; namespace calculator.Services { internal class Caculyator : ICaculator { - public string Calculate(string n, string m, string operation) + public double Calculate(Operation operation, double a, double? b = null) { - 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.#####"); + return b is null + ? ApplyOperator(operation, a) + : ApplyOperator(operation, a, b.Value); } - 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) + private static double ApplyOperator(Operation token, double a, double b) { switch (token) { - case "+": - return operand1 + operand2; - case "-": - return operand1 - operand2; - case "*": - return operand1 * operand2; - case "/": - return operand1 / operand2; - case "^": - return Math.Pow(operand1, operand2); + case Operation.Add: + return a + b; + case Operation.Sub: + return a - b; + case Operation.Mul: + return a * b; + case Operation.Div: + return a / b; + case Operation.Pow: + return Math.Pow(a, b); + case Operation.SqrtY: + return Math.Pow(a, 1 / b); + case Operation.PowY: + return Math.Pow(a, b); + case Operation.Mod: + return a % b; default: throw new ArgumentException($"Invalid operator: {token}"); } } - private static double ApplyOperator(string token, double operand1) + private static double Factorial(double n) + { + if (n == 0) + return 1; + return n * Factorial(n - 1); + } + + private static double ApplyOperator(Operation token, double a) { switch (token) { - case "1/": - return 1 / operand1; - case "√": - return Math.Sqrt(operand1); - case "%": - return operand1 / 100; - case "-1": - return operand1 * -1; + case Operation.OneDiv: + return 1 / a; + case Operation.Sqrt: + return Math.Sqrt(a); + case Operation.Percent: + return a / 100; + case Operation.Neg: + return a * -1; + case Operation.Sinh: + return Math.Sinh(a); + case Operation.Sin: + return Math.Sin(a); + case Operation.Cosh: + return Math.Cosh(a); + case Operation.Cos: + return Math.Cos(a); + case Operation.Tanh: + return Math.Tanh(a); + case Operation.Tan: + return Math.Tan(a); + case Operation.Factorial: + return Factorial(a); + case Operation.Square: + return Math.Pow(a, 2); + case Operation.Cube: + return Math.Pow(a, 3); + case Operation.CubeRoot: + return Math.Pow(a, 1 / 3); + case Operation.Log: + return Math.Log10(a); + case Operation.Ln: + return Math.Log(a); + case Operation.Exp: + return Math.Exp(a); + case Operation.Inv: + return 1 / a; + case Operation.Pi: + return Math.PI; default: throw new ArgumentException($"Invalid operator: {token}"); } diff --git a/Services/ICaculator.cs b/Services/ICaculator.cs index 8353f64..533ce47 100644 --- a/Services/ICaculator.cs +++ b/Services/ICaculator.cs @@ -1,7 +1,8 @@ -namespace calculator.Services; +using calculator.Common; + +namespace calculator.Services; public interface ICaculator { - string Calculate(string op1, string op2, string operation); - string SingleOperation(string operand, string operation); + double Calculate(Operation operation, double a, double? b = null); } \ No newline at end of file diff --git a/View/ICaculatorView.cs b/View/ICaculatorView.cs index 44cc442..6044b09 100644 --- a/View/ICaculatorView.cs +++ b/View/ICaculatorView.cs @@ -1,11 +1,13 @@ -namespace calculator.View; +using calculator.Common; + +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 OperatorPressed; + public event Action ClearPressed; public event Action CalculatePressed; + public event Action SingleOperatorPressed; public void UpdateView(string input); } \ No newline at end of file diff --git a/calculator.csproj b/calculator.csproj index 13ee123..f77a785 100644 --- a/calculator.csproj +++ b/calculator.csproj @@ -2,10 +2,10 @@ WinExe - net6.0-windows enable true enable + net6.0-windows