Skip to content

Commit

Permalink
added main screen and linked raven tor to its own page
Browse files Browse the repository at this point in the history
  • Loading branch information
farthingt committed Apr 3, 2024
1 parent 821a742 commit c9d2d02
Show file tree
Hide file tree
Showing 13 changed files with 190 additions and 28 deletions.
27 changes: 27 additions & 0 deletions WebAppCW/CreateAccountPage.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="WebAppCW.CreateAccountPage"
Title="Account Creation">
<VerticalStackLayout
Padding="30,0"
Spacing="25">
<Entry
x:Name="UsernameEntry"
Placeholder="Username"/>
<Entry
x:Name="PasswordEntry1"
Placeholder="Password" IsPassword="True"/>
<Entry
x:Name="PasswordEntry2"
Placeholder="Confirm Password" IsPassword="True"/>
<Entry
x:Name="EmailEntry"
Placeholder="Email Address"/>
<Button
Text="Create Account"
Clicked="OnCreateAccountButtonClicked"/>
<Label
x:Name="CreateAccountStatusLabel"/>
</VerticalStackLayout>
</ContentPage>
72 changes: 72 additions & 0 deletions WebAppCW/CreateAccountPage.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
namespace WebAppCW;

public partial class CreateAccountPage : ContentPage
{
public CreateAccountPage()
{
InitializeComponent();
}

private void OnCreateAccountButtonClicked(object sender, EventArgs e)
{
string username = UsernameEntry.Text;
string password1 = PasswordEntry1.Text;
string password2 = PasswordEntry2.Text;
string email = EmailEntry.Text;

if (string.IsNullOrWhiteSpace(username) || string.IsNullOrWhiteSpace(password1)
|| string.IsNullOrWhiteSpace(password2) || string.IsNullOrWhiteSpace(email))
{
CreateAccountStatusLabel.Text = "Please ensure all fields are filled";
return;
}

bool isUsernameAvailable = checkUsernameAvailability(username);

if (!isUsernameAvailable)
{
CreateAccountStatusLabel.Text = "Username is already taken. Please choose another";
return;
}

bool isPasswordSame = checkPasswordValidity(password1, password2);

if (!isPasswordSame)
{
CreateAccountStatusLabel.Text = "Passwords do not match up. Please ensure both " +
"the password and the password confirmation are the same";
return;
}

bool isAccountCreated = createAccount(username, password1, email);

if (isAccountCreated)
{
Navigation.PushAsync(new MainPage());
}
else
{
CreateAccountStatusLabel.Text = "Failed to create account";
return;
}
}

private bool checkUsernameAvailability(string username)
{
return true;
}

private bool checkPasswordValidity(string password1, string password2)
{
if (password1 == password2)
{
return true;
}
return false;
}

private bool createAccount(string username, string password, string email)
{
return true;
}
}
7 changes: 6 additions & 1 deletion WebAppCW/LoginPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="WebAppCW.LoginPage"
Title="LoginPage">
Title="Login">
<VerticalStackLayout
Padding="30,0"
Spacing="25">
Expand All @@ -17,5 +17,10 @@
Clicked="OnLoginButtonClicked"/>
<Label
x:Name="LoginStatusLabel"/>
<Label
Text="Don't have an account?"/>
<Button
Text="Click Here"
Clicked="OnCreateAccountButtonClicked"/>
</VerticalStackLayout>
</ContentPage>
4 changes: 4 additions & 0 deletions WebAppCW/LoginPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,8 @@ private bool AuthenticateUser(string username, string password)
return false;
}
}
private void OnCreateAccountButtonClicked(object sender, EventArgs e)
{
Navigation.PushAsync(new CreateAccountPage());
}
}
43 changes: 24 additions & 19 deletions WebAppCW/MainPage.xaml
Original file line number Diff line number Diff line change
@@ -1,34 +1,39 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="WebAppCW.MainPage">
x:Class="WebAppCW.MainPage"
Title="UK Bouldering">

<ScrollView>
<VerticalStackLayout
Padding="30,0"
Spacing="25">
<Image
Source="dotnet_bot.png"
Source="raven_tor_img"
HeightRequest="185"
Aspect="AspectFit"
SemanticProperties.Description="dot net bot in a race car number eight" />

<Label
Text="Hello, World!"
Style="{StaticResource Headline}"
SemanticProperties.HeadingLevel="Level1" />

<Label
Text="Welcome to &#10;.NET Multi-platform App UI"
Style="{StaticResource SubHeadline}"
SemanticProperties.HeadingLevel="Level2"
SemanticProperties.Description="Welcome to dot net Multi platform App U I" />

SemanticProperties.Description="Raven Tor cave" />
<Button
Text="Raven Tor"
Clicked="OnRavenClicked"
HorizontalOptions="Fill" />
<Image
Source="biblins_cave_img"
HeightRequest="185"
Aspect="AspectFit"
SemanticProperties.Description="Raven Tor cave" />
<Button
Text="Biblins Cave"
Clicked="OnBiblinsClicked"
HorizontalOptions="Fill" />
<Image
Source="stanage_plantation_img"
HeightRequest="185"
Aspect="AspectFit"
SemanticProperties.Description="Raven Tor cave" />
<Button
x:Name="CounterBtn"
Text="Click me"
SemanticProperties.Hint="Counts the number of times you click"
Clicked="OnCounterClicked"
Text="Stanage Plantation"
Clicked="OnStanageClicked"
HorizontalOptions="Fill" />
</VerticalStackLayout>
</ScrollView>
Expand Down
17 changes: 10 additions & 7 deletions WebAppCW/MainPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,19 @@ public MainPage()
InitializeComponent();
}

private void OnCounterClicked(object sender, EventArgs e)
private void OnRavenClicked(object sender, EventArgs e)
{
count+=1;
Navigation.PushAsync(new RavenTorPage());
}

if (count == 1)
CounterBtn.Text = $"Clicked {count} time";
else
CounterBtn.Text = $"Clicked {count} times";
private void OnBiblinsClicked(object sender, EventArgs e)
{
return;
}

SemanticScreenReader.Announce(CounterBtn.Text);
private void OnStanageClicked(object sender, EventArgs e)
{
return;
}
}

Expand Down
31 changes: 31 additions & 0 deletions WebAppCW/RavenTorPage.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="WebAppCW.RavenTorPage"
Title="RavenTor">
<VerticalStackLayout>
<Image
Source="raven_tor_img"
HeightRequest="185"
Aspect="AspectFit"
SemanticProperties.Description="Raven Tor cave" />
<Label
Text="Climbs:
Ben's Roof - 7C: Cross the cave from sitting
at the back right-hand corner, with left hand
on a big hold and right hand on a pinch to
finish as for Too Hard for Mark Leach.

Weedkiller Traverse - 7A+: This classic
testpiece traverses the line of weakness
across the first overlap. Start on the small
pillar on incut jugs and swing across finishing
up Chimes Start.

Belly of the Beast - 8B: The full line of the
cave, link the start of Ben's Roof Extension
Start into Keen Roof."
VerticalOptions="Center"
HorizontalOptions="Center" />
</VerticalStackLayout>
</ContentPage>
9 changes: 9 additions & 0 deletions WebAppCW/RavenTorPage.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace WebAppCW;

public partial class RavenTorPage : ContentPage
{
public RavenTorPage()
{
InitializeComponent();
}
}
Binary file added WebAppCW/Resources/Images/biblins_cave_img.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added WebAppCW/Resources/Images/raven_tor_img.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion WebAppCW/Resources/Styles/Colors.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<!-- Note: For Android please see also Platforms\Android\Resources\values\colors.xml -->

<Color x:Key="Primary">#512BD4</Color>
<Color x:Key="Primary">#003300</Color>
<Color x:Key="PrimaryDark">#ac99ea</Color>
<Color x:Key="PrimaryDarkText">#242424</Color>
<Color x:Key="Secondary">#DFD8F7</Color>
Expand Down
6 changes: 6 additions & 0 deletions WebAppCW/WebAppCW.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,15 @@
</ItemGroup>

<ItemGroup>
<MauiXaml Update="CreateAccountPage.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="LoginPage.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="RavenTorPage.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
</ItemGroup>

</Project>

0 comments on commit c9d2d02

Please sign in to comment.