Skip to content
Permalink
Browse files
Main Page almost done
  • Loading branch information
efstathioa committed Nov 19, 2020
1 parent e370d35 commit c49e60a976d339322bbb5e9af63765fb4183761c
Show file tree
Hide file tree
Showing 12 changed files with 92 additions and 41 deletions.
@@ -92,13 +92,19 @@
<AndroidResource Include="Resources\mipmap-xxxhdpi\launcher_foreground.png" />
</ItemGroup>
<ItemGroup>
<Folder Include="Resources\drawable\" />
<AndroidResource Include="Resources\drawable\HomeButton1.png" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Coursework1\Coursework1.csproj">
<Project>{02076B0E-4B67-446C-B1D2-B810BF99CE1C}</Project>
<Name>Coursework1</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable\HomeButton.png" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable\logOut.png" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
</Project>

Some generated files are not rendered by default. Learn more.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -11,7 +11,7 @@ namespace Coursework1
{
InitializeComponent();

MainPage = new RegisterPage();
MainPage = new LogInPage();
}

protected override void OnStart()
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Coursework1.Views.LogInPage">
<ContentPage.Content>
@@ -13,10 +13,12 @@
<RowDefinition/>
</Grid.RowDefinitions>


<Entry Placeholder="Username" x:Name="EntryUsername" Grid.Row="0"/>
<Entry Placeholder="Passwrod" x:Name="EntryPassword" Grid.Row="1"/>
<Button Text="Log In" Grid.Row="2" BackgroundColor="Blue" TextColor="White" Clicked="Button_Clicked_1"/>
<Button Text="SignUp" Grid.Row="3" BackgroundColor="Blue" TextColor="White" Clicked="Button_Clicked"/>
<Entry Placeholder="Passwrod" IsPassword="True" x:Name="EntryPassword" Grid.Row="1"/>
<Button Text="Log In" Grid.Row="2" HorizontalOptions="CenterAndExpand" WidthRequest="100" BackgroundColor="Purple" TextColor="White" Clicked="Button_Clicked_1"/>
<Button Text="SignUp" Grid.Row="3" HorizontalOptions="CenterAndExpand" WidthRequest="100" BackgroundColor="Purple" TextColor="White" Clicked="Button_Clicked"/>


</Grid>
</StackLayout>
@@ -43,7 +43,6 @@ namespace Coursework1.Views
var result = await this.DisplayAlert("Log In Failed", "Check both Username and Password", "Okay", "Cancel");
if (result)
await Navigation.PushModalAsync(new LogInPage());

});
}

@@ -1,12 +1,14 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
<ContentPage BackgroundColor="White" xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Coursework1.Views.MainPage">


<ContentPage.Content>
<StackLayout>
<Label Text="Welcome to Xamarin.Forms!"
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand" />
</StackLayout>
<ScrollView>
<StackLayout>
<Button Text="Log out" VerticalOptions="EndAndExpand" TextColor="White" BackgroundColor="Purple" Clicked="Button_Clicked"/>
</StackLayout>
</ScrollView>
</ContentPage.Content>
</ContentPage>
@@ -16,5 +16,16 @@ namespace Coursework1.Views
{
InitializeComponent();
}

void Button_Clicked(object sender, EventArgs e)
{
Navigation.PushModalAsync(new LogInPage());
}

private void ImageButton_Clicked(object sender, EventArgs e)
{
Navigation.PushModalAsync(new MainPage());
}

}
}
@@ -11,6 +11,7 @@
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>

<StackLayout Grid.Row="0">
@@ -23,7 +24,10 @@
<Entry Placeholder="Email" FontSize="16" x:Name ="EntryEmail"/>
</StackLayout>
<StackLayout Grid.Row="3">
<Button Text="Register" HorizontalOptions="CenterAndExpand" WidthRequest="100" TextColor="White" BackgroundColor="Blue" Clicked="Button_Clicked"/>
<Button Text="Register" HorizontalOptions="CenterAndExpand" WidthRequest="100" TextColor="White" BackgroundColor="Purple" Clicked="Button_Clicked"/>
</StackLayout>
<StackLayout Grid.Row="4">
<Button Text="Already have an account? Login" HorizontalOptions="CenterAndExpand" WidthRequest="100" TextColor="White" BackgroundColor="Purple" Clicked="Button_Clicked_1"/>
</StackLayout>

</Grid>
@@ -32,18 +32,36 @@ namespace Coursework1.Views
Username = EntryUsername.Text,
Password = EntryPassword.Text,
Email = EntryEmail.Text

};

db.Insert(item);
Device.BeginInvokeOnMainThread(async () =>

if (EntryUsername.Text.Equals(null) || EntryPassword.Text.Equals(null) || EntryEmail.Text.Equals(null))
{
var result = await this.DisplayAlert("Registration Succesful", "Press okay to go to log in page", "Okay", "Cancel");
if (result)
await Navigation.PushModalAsync(new LogInPage());
});
Device.BeginInvokeOnMainThread(async () =>
{
var output = await this.DisplayAlert("Please fill all the fields", "Registration failed", "Okay", "Cancel");
if (output)
await Navigation.PushModalAsync(new RegisterPage());
});
}
else
{

Device.BeginInvokeOnMainThread(async () =>
{
var result = await this.DisplayAlert("Registration Succesful", "Press okay to go to log in page", "Okay", "Cancel");
if (result)
await Navigation.PushModalAsync(new LogInPage());
});

}



}
void Button_Clicked_1(object sender, EventArgs e)
{
App.Current.MainPage = new NavigationPage(new LogInPage());
}
}
}

0 comments on commit c49e60a

Please sign in to comment.