Add project files.
This commit is contained in:
11
Calculator.csproj
Normal file
11
Calculator.csproj
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>WinExe</OutputType>
|
||||||
|
<TargetFramework>net8.0-windows</TargetFramework>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<UseWindowsForms>true</UseWindowsForms>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
25
Calculator.sln
Normal file
25
Calculator.sln
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 17
|
||||||
|
VisualStudioVersion = 17.14.36414.22 d17.14
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Calculator", "Calculator.csproj", "{04B58D4E-36B2-418A-A659-94302139B2C3}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{04B58D4E-36B2-418A-A659-94302139B2C3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{04B58D4E-36B2-418A-A659-94302139B2C3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{04B58D4E-36B2-418A-A659-94302139B2C3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{04B58D4E-36B2-418A-A659-94302139B2C3}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {3F072D0C-4641-4596-A8EA-29E684F64857}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
||||||
292
Form1.Designer.cs
generated
Normal file
292
Form1.Designer.cs
generated
Normal file
@@ -0,0 +1,292 @@
|
|||||||
|
namespace Calculator
|
||||||
|
{
|
||||||
|
partial class Form1
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
btn_input_6 = new Button();
|
||||||
|
btn_input_3 = new Button();
|
||||||
|
btn_input_5 = new Button();
|
||||||
|
btn_input_2 = new Button();
|
||||||
|
btn_input_8 = new Button();
|
||||||
|
btn_input_9 = new Button();
|
||||||
|
btn_input_7 = new Button();
|
||||||
|
btn_input_4 = new Button();
|
||||||
|
btn_input_1 = new Button();
|
||||||
|
btn_input_0 = new Button();
|
||||||
|
btn_input_comma = new Button();
|
||||||
|
lbl_main = new Label();
|
||||||
|
btn_input_add = new Button();
|
||||||
|
btn_input_sub = new Button();
|
||||||
|
btn_input_div = new Button();
|
||||||
|
btn_input_mult = new Button();
|
||||||
|
btn_import_prev = new Button();
|
||||||
|
lbl_number = new Label();
|
||||||
|
btn_next = new Button();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// btn_input_6
|
||||||
|
//
|
||||||
|
btn_input_6.Location = new Point(444, 149);
|
||||||
|
btn_input_6.Name = "btn_input_6";
|
||||||
|
btn_input_6.Size = new Size(71, 34);
|
||||||
|
btn_input_6.TabIndex = 4;
|
||||||
|
btn_input_6.Text = "6";
|
||||||
|
btn_input_6.UseVisualStyleBackColor = true;
|
||||||
|
btn_input_6.Visible = false;
|
||||||
|
//
|
||||||
|
// btn_input_3
|
||||||
|
//
|
||||||
|
btn_input_3.Location = new Point(444, 109);
|
||||||
|
btn_input_3.Name = "btn_input_3";
|
||||||
|
btn_input_3.Size = new Size(71, 34);
|
||||||
|
btn_input_3.TabIndex = 10;
|
||||||
|
btn_input_3.Text = "3";
|
||||||
|
btn_input_3.UseVisualStyleBackColor = true;
|
||||||
|
btn_input_3.Visible = false;
|
||||||
|
//
|
||||||
|
// btn_input_5
|
||||||
|
//
|
||||||
|
btn_input_5.Location = new Point(367, 149);
|
||||||
|
btn_input_5.Name = "btn_input_5";
|
||||||
|
btn_input_5.Size = new Size(71, 34);
|
||||||
|
btn_input_5.TabIndex = 11;
|
||||||
|
btn_input_5.Text = "5";
|
||||||
|
btn_input_5.UseVisualStyleBackColor = true;
|
||||||
|
btn_input_5.Visible = false;
|
||||||
|
//
|
||||||
|
// btn_input_2
|
||||||
|
//
|
||||||
|
btn_input_2.Location = new Point(367, 109);
|
||||||
|
btn_input_2.Name = "btn_input_2";
|
||||||
|
btn_input_2.Size = new Size(71, 34);
|
||||||
|
btn_input_2.TabIndex = 12;
|
||||||
|
btn_input_2.Text = "2";
|
||||||
|
btn_input_2.UseVisualStyleBackColor = true;
|
||||||
|
btn_input_2.Visible = false;
|
||||||
|
//
|
||||||
|
// btn_input_8
|
||||||
|
//
|
||||||
|
btn_input_8.Location = new Point(367, 189);
|
||||||
|
btn_input_8.Name = "btn_input_8";
|
||||||
|
btn_input_8.Size = new Size(71, 34);
|
||||||
|
btn_input_8.TabIndex = 13;
|
||||||
|
btn_input_8.Text = "8";
|
||||||
|
btn_input_8.UseVisualStyleBackColor = true;
|
||||||
|
btn_input_8.Visible = false;
|
||||||
|
//
|
||||||
|
// btn_input_9
|
||||||
|
//
|
||||||
|
btn_input_9.Location = new Point(444, 189);
|
||||||
|
btn_input_9.Name = "btn_input_9";
|
||||||
|
btn_input_9.Size = new Size(71, 34);
|
||||||
|
btn_input_9.TabIndex = 14;
|
||||||
|
btn_input_9.Text = "9";
|
||||||
|
btn_input_9.UseVisualStyleBackColor = true;
|
||||||
|
btn_input_9.Visible = false;
|
||||||
|
//
|
||||||
|
// btn_input_7
|
||||||
|
//
|
||||||
|
btn_input_7.Location = new Point(290, 189);
|
||||||
|
btn_input_7.Name = "btn_input_7";
|
||||||
|
btn_input_7.Size = new Size(71, 34);
|
||||||
|
btn_input_7.TabIndex = 15;
|
||||||
|
btn_input_7.Text = "7";
|
||||||
|
btn_input_7.UseVisualStyleBackColor = true;
|
||||||
|
btn_input_7.Visible = false;
|
||||||
|
//
|
||||||
|
// btn_input_4
|
||||||
|
//
|
||||||
|
btn_input_4.Location = new Point(290, 149);
|
||||||
|
btn_input_4.Name = "btn_input_4";
|
||||||
|
btn_input_4.Size = new Size(71, 34);
|
||||||
|
btn_input_4.TabIndex = 16;
|
||||||
|
btn_input_4.Text = "4";
|
||||||
|
btn_input_4.UseVisualStyleBackColor = true;
|
||||||
|
btn_input_4.Visible = false;
|
||||||
|
//
|
||||||
|
// btn_input_1
|
||||||
|
//
|
||||||
|
btn_input_1.Location = new Point(290, 109);
|
||||||
|
btn_input_1.Name = "btn_input_1";
|
||||||
|
btn_input_1.Size = new Size(71, 34);
|
||||||
|
btn_input_1.TabIndex = 17;
|
||||||
|
btn_input_1.Text = "1";
|
||||||
|
btn_input_1.UseVisualStyleBackColor = true;
|
||||||
|
btn_input_1.Visible = false;
|
||||||
|
//
|
||||||
|
// btn_input_0
|
||||||
|
//
|
||||||
|
btn_input_0.Location = new Point(332, 229);
|
||||||
|
btn_input_0.Name = "btn_input_0";
|
||||||
|
btn_input_0.Size = new Size(71, 34);
|
||||||
|
btn_input_0.TabIndex = 18;
|
||||||
|
btn_input_0.Text = "0";
|
||||||
|
btn_input_0.UseVisualStyleBackColor = true;
|
||||||
|
btn_input_0.Visible = false;
|
||||||
|
//
|
||||||
|
// btn_input_comma
|
||||||
|
//
|
||||||
|
btn_input_comma.Location = new Point(409, 229);
|
||||||
|
btn_input_comma.Name = "btn_input_comma";
|
||||||
|
btn_input_comma.Size = new Size(71, 34);
|
||||||
|
btn_input_comma.TabIndex = 20;
|
||||||
|
btn_input_comma.Text = ",";
|
||||||
|
btn_input_comma.UseVisualStyleBackColor = true;
|
||||||
|
btn_input_comma.Visible = false;
|
||||||
|
//
|
||||||
|
// lbl_main
|
||||||
|
//
|
||||||
|
lbl_main.Anchor = AnchorStyles.Top;
|
||||||
|
lbl_main.AutoSize = true;
|
||||||
|
lbl_main.Location = new Point(347, 40);
|
||||||
|
lbl_main.Name = "lbl_main";
|
||||||
|
lbl_main.Size = new Size(121, 25);
|
||||||
|
lbl_main.TabIndex = 21;
|
||||||
|
lbl_main.Text = "Välj operation";
|
||||||
|
lbl_main.TextAlign = ContentAlignment.TopCenter;
|
||||||
|
//
|
||||||
|
// btn_input_add
|
||||||
|
//
|
||||||
|
btn_input_add.Location = new Point(347, 137);
|
||||||
|
btn_input_add.Name = "btn_input_add";
|
||||||
|
btn_input_add.Size = new Size(56, 34);
|
||||||
|
btn_input_add.TabIndex = 22;
|
||||||
|
btn_input_add.Text = "+";
|
||||||
|
btn_input_add.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// btn_input_sub
|
||||||
|
//
|
||||||
|
btn_input_sub.Location = new Point(409, 137);
|
||||||
|
btn_input_sub.Name = "btn_input_sub";
|
||||||
|
btn_input_sub.Size = new Size(56, 34);
|
||||||
|
btn_input_sub.TabIndex = 23;
|
||||||
|
btn_input_sub.Text = "-";
|
||||||
|
btn_input_sub.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// btn_input_div
|
||||||
|
//
|
||||||
|
btn_input_div.Location = new Point(409, 177);
|
||||||
|
btn_input_div.Name = "btn_input_div";
|
||||||
|
btn_input_div.Size = new Size(56, 34);
|
||||||
|
btn_input_div.TabIndex = 24;
|
||||||
|
btn_input_div.Text = "/";
|
||||||
|
btn_input_div.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// btn_input_mult
|
||||||
|
//
|
||||||
|
btn_input_mult.Location = new Point(347, 177);
|
||||||
|
btn_input_mult.Name = "btn_input_mult";
|
||||||
|
btn_input_mult.Size = new Size(56, 34);
|
||||||
|
btn_input_mult.TabIndex = 25;
|
||||||
|
btn_input_mult.Text = "*";
|
||||||
|
btn_input_mult.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// btn_import_prev
|
||||||
|
//
|
||||||
|
btn_import_prev.Location = new Point(55, 149);
|
||||||
|
btn_import_prev.Name = "btn_import_prev";
|
||||||
|
btn_import_prev.Size = new Size(164, 88);
|
||||||
|
btn_import_prev.TabIndex = 26;
|
||||||
|
btn_import_prev.Text = "Importera föregående svar";
|
||||||
|
btn_import_prev.UseVisualStyleBackColor = true;
|
||||||
|
btn_import_prev.Visible = false;
|
||||||
|
btn_import_prev.Click += btn_import_prev_Click;
|
||||||
|
//
|
||||||
|
// lbl_number
|
||||||
|
//
|
||||||
|
lbl_number.Anchor = AnchorStyles.Top;
|
||||||
|
lbl_number.AutoSize = true;
|
||||||
|
lbl_number.Location = new Point(347, 65);
|
||||||
|
lbl_number.Name = "lbl_number";
|
||||||
|
lbl_number.Size = new Size(0, 25);
|
||||||
|
lbl_number.TabIndex = 27;
|
||||||
|
lbl_number.TextAlign = ContentAlignment.TopCenter;
|
||||||
|
//
|
||||||
|
// btn_next
|
||||||
|
//
|
||||||
|
btn_next.Location = new Point(584, 149);
|
||||||
|
btn_next.Name = "btn_next";
|
||||||
|
btn_next.Size = new Size(125, 72);
|
||||||
|
btn_next.TabIndex = 28;
|
||||||
|
btn_next.Text = "Nästa";
|
||||||
|
btn_next.UseVisualStyleBackColor = true;
|
||||||
|
btn_next.Visible = false;
|
||||||
|
//
|
||||||
|
// Form1
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(10F, 25F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(800, 450);
|
||||||
|
Controls.Add(btn_next);
|
||||||
|
Controls.Add(lbl_number);
|
||||||
|
Controls.Add(btn_import_prev);
|
||||||
|
Controls.Add(btn_input_mult);
|
||||||
|
Controls.Add(btn_input_div);
|
||||||
|
Controls.Add(btn_input_sub);
|
||||||
|
Controls.Add(btn_input_add);
|
||||||
|
Controls.Add(lbl_main);
|
||||||
|
Controls.Add(btn_input_comma);
|
||||||
|
Controls.Add(btn_input_0);
|
||||||
|
Controls.Add(btn_input_1);
|
||||||
|
Controls.Add(btn_input_4);
|
||||||
|
Controls.Add(btn_input_7);
|
||||||
|
Controls.Add(btn_input_9);
|
||||||
|
Controls.Add(btn_input_8);
|
||||||
|
Controls.Add(btn_input_2);
|
||||||
|
Controls.Add(btn_input_5);
|
||||||
|
Controls.Add(btn_input_3);
|
||||||
|
Controls.Add(btn_input_6);
|
||||||
|
Name = "Form1";
|
||||||
|
Text = "Form1";
|
||||||
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
public Button btn_input_6;
|
||||||
|
public Button btn_input_3;
|
||||||
|
public Button btn_input_5;
|
||||||
|
public Button btn_input_2;
|
||||||
|
public Button btn_input_8;
|
||||||
|
public Button btn_input_9;
|
||||||
|
public Button btn_input_7;
|
||||||
|
public Button btn_input_4;
|
||||||
|
public Button btn_input_1;
|
||||||
|
public Button btn_input_0;
|
||||||
|
public Button btn_input_comma;
|
||||||
|
public Label lbl_main;
|
||||||
|
public Button btn_input_add;
|
||||||
|
public Button btn_input_sub;
|
||||||
|
public Button btn_input_div;
|
||||||
|
public Button btn_input_mult;
|
||||||
|
public Button btn_import_prev;
|
||||||
|
public Label lbl_number;
|
||||||
|
public Button btn_next;
|
||||||
|
}
|
||||||
|
}
|
||||||
15
Form1.cs
Normal file
15
Form1.cs
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
namespace Calculator
|
||||||
|
{
|
||||||
|
public partial class Form1 : Form
|
||||||
|
{
|
||||||
|
public Form1()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btn_import_prev_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
120
Form1.resx
Normal file
120
Form1.resx
Normal file
@@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
||||||
177
Program.cs
Normal file
177
Program.cs
Normal file
@@ -0,0 +1,177 @@
|
|||||||
|
using System.Diagnostics.Eventing.Reader;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace Calculator
|
||||||
|
{
|
||||||
|
internal static class Program
|
||||||
|
{
|
||||||
|
static Form1 form = new Form1();
|
||||||
|
static double valueA;
|
||||||
|
static double valueB;
|
||||||
|
static bool isSecondNumber = false;
|
||||||
|
static bool answerGiven = false;
|
||||||
|
static bool hasStoredAnwser = false;
|
||||||
|
static double lastAnswer;
|
||||||
|
static Operator selectedOperator;
|
||||||
|
|
||||||
|
enum Operator
|
||||||
|
{
|
||||||
|
Add,
|
||||||
|
Sub,
|
||||||
|
Mult,
|
||||||
|
Div
|
||||||
|
}
|
||||||
|
|
||||||
|
static void Main()
|
||||||
|
{
|
||||||
|
ApplicationConfiguration.Initialize();
|
||||||
|
InitButtons();
|
||||||
|
StartSelection();
|
||||||
|
Application.Run(form);
|
||||||
|
}
|
||||||
|
|
||||||
|
static private void InitButtons()
|
||||||
|
{
|
||||||
|
form.btn_input_0.Click += RegisterInput;
|
||||||
|
form.btn_input_1.Click += RegisterInput;
|
||||||
|
form.btn_input_2.Click += RegisterInput;
|
||||||
|
form.btn_input_3.Click += RegisterInput;
|
||||||
|
form.btn_input_4.Click += RegisterInput;
|
||||||
|
form.btn_input_5.Click += RegisterInput;
|
||||||
|
form.btn_input_6.Click += RegisterInput;
|
||||||
|
form.btn_input_7.Click += RegisterInput;
|
||||||
|
form.btn_input_8.Click += RegisterInput;
|
||||||
|
form.btn_input_9.Click += RegisterInput;
|
||||||
|
|
||||||
|
form.btn_input_add.Click += SelectAdd;
|
||||||
|
form.btn_input_sub.Click += SelectSub;
|
||||||
|
form.btn_input_mult.Click += SelectMult;
|
||||||
|
form.btn_input_div.Click += SelectDiv;
|
||||||
|
|
||||||
|
form.btn_next.Click += Next;
|
||||||
|
form.btn_import_prev.Click += ImportPrevious;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static private void ShowOperators(bool value)
|
||||||
|
{
|
||||||
|
form.btn_input_add.Visible = value;
|
||||||
|
form.btn_input_sub.Visible = value;
|
||||||
|
form.btn_input_mult.Visible = value;
|
||||||
|
form.btn_input_div.Visible = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
static private void ShowNumbers(bool value)
|
||||||
|
{
|
||||||
|
form.btn_input_0.Visible = value;
|
||||||
|
form.btn_input_1.Visible = value;
|
||||||
|
form.btn_input_2.Visible = value;
|
||||||
|
form.btn_input_3.Visible = value;
|
||||||
|
form.btn_input_4.Visible = value;
|
||||||
|
form.btn_input_5.Visible = value;
|
||||||
|
form.btn_input_6.Visible = value;
|
||||||
|
form.btn_input_7.Visible = value;
|
||||||
|
form.btn_input_8.Visible = value;
|
||||||
|
form.btn_input_9.Visible = value;
|
||||||
|
form.btn_import_prev.Visible = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
static private void SelectAdd(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
OperatorSelected(Operator.Add);
|
||||||
|
}
|
||||||
|
static private void SelectSub(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
OperatorSelected(Operator.Sub);
|
||||||
|
}
|
||||||
|
static private void SelectMult(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
OperatorSelected(Operator.Mult);
|
||||||
|
}
|
||||||
|
static private void SelectDiv(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
OperatorSelected(Operator.Div);
|
||||||
|
}
|
||||||
|
|
||||||
|
static private void OperatorSelected(Operator operation)
|
||||||
|
{
|
||||||
|
form.lbl_main.Text = "Ange tal 1";
|
||||||
|
ShowOperators(false);
|
||||||
|
ShowNumbers(true);
|
||||||
|
selectedOperator = operation;
|
||||||
|
form.btn_next.Visible = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
static private void StartSelection()
|
||||||
|
{
|
||||||
|
ShowOperators(true);
|
||||||
|
isSecondNumber = false;
|
||||||
|
answerGiven = false;
|
||||||
|
form.lbl_main.Text = "V<>lj operation";
|
||||||
|
form.btn_import_prev.Enabled = hasStoredAnwser;
|
||||||
|
}
|
||||||
|
|
||||||
|
static private void RegisterInput(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (sender is Button b)
|
||||||
|
{
|
||||||
|
form.lbl_number.Text += b.Text;
|
||||||
|
form.btn_next.Visible = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static private void ImportPrevious(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
form.lbl_number.Text += lastAnswer.ToString();
|
||||||
|
form.btn_next.Visible = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static private void Next(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (answerGiven)
|
||||||
|
{
|
||||||
|
StartSelection();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isSecondNumber)
|
||||||
|
{
|
||||||
|
valueA = double.Parse(form.lbl_number.Text);
|
||||||
|
form.lbl_main.Text = "Ange tal 2";
|
||||||
|
isSecondNumber = true;
|
||||||
|
form.btn_next.Visible = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
valueB = double.Parse(form.lbl_number.Text);
|
||||||
|
Answer();
|
||||||
|
isSecondNumber = false;
|
||||||
|
}
|
||||||
|
form.lbl_number.Text = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
static private void Answer()
|
||||||
|
{
|
||||||
|
double value = 0;
|
||||||
|
|
||||||
|
ShowOperators(false);
|
||||||
|
ShowNumbers(false);
|
||||||
|
|
||||||
|
if (selectedOperator == Operator.Add)
|
||||||
|
value = valueA + valueB;
|
||||||
|
else if (selectedOperator == Operator.Sub)
|
||||||
|
value = valueA - valueB;
|
||||||
|
else if (selectedOperator == Operator.Mult)
|
||||||
|
value = valueA * valueB;
|
||||||
|
else if (selectedOperator == Operator.Div)
|
||||||
|
value = valueA / valueB;
|
||||||
|
|
||||||
|
hasStoredAnwser = true;
|
||||||
|
lastAnswer = value;
|
||||||
|
form.btn_import_prev.Text = "Importera f<>reg<65>ende svar" + " (" + value.ToString() + ")";
|
||||||
|
|
||||||
|
form.lbl_main.Text = "Ditt tal <20>r " + value.ToString();
|
||||||
|
answerGiven = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user