mirror of
https://github.com/Alvin-Zilverstand/ict-algemeen-opdrachten.git
synced 2026-03-06 11:06:59 +01:00
Initialize C# project for .NET 9.0 with basic calculator functionality
This commit is contained in:
@@ -3,15 +3,12 @@ using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
#region Bankrekening Class
|
||||
// Class representing a bank account
|
||||
class Bankrekening
|
||||
{
|
||||
public string Rekeningnummer { get; } // Account number
|
||||
private decimal saldo; // Account balance
|
||||
private List<Transactie> transacties; // List of transactions
|
||||
public string Rekeningnummer { get; }
|
||||
private decimal saldo;
|
||||
private List<Transactie> transacties;
|
||||
|
||||
// Constructor to initialize account number and starting balance
|
||||
public Bankrekening(string rekeningnummer, decimal beginsaldo)
|
||||
{
|
||||
Rekeningnummer = rekeningnummer;
|
||||
@@ -19,7 +16,6 @@ class Bankrekening
|
||||
transacties = new List<Transactie>();
|
||||
}
|
||||
|
||||
// Method to deposit money into the account with a description
|
||||
public void Storten(decimal bedrag, string beschrijving)
|
||||
{
|
||||
if (bedrag > 0)
|
||||
@@ -33,7 +29,6 @@ class Bankrekening
|
||||
}
|
||||
}
|
||||
|
||||
// Method to withdraw money from the account with a description
|
||||
public void Opnemen(decimal bedrag, string beschrijving)
|
||||
{
|
||||
if (bedrag > 0 && bedrag <= saldo)
|
||||
@@ -47,29 +42,23 @@ class Bankrekening
|
||||
}
|
||||
}
|
||||
|
||||
// Method to check the current balance
|
||||
public decimal ControleerSaldo()
|
||||
{
|
||||
return saldo;
|
||||
}
|
||||
|
||||
// Method to get the transaction history
|
||||
public List<Transactie> GetTransactieGeschiedenis()
|
||||
{
|
||||
return transacties;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Transactie Class
|
||||
// Class representing a transaction
|
||||
class Transactie
|
||||
{
|
||||
public decimal Bedrag { get; } // Transaction amount
|
||||
public string Beschrijving { get; } // Transaction description
|
||||
public DateTime Datum { get; } // Transaction date
|
||||
public decimal Bedrag { get; }
|
||||
public string Beschrijving { get; }
|
||||
public DateTime Datum { get; }
|
||||
|
||||
// Constructor to initialize transaction details
|
||||
public Transactie(decimal bedrag, string beschrijving)
|
||||
{
|
||||
Bedrag = bedrag;
|
||||
@@ -77,21 +66,17 @@ class Transactie
|
||||
Datum = DateTime.Now;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region MainForm Class
|
||||
// Main form for the application
|
||||
public class MainForm : Form
|
||||
{
|
||||
private Bankrekening mijnRekening; // Bank account instance
|
||||
private Label saldoLabel; // Label to display balance
|
||||
private TextBox bedragTextBox; // TextBox to input amount
|
||||
private TextBox beschrijvingTextBox; // TextBox to input transaction description
|
||||
private Button stortenButton; // Button to deposit money
|
||||
private Button opnemenButton; // Button to withdraw money
|
||||
private Button transactieGeschiedenisButton; // Button to view transaction history
|
||||
private Bankrekening mijnRekening;
|
||||
private Label saldoLabel;
|
||||
private TextBox bedragTextBox;
|
||||
private TextBox beschrijvingTextBox;
|
||||
private Button stortenButton;
|
||||
private Button opnemenButton;
|
||||
private Button transactieGeschiedenisButton;
|
||||
|
||||
// Constructor to initialize the form and its controls
|
||||
public MainForm()
|
||||
{
|
||||
mijnRekening = new Bankrekening("NL01BANK0123456789", 1000);
|
||||
@@ -116,7 +101,7 @@ public class MainForm : Form
|
||||
BackColor = Color.White,
|
||||
ForeColor = Color.Black,
|
||||
BorderStyle = BorderStyle.FixedSingle,
|
||||
PlaceholderText = "Aantal" // Placeholder text
|
||||
PlaceholderText = "Aantal"
|
||||
};
|
||||
beschrijvingTextBox = new TextBox()
|
||||
{
|
||||
@@ -127,7 +112,7 @@ public class MainForm : Form
|
||||
BackColor = Color.White,
|
||||
ForeColor = Color.Black,
|
||||
BorderStyle = BorderStyle.FixedSingle,
|
||||
PlaceholderText = "Beschrijving" // Placeholder text
|
||||
PlaceholderText = "Beschrijving"
|
||||
};
|
||||
stortenButton = new Button()
|
||||
{
|
||||
@@ -135,7 +120,7 @@ public class MainForm : Form
|
||||
Top = 140,
|
||||
Left = 20,
|
||||
Width = 260,
|
||||
Height = 50, // Adjusted height
|
||||
Height = 50,
|
||||
Font = new Font("Arial", 14),
|
||||
BackColor = Color.FromArgb(0, 123, 255),
|
||||
ForeColor = Color.White,
|
||||
@@ -147,9 +132,9 @@ public class MainForm : Form
|
||||
Top = 200,
|
||||
Left = 20,
|
||||
Width = 260,
|
||||
Height = 50, // Adjusted height
|
||||
BackColor = Color.FromArgb(0, 123, 255), // Lighter blue
|
||||
Font = new Font("Arial", 14, FontStyle.Bold), // Bold and larger font
|
||||
Height = 50,
|
||||
BackColor = Color.FromArgb(0, 123, 255),
|
||||
Font = new Font("Arial", 14, FontStyle.Bold),
|
||||
ForeColor = Color.White,
|
||||
FlatStyle = FlatStyle.Flat
|
||||
};
|
||||
@@ -159,22 +144,20 @@ public class MainForm : Form
|
||||
Top = 260,
|
||||
Left = 20,
|
||||
Width = 260,
|
||||
Height = 50, // Adjusted height
|
||||
Height = 50,
|
||||
Font = new Font("Arial", 14),
|
||||
BackColor = Color.FromArgb(108, 117, 125),
|
||||
ForeColor = Color.White,
|
||||
FlatStyle = FlatStyle.Flat
|
||||
};
|
||||
|
||||
// Event handlers for button clicks
|
||||
stortenButton.Click += StortenButton_Click;
|
||||
opnemenButton.Click += OpnemenButton_Click;
|
||||
transactieGeschiedenisButton.Click += TransactieGeschiedenisButton_Click;
|
||||
|
||||
// Add controls to the form
|
||||
Controls.Add(saldoLabel);
|
||||
Controls.Add(bedragTextBox);
|
||||
Controls.Add(beschrijvingTextBox); // Add the new TextBox to the form
|
||||
Controls.Add(beschrijvingTextBox);
|
||||
Controls.Add(stortenButton);
|
||||
Controls.Add(opnemenButton);
|
||||
Controls.Add(transactieGeschiedenisButton);
|
||||
@@ -185,7 +168,6 @@ public class MainForm : Form
|
||||
BackColor = Color.White;
|
||||
}
|
||||
|
||||
// Event handler for deposit button click
|
||||
private void StortenButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
@@ -201,7 +183,6 @@ public class MainForm : Form
|
||||
}
|
||||
}
|
||||
|
||||
// Event handler for withdraw button click
|
||||
private void OpnemenButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
@@ -217,7 +198,6 @@ public class MainForm : Form
|
||||
}
|
||||
}
|
||||
|
||||
// Event handler for transaction history button click
|
||||
private void TransactieGeschiedenisButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
var transactieGeschiedenis = mijnRekening.GetTransactieGeschiedenis();
|
||||
@@ -231,10 +211,7 @@ public class MainForm : Form
|
||||
MessageBox.Show(geschiedenis);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Program Class
|
||||
// Main program class
|
||||
class Program
|
||||
{
|
||||
static void Main()
|
||||
@@ -254,4 +231,3 @@ class Program
|
||||
Application.Run(new MainForm());
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
10
Csharp/Calc/Calc.csproj
Normal file
10
Csharp/Calc/Calc.csproj
Normal file
@@ -0,0 +1,10 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
47
Csharp/Calc/Program.cs
Normal file
47
Csharp/Calc/Program.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
using System;
|
||||
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Console.WriteLine("Enter the first number:");
|
||||
double num1 = Convert.ToDouble(Console.ReadLine());
|
||||
|
||||
Console.WriteLine("Enter an operator (+, -, *, /):");
|
||||
string op = Console.ReadLine();
|
||||
|
||||
Console.WriteLine("Enter the second number:");
|
||||
double num2 = Convert.ToDouble(Console.ReadLine());
|
||||
|
||||
double result = 0;
|
||||
|
||||
switch (op)
|
||||
{
|
||||
case "+":
|
||||
result = num1 + num2;
|
||||
break;
|
||||
case "-":
|
||||
result = num1 - num2;
|
||||
break;
|
||||
case "*":
|
||||
result = num1 * num2;
|
||||
break;
|
||||
case "/":
|
||||
if (num2 != 0)
|
||||
{
|
||||
result = num1 / num2;
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Cannot divide by zero.");
|
||||
return;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
Console.WriteLine("Invalid operator.");
|
||||
return;
|
||||
}
|
||||
|
||||
Console.WriteLine("The result is: " + result);
|
||||
}
|
||||
}
|
||||
23
Csharp/Calc/bin/Debug/net9.0/Calc.deps.json
Normal file
23
Csharp/Calc/bin/Debug/net9.0/Calc.deps.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"runtimeTarget": {
|
||||
"name": ".NETCoreApp,Version=v9.0",
|
||||
"signature": ""
|
||||
},
|
||||
"compilationOptions": {},
|
||||
"targets": {
|
||||
".NETCoreApp,Version=v9.0": {
|
||||
"Calc/1.0.0": {
|
||||
"runtime": {
|
||||
"Calc.dll": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"libraries": {
|
||||
"Calc/1.0.0": {
|
||||
"type": "project",
|
||||
"serviceable": false,
|
||||
"sha512": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
Csharp/Calc/bin/Debug/net9.0/Calc.dll
Normal file
BIN
Csharp/Calc/bin/Debug/net9.0/Calc.dll
Normal file
Binary file not shown.
BIN
Csharp/Calc/bin/Debug/net9.0/Calc.exe
Normal file
BIN
Csharp/Calc/bin/Debug/net9.0/Calc.exe
Normal file
Binary file not shown.
BIN
Csharp/Calc/bin/Debug/net9.0/Calc.pdb
Normal file
BIN
Csharp/Calc/bin/Debug/net9.0/Calc.pdb
Normal file
Binary file not shown.
12
Csharp/Calc/bin/Debug/net9.0/Calc.runtimeconfig.json
Normal file
12
Csharp/Calc/bin/Debug/net9.0/Calc.runtimeconfig.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"runtimeOptions": {
|
||||
"tfm": "net9.0",
|
||||
"framework": {
|
||||
"name": "Microsoft.NETCore.App",
|
||||
"version": "9.0.0"
|
||||
},
|
||||
"configProperties": {
|
||||
"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false
|
||||
}
|
||||
}
|
||||
}
|
||||
71
Csharp/Calc/obj/Calc.csproj.nuget.dgspec.json
Normal file
71
Csharp/Calc/obj/Calc.csproj.nuget.dgspec.json
Normal file
@@ -0,0 +1,71 @@
|
||||
{
|
||||
"format": 1,
|
||||
"restore": {
|
||||
"C:\\Users\\steen\\Desktop\\Alvin\\ict-algemeen-opdrachten\\Csharp\\Calc\\Calc.csproj": {}
|
||||
},
|
||||
"projects": {
|
||||
"C:\\Users\\steen\\Desktop\\Alvin\\ict-algemeen-opdrachten\\Csharp\\Calc\\Calc.csproj": {
|
||||
"version": "1.0.0",
|
||||
"restore": {
|
||||
"projectUniqueName": "C:\\Users\\steen\\Desktop\\Alvin\\ict-algemeen-opdrachten\\Csharp\\Calc\\Calc.csproj",
|
||||
"projectName": "Calc",
|
||||
"projectPath": "C:\\Users\\steen\\Desktop\\Alvin\\ict-algemeen-opdrachten\\Csharp\\Calc\\Calc.csproj",
|
||||
"packagesPath": "C:\\Users\\steen\\.nuget\\packages\\",
|
||||
"outputPath": "C:\\Users\\steen\\Desktop\\Alvin\\ict-algemeen-opdrachten\\Csharp\\Calc\\obj\\",
|
||||
"projectStyle": "PackageReference",
|
||||
"fallbackFolders": [
|
||||
"C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages"
|
||||
],
|
||||
"configFilePaths": [
|
||||
"C:\\Users\\steen\\AppData\\Roaming\\NuGet\\NuGet.Config",
|
||||
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.FallbackLocation.config"
|
||||
],
|
||||
"originalTargetFrameworks": [
|
||||
"net9.0"
|
||||
],
|
||||
"sources": {
|
||||
"https://api.nuget.org/v3/index.json": {}
|
||||
},
|
||||
"frameworks": {
|
||||
"net9.0": {
|
||||
"targetAlias": "net9.0",
|
||||
"projectReferences": {}
|
||||
}
|
||||
},
|
||||
"warningProperties": {
|
||||
"warnAsError": [
|
||||
"NU1605"
|
||||
]
|
||||
},
|
||||
"restoreAuditProperties": {
|
||||
"enableAudit": "true",
|
||||
"auditLevel": "low",
|
||||
"auditMode": "direct"
|
||||
},
|
||||
"SdkAnalysisLevel": "9.0.100"
|
||||
},
|
||||
"frameworks": {
|
||||
"net9.0": {
|
||||
"targetAlias": "net9.0",
|
||||
"imports": [
|
||||
"net461",
|
||||
"net462",
|
||||
"net47",
|
||||
"net471",
|
||||
"net472",
|
||||
"net48",
|
||||
"net481"
|
||||
],
|
||||
"assetTargetFallback": true,
|
||||
"warn": true,
|
||||
"frameworkReferences": {
|
||||
"Microsoft.NETCore.App": {
|
||||
"privateAssets": "all"
|
||||
}
|
||||
},
|
||||
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\9.0.102/PortableRuntimeIdentifierGraph.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
16
Csharp/Calc/obj/Calc.csproj.nuget.g.props
Normal file
16
Csharp/Calc/obj/Calc.csproj.nuget.g.props
Normal file
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
|
||||
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
|
||||
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
|
||||
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
|
||||
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\steen\.nuget\packages\;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages</NuGetPackageFolders>
|
||||
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
|
||||
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.12.2</NuGetToolVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||
<SourceRoot Include="C:\Users\steen\.nuget\packages\" />
|
||||
<SourceRoot Include="C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages\" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
2
Csharp/Calc/obj/Calc.csproj.nuget.g.targets
Normal file
2
Csharp/Calc/obj/Calc.csproj.nuget.g.targets
Normal file
@@ -0,0 +1,2 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" />
|
||||
@@ -0,0 +1,4 @@
|
||||
// <autogenerated />
|
||||
using System;
|
||||
using System.Reflection;
|
||||
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v9.0", FrameworkDisplayName = ".NET 9.0")]
|
||||
22
Csharp/Calc/obj/Debug/net9.0/Calc.AssemblyInfo.cs
Normal file
22
Csharp/Calc/obj/Debug/net9.0/Calc.AssemblyInfo.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Reflection;
|
||||
|
||||
[assembly: System.Reflection.AssemblyCompanyAttribute("Calc")]
|
||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+0115f24bd329294b808413765fcc763d93bc37e4")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("Calc")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("Calc")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
||||
// Generated by the MSBuild WriteCodeFragment class.
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
276b6d2fabd17a789d893766bd5f14d8a26bf2628a8f4edbd75b2e58615ec557
|
||||
@@ -0,0 +1,15 @@
|
||||
is_global = true
|
||||
build_property.TargetFramework = net9.0
|
||||
build_property.TargetPlatformMinVersion =
|
||||
build_property.UsingMicrosoftNETSdkWeb =
|
||||
build_property.ProjectTypeGuids =
|
||||
build_property.InvariantGlobalization =
|
||||
build_property.PlatformNeutralAssembly =
|
||||
build_property.EnforceExtendedAnalyzerRules =
|
||||
build_property._SupportedPlatformList = Linux,macOS,Windows
|
||||
build_property.RootNamespace = Calc
|
||||
build_property.ProjectDir = C:\Users\steen\Desktop\Alvin\ict-algemeen-opdrachten\Csharp\Calc\
|
||||
build_property.EnableComHosting =
|
||||
build_property.EnableGeneratedComInterfaceComImportInterop =
|
||||
build_property.EffectiveAnalysisLevelStyle = 9.0
|
||||
build_property.EnableCodeStyleSeverity =
|
||||
8
Csharp/Calc/obj/Debug/net9.0/Calc.GlobalUsings.g.cs
Normal file
8
Csharp/Calc/obj/Debug/net9.0/Calc.GlobalUsings.g.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
// <auto-generated/>
|
||||
global using global::System;
|
||||
global using global::System.Collections.Generic;
|
||||
global using global::System.IO;
|
||||
global using global::System.Linq;
|
||||
global using global::System.Net.Http;
|
||||
global using global::System.Threading;
|
||||
global using global::System.Threading.Tasks;
|
||||
BIN
Csharp/Calc/obj/Debug/net9.0/Calc.assets.cache
Normal file
BIN
Csharp/Calc/obj/Debug/net9.0/Calc.assets.cache
Normal file
Binary file not shown.
@@ -0,0 +1 @@
|
||||
21ebf20558f3a8283623941054716441fde654c370d1e96b36a0c9189e80a917
|
||||
@@ -0,0 +1,15 @@
|
||||
C:\Users\steen\Desktop\Alvin\ict-algemeen-opdrachten\Csharp\Calc\bin\Debug\net9.0\Calc.exe
|
||||
C:\Users\steen\Desktop\Alvin\ict-algemeen-opdrachten\Csharp\Calc\bin\Debug\net9.0\Calc.deps.json
|
||||
C:\Users\steen\Desktop\Alvin\ict-algemeen-opdrachten\Csharp\Calc\bin\Debug\net9.0\Calc.runtimeconfig.json
|
||||
C:\Users\steen\Desktop\Alvin\ict-algemeen-opdrachten\Csharp\Calc\bin\Debug\net9.0\Calc.dll
|
||||
C:\Users\steen\Desktop\Alvin\ict-algemeen-opdrachten\Csharp\Calc\bin\Debug\net9.0\Calc.pdb
|
||||
C:\Users\steen\Desktop\Alvin\ict-algemeen-opdrachten\Csharp\Calc\obj\Debug\net9.0\Calc.GeneratedMSBuildEditorConfig.editorconfig
|
||||
C:\Users\steen\Desktop\Alvin\ict-algemeen-opdrachten\Csharp\Calc\obj\Debug\net9.0\Calc.AssemblyInfoInputs.cache
|
||||
C:\Users\steen\Desktop\Alvin\ict-algemeen-opdrachten\Csharp\Calc\obj\Debug\net9.0\Calc.AssemblyInfo.cs
|
||||
C:\Users\steen\Desktop\Alvin\ict-algemeen-opdrachten\Csharp\Calc\obj\Debug\net9.0\Calc.csproj.CoreCompileInputs.cache
|
||||
C:\Users\steen\Desktop\Alvin\ict-algemeen-opdrachten\Csharp\Calc\obj\Debug\net9.0\Calc.sourcelink.json
|
||||
C:\Users\steen\Desktop\Alvin\ict-algemeen-opdrachten\Csharp\Calc\obj\Debug\net9.0\Calc.dll
|
||||
C:\Users\steen\Desktop\Alvin\ict-algemeen-opdrachten\Csharp\Calc\obj\Debug\net9.0\refint\Calc.dll
|
||||
C:\Users\steen\Desktop\Alvin\ict-algemeen-opdrachten\Csharp\Calc\obj\Debug\net9.0\Calc.pdb
|
||||
C:\Users\steen\Desktop\Alvin\ict-algemeen-opdrachten\Csharp\Calc\obj\Debug\net9.0\Calc.genruntimeconfig.cache
|
||||
C:\Users\steen\Desktop\Alvin\ict-algemeen-opdrachten\Csharp\Calc\obj\Debug\net9.0\ref\Calc.dll
|
||||
BIN
Csharp/Calc/obj/Debug/net9.0/Calc.dll
Normal file
BIN
Csharp/Calc/obj/Debug/net9.0/Calc.dll
Normal file
Binary file not shown.
1
Csharp/Calc/obj/Debug/net9.0/Calc.genruntimeconfig.cache
Normal file
1
Csharp/Calc/obj/Debug/net9.0/Calc.genruntimeconfig.cache
Normal file
@@ -0,0 +1 @@
|
||||
82eecd7a73df33983d8541ae507d20861bfad7cf0473104c027e197a87f8fb70
|
||||
BIN
Csharp/Calc/obj/Debug/net9.0/Calc.pdb
Normal file
BIN
Csharp/Calc/obj/Debug/net9.0/Calc.pdb
Normal file
Binary file not shown.
1
Csharp/Calc/obj/Debug/net9.0/Calc.sourcelink.json
Normal file
1
Csharp/Calc/obj/Debug/net9.0/Calc.sourcelink.json
Normal file
@@ -0,0 +1 @@
|
||||
{"documents":{"C:\\Users\\steen\\Desktop\\Alvin\\ict-algemeen-opdrachten\\*":"https://raw.githubusercontent.com/Alvin-Zilverstand/ict-algemeen-opdrachten/0115f24bd329294b808413765fcc763d93bc37e4/*"}}
|
||||
BIN
Csharp/Calc/obj/Debug/net9.0/apphost.exe
Normal file
BIN
Csharp/Calc/obj/Debug/net9.0/apphost.exe
Normal file
Binary file not shown.
BIN
Csharp/Calc/obj/Debug/net9.0/ref/Calc.dll
Normal file
BIN
Csharp/Calc/obj/Debug/net9.0/ref/Calc.dll
Normal file
Binary file not shown.
BIN
Csharp/Calc/obj/Debug/net9.0/refint/Calc.dll
Normal file
BIN
Csharp/Calc/obj/Debug/net9.0/refint/Calc.dll
Normal file
Binary file not shown.
77
Csharp/Calc/obj/project.assets.json
Normal file
77
Csharp/Calc/obj/project.assets.json
Normal file
@@ -0,0 +1,77 @@
|
||||
{
|
||||
"version": 3,
|
||||
"targets": {
|
||||
"net9.0": {}
|
||||
},
|
||||
"libraries": {},
|
||||
"projectFileDependencyGroups": {
|
||||
"net9.0": []
|
||||
},
|
||||
"packageFolders": {
|
||||
"C:\\Users\\steen\\.nuget\\packages\\": {},
|
||||
"C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages": {}
|
||||
},
|
||||
"project": {
|
||||
"version": "1.0.0",
|
||||
"restore": {
|
||||
"projectUniqueName": "C:\\Users\\steen\\Desktop\\Alvin\\ict-algemeen-opdrachten\\Csharp\\Calc\\Calc.csproj",
|
||||
"projectName": "Calc",
|
||||
"projectPath": "C:\\Users\\steen\\Desktop\\Alvin\\ict-algemeen-opdrachten\\Csharp\\Calc\\Calc.csproj",
|
||||
"packagesPath": "C:\\Users\\steen\\.nuget\\packages\\",
|
||||
"outputPath": "C:\\Users\\steen\\Desktop\\Alvin\\ict-algemeen-opdrachten\\Csharp\\Calc\\obj\\",
|
||||
"projectStyle": "PackageReference",
|
||||
"fallbackFolders": [
|
||||
"C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages"
|
||||
],
|
||||
"configFilePaths": [
|
||||
"C:\\Users\\steen\\AppData\\Roaming\\NuGet\\NuGet.Config",
|
||||
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.FallbackLocation.config"
|
||||
],
|
||||
"originalTargetFrameworks": [
|
||||
"net9.0"
|
||||
],
|
||||
"sources": {
|
||||
"https://api.nuget.org/v3/index.json": {}
|
||||
},
|
||||
"frameworks": {
|
||||
"net9.0": {
|
||||
"targetAlias": "net9.0",
|
||||
"projectReferences": {}
|
||||
}
|
||||
},
|
||||
"warningProperties": {
|
||||
"warnAsError": [
|
||||
"NU1605"
|
||||
]
|
||||
},
|
||||
"restoreAuditProperties": {
|
||||
"enableAudit": "true",
|
||||
"auditLevel": "low",
|
||||
"auditMode": "direct"
|
||||
},
|
||||
"SdkAnalysisLevel": "9.0.100"
|
||||
},
|
||||
"frameworks": {
|
||||
"net9.0": {
|
||||
"targetAlias": "net9.0",
|
||||
"imports": [
|
||||
"net461",
|
||||
"net462",
|
||||
"net47",
|
||||
"net471",
|
||||
"net472",
|
||||
"net48",
|
||||
"net481"
|
||||
],
|
||||
"assetTargetFallback": true,
|
||||
"warn": true,
|
||||
"frameworkReferences": {
|
||||
"Microsoft.NETCore.App": {
|
||||
"privateAssets": "all"
|
||||
}
|
||||
},
|
||||
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\9.0.102/PortableRuntimeIdentifierGraph.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
8
Csharp/Calc/obj/project.nuget.cache
Normal file
8
Csharp/Calc/obj/project.nuget.cache
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"version": 2,
|
||||
"dgSpecHash": "9F8x5AdxozU=",
|
||||
"success": true,
|
||||
"projectFilePath": "C:\\Users\\steen\\Desktop\\Alvin\\ict-algemeen-opdrachten\\Csharp\\Calc\\Calc.csproj",
|
||||
"expectedPackageFiles": [],
|
||||
"logs": []
|
||||
}
|
||||
@@ -16,39 +16,31 @@ class Program : Form
|
||||
|
||||
public Program()
|
||||
{
|
||||
// Initialize the random number to guess
|
||||
numberToGuess = random.Next(1, 101);
|
||||
|
||||
// Set up the form
|
||||
this.Text = "Gokspel";
|
||||
this.Size = new System.Drawing.Size(300, 200);
|
||||
|
||||
// Create and add the prompt label
|
||||
Label promptLabel = new Label();
|
||||
promptLabel.Text = "Raad het getal tussen 1 en 100:";
|
||||
promptLabel.Location = new System.Drawing.Point(10, 20);
|
||||
promptLabel.AutoSize = true;
|
||||
this.Controls.Add(promptLabel);
|
||||
|
||||
// Create and add the input box
|
||||
inputBox = new TextBox();
|
||||
inputBox.Location = new System.Drawing.Point(10, 50);
|
||||
this.Controls.Add(inputBox);
|
||||
|
||||
// Create and add the guess button
|
||||
guessButton = new Button();
|
||||
guessButton.Text = "Gok";
|
||||
guessButton.Location = new System.Drawing.Point(10, 80);
|
||||
guessButton.Click += new EventHandler(GuessButton_Click);
|
||||
this.Controls.Add(guessButton);
|
||||
|
||||
// Create and add the result label
|
||||
resultLabel = new Label();
|
||||
resultLabel.Location = new System.Drawing.Point(10, 110);
|
||||
resultLabel.AutoSize = true;
|
||||
this.Controls.Add(resultLabel);
|
||||
|
||||
// Create and add the restart button (initially hidden)
|
||||
restartButton = new Button();
|
||||
restartButton.Text = "Opnieuw";
|
||||
restartButton.Location = new System.Drawing.Point(10, 140);
|
||||
@@ -56,7 +48,6 @@ class Program : Form
|
||||
restartButton.Visible = false;
|
||||
this.Controls.Add(restartButton);
|
||||
|
||||
// Set up the confetti timer
|
||||
confettiTimer = new System.Windows.Forms.Timer();
|
||||
confettiTimer.Interval = 30;
|
||||
confettiTimer.Tick += new EventHandler(ConfettiTimer_Tick);
|
||||
@@ -79,7 +70,7 @@ class Program : Form
|
||||
{
|
||||
resultLabel.Text = "Gefeliciteerd! Je hebt het juiste getal geraden.";
|
||||
StartConfetti();
|
||||
restartButton.Visible = true; // Show the restart button
|
||||
restartButton.Visible = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -90,19 +81,17 @@ class Program : Form
|
||||
|
||||
private void RestartButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
// Reset the game
|
||||
numberToGuess = random.Next(1, 101);
|
||||
resultLabel.Text = "";
|
||||
inputBox.Text = "";
|
||||
confettiList.Clear();
|
||||
confettiTimer.Stop();
|
||||
restartButton.Visible = false; // Hide the restart button
|
||||
restartButton.Visible = false;
|
||||
this.Invalidate();
|
||||
}
|
||||
|
||||
private void StartConfetti()
|
||||
{
|
||||
// Initialize confetti
|
||||
confettiList.Clear();
|
||||
for (int i = 0; i < 100; i++)
|
||||
{
|
||||
@@ -113,7 +102,6 @@ class Program : Form
|
||||
|
||||
private void ConfettiTimer_Tick(object sender, EventArgs e)
|
||||
{
|
||||
// Update confetti positions
|
||||
for (int i = 0; i < confettiList.Count; i++)
|
||||
{
|
||||
confettiList[i].Update();
|
||||
@@ -124,7 +112,6 @@ class Program : Form
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
base.OnPaint(e);
|
||||
// Draw confetti
|
||||
foreach (var confetti in confettiList)
|
||||
{
|
||||
e.Graphics.FillEllipse(new SolidBrush(confetti.Color), confetti.Position.X, confetti.Position.Y, confetti.Size, confetti.Size);
|
||||
@@ -149,7 +136,6 @@ class Confetti
|
||||
|
||||
public Confetti(Random random, Size clientSize)
|
||||
{
|
||||
// Initialize confetti properties
|
||||
Position = new PointF(random.Next(clientSize.Width), random.Next(clientSize.Height));
|
||||
SpeedY = (float)(random.NextDouble() * 2 + 1);
|
||||
SpeedX = (float)(random.NextDouble() * 2 - 1);
|
||||
@@ -159,8 +145,7 @@ class Confetti
|
||||
|
||||
public void Update()
|
||||
{
|
||||
// Update confetti position and apply gravity
|
||||
Position = new PointF(Position.X + SpeedX, Position.Y + SpeedY);
|
||||
SpeedY += 0.1f; // gravity effect
|
||||
SpeedY += 0.1f;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user