Skip to content

Commit

Permalink
Add CreateForm
Browse files Browse the repository at this point in the history
  • Loading branch information
juleswhi committed Mar 20, 2024
1 parent 72c6b41 commit dbca39b
Show file tree
Hide file tree
Showing 63 changed files with 1,267 additions and 106 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
16 changes: 16 additions & 0 deletions examples/CreatingUser/CreatingUser.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net7.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
<LangVersion>preview</LangVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="SSDCourseworkTooling" Version="1.0.1-alpha1" />
</ItemGroup>

</Project>
11 changes: 11 additions & 0 deletions examples/CreatingUser/CreatingUser.csproj.user
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Compile Update="formLogin.cs">
<SubType>Form</SubType>
</Compile>
<Compile Update="formMenu.cs">
<SubType>Form</SubType>
</Compile>
</ItemGroup>
</Project>
25 changes: 25 additions & 0 deletions examples/CreatingUser/CreatingUser.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.7.34024.191
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CreatingUser", "CreatingUser.csproj", "{3E8D6BED-1EF6-4DC6-BCC6-419A30A45CCC}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{3E8D6BED-1EF6-4DC6-BCC6-419A30A45CCC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3E8D6BED-1EF6-4DC6-BCC6-419A30A45CCC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3E8D6BED-1EF6-4DC6-BCC6-419A30A45CCC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3E8D6BED-1EF6-4DC6-BCC6-419A30A45CCC}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {14667289-F38E-4788-92A4-6E362DD8FA72}
EndGlobalSection
EndGlobal
8 changes: 8 additions & 0 deletions examples/CreatingUser/Globals.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
global using State = System.Collections.Generic.Dictionary<System.Collections.Generic.IEnumerable<StateSystem.StateType>, object?>;
global using Password = (string Hashed, byte[] Salt);
global using FormSystem;
global using static FormSystem.FormManager;
global using StateSystem;
global using static StateSystem.StateType;
global using static StateSystem.StateHelper;
global using UserSystem;
16 changes: 16 additions & 0 deletions examples/CreatingUser/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
namespace CreatingUser;

internal static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
// To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize();
FormManager.Start<formLogin>();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"runtimeTarget": {
"name": ".NETCoreApp,Version=v7.0",
"signature": ""
},
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v7.0": {
"CreatingUser/1.0.0": {
"dependencies": {
"SSDCourseworkTooling": "1.0.1-alpha1"
},
"runtime": {
"CreatingUser.dll": {}
}
},
"Newtonsoft.Json/13.0.3": {
"runtime": {
"lib/net6.0/Newtonsoft.Json.dll": {
"assemblyVersion": "13.0.0.0",
"fileVersion": "13.0.3.27908"
}
}
},
"SSDCourseworkTooling/1.0.1-alpha1": {
"dependencies": {
"Newtonsoft.Json": "13.0.3"
},
"runtime": {
"lib/net7.0-windows7.0/SSDCourseworkTooling.dll": {
"assemblyVersion": "1.0.1.0",
"fileVersion": "1.0.1.0"
}
}
}
}
},
"libraries": {
"CreatingUser/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
},
"Newtonsoft.Json/13.0.3": {
"type": "package",
"serviceable": true,
"sha512": "sha512-HrC5BXdl00IP9zeV+0Z848QWPAoCr9P3bDEZguI+gkLcBKAOxix/tLEAAHC+UvDNPv4a2d18lOReHMOagPa+zQ==",
"path": "newtonsoft.json/13.0.3",
"hashPath": "newtonsoft.json.13.0.3.nupkg.sha512"
},
"SSDCourseworkTooling/1.0.1-alpha1": {
"type": "package",
"serviceable": true,
"sha512": "sha512-rdZMtnUQNz1b3GFt9JV+gBirxU0bZttlo2t9Bp4IOxuRc4oIrCAv0H92gTt8LB5qbIaUZ1JIBrWl79hTzjfOtQ==",
"path": "ssdcourseworktooling/1.0.1-alpha1",
"hashPath": "ssdcourseworktooling.1.0.1-alpha1.nupkg.sha512"
}
}
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"runtimeOptions": {
"tfm": "net7.0",
"frameworks": [
{
"name": "Microsoft.NETCore.App",
"version": "7.0.0"
},
{
"name": "Microsoft.WindowsDesktop.App",
"version": "7.0.0"
}
]
}
}
Binary file not shown.
Binary file not shown.
99 changes: 99 additions & 0 deletions examples/CreatingUser/formLogin.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 35 additions & 0 deletions examples/CreatingUser/formLogin.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
namespace CreatingUser;

public partial class formLogin : Form
{
private const string _correctUsername = "user";
private const string _correctPassword = "password";
public formLogin()
{
InitializeComponent();
lblDetailsIncorrect.Hide();
}

private void btnRegister_Click(object sender, EventArgs e)
{
string username = txtBoxUsername.Text;
string password = txtBoxPassword.Text;

if (username != _correctUsername)
{
lblDetailsIncorrect.Show();
return;
}

if(password != _correctPassword)
{
lblDetailsIncorrect.Show();
return;
}

// User is added to global state automatically
var _ = User.From(username, password);

Trigger<formMenu>();
}
}
Loading

0 comments on commit dbca39b

Please sign in to comment.