Initial commit

This commit is contained in:
Ray committed 2021-07-13 14:57:44 +01:00
commit c866bd7b5e
60 files changed
+21902

No files matched your search

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<ContentView xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="MobileApp1.Views.CompanyHeaderView">
<ContentView.Content>
<!--<Label
Text="XYZ Corporation"
FontAttributes="Bold"
FontSize="Large"
HorizontalOptions="Center"
Padding="0, 40, 0, 40" />-->
<Image Source="company_logo.png" WidthRequest="{OnPlatform iOS=240, Android=240}" HorizontalOptions="Center" Margin="0, 20, 0, 40" />
</ContentView.Content>
</ContentView>
@@ -0,0 +1,16 @@
using System.Reflection;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace MobileApp1.Views
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class CompanyHeaderView : ContentView
{
public CompanyHeaderView()
{
InitializeComponent();
}
}
}
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<ContentView xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="MobileApp1.Views.LoadingIndicatorView">
<ContentView.Content>
<StackLayout>
<ActivityIndicator x:Name="activityIndicator1" Margin="0, 0, 0, 0" />
<Label x:Name="label1" Text="" HorizontalTextAlignment="Center" Margin="0, 10, 0, 0" TextColor="{StaticResource Danger}" />
</StackLayout>
</ContentView.Content>
</ContentView>
@@ -0,0 +1,47 @@
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace MobileApp1.Views
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class LoadingIndicatorView : ContentView
{
public LoadingIndicatorView()
{
InitializeComponent();
}
public string Message
{
get => label1.Text;
set
{
Device.BeginInvokeOnMainThread(() =>
{
label1.Text = value;
});
}
}
public bool IsRunning
{
get => activityIndicator1.IsRunning;
set
{
Device.BeginInvokeOnMainThread(() =>
{
activityIndicator1.IsVisible = value;
activityIndicator1.IsRunning = value;
if (value)
{
label1.Text = string.Empty;
}
});
}
}
}
}
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<ContentView xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="MobileApp1.Views.AboutView">
<ContentView.Content>
<StackLayout HorizontalOptions="Fill">
<ScrollView>
<StackLayout>
<Label Text="More information about stuff." Margin="0, 0, 0, 20" FontSize="Body" />
<Label Text="This app" FontSize="Body" />
<Label Text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam." />
<Label Text="" Margin="0, 0, 0, 10" x:Name="label1" />
<Label Text="This corporation" FontSize="Body" />
<Label Text="Sed nisi. Nulla quis sem at nibh elementum imperdiet. Duis sagittis ipsum. Praesent mauris. Fusce nec tellus sed augue semper porta. Mauris massa. Vestibulum lacinia arcu eget nulla. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Curabitur sodales ligula in libero." Margin="0, 0, 0, 10" />
<Label Text="Legal stuff" FontSize="Body" />
<Label Text="Sed dignissim lacinia nunc. Curabitur tortor. Pellentesque nibh. Aenean quam. In scelerisque sem at dolor. Maecenas mattis. Sed convallis tristique sem. Proin ut ligula vel nunc egestas porttitor. Morbi lectus risus, iaculis vel, suscipit quis, luctus non, massa. Fusce ac turpis quis ligula lacinia aliquet. Mauris ipsum. Nulla metus metus, ullamcorper vel, tincidunt sed, euismod in, nibh. Quisque volutpat condimentum velit. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos." />
<Label Text="Nam nec ante. Sed lacinia, urna non tincidunt mattis, tortor neque adipiscing diam, a cursus ipsum ante quis turpis. Nulla facilisi. Ut fringilla. Suspendisse potenti. Nunc feugiat mi a tellus consequat imperdiet. Vestibulum sapien. Proin quam. Etiam ultrices. Suspendisse in justo eu magna luctus suscipit. Sed lectus." />
<Label Text="Integer euismod lacus luctus magna. Quisque cursus, metus vitae pharetra auctor, sem massa mattis sem, at interdum magna augue eget diam. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Morbi lacinia molestie dui. Praesent blandit dolor. Sed non quam. In vel mi sit amet augue congue elementum. Morbi in ipsum sit amet pede facilisis laoreet. Donec lacus nunc, viverra nec, blandit vel, egestas et, augue. Vestibulum tincidunt malesuada tellus. Ut ultrices ultrices enim. Curabitur sit amet mauris. Morbi in dui quis est pulvinar ullamcorper." Margin="0, 0, 0, 10" />
</StackLayout>
</ScrollView>
</StackLayout>
</ContentView.Content>
</ContentView>
@@ -0,0 +1,18 @@
using System.Reflection;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace MobileApp1.Views
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class AboutView : ContentView
{
public AboutView()
{
InitializeComponent();
label1.Text = "Version " + Assembly.GetAssembly(typeof(App))?.GetName()?.Version.ToString();
}
}
}
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<ContentView xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:views="clr-namespace:MobileApp1.Views"
x:Class="MobileApp1.Views.LoginView">
<ContentView.Content>
<StackLayout HorizontalOptions="Fill">
<ScrollView>
<StackLayout>
<Label Text="Welcome to XYZ. Log in to your account." Margin="0, 0, 0, 20" FontSize="Body" />
<Label Text="Enter your User ID" />
<Entry x:Name="textbox1" IsSpellCheckEnabled="False" IsTextPredictionEnabled="False" MaxLength="128"></Entry>
<Label Text="Enter your Password" />
<Entry x:Name="textbox2" IsSpellCheckEnabled="False" IsTextPredictionEnabled="False" MaxLength="32" IsPassword="True"></Entry>
<Button x:Name="button1" Margin="0, 20, 0, 0" Text="Log In To My Account" Clicked="button1_Clicked"></Button>
<views:LoadingIndicatorView x:Name="loadingIndicatorView1" Margin="0, 20, 0, 0" />
</StackLayout>
</ScrollView>
</StackLayout>
</ContentView.Content>
</ContentView>
@@ -0,0 +1,86 @@
using MobileApp1.Services;
using System;
using System.Threading.Tasks;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace MobileApp1.Views
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class LoginView : ContentView
{
protected bool isBusy = false;
public LoginView()
{
InitializeComponent();
}
private bool IsBusy
{
get => isBusy;
set
{
isBusy = value;
LoginPage cp = ContentViewHelper.GetContentPage<LoginPage>(this);
if (cp != null)
{
cp.IsBusy = value;
}
Device.BeginInvokeOnMainThread(() =>
{
loadingIndicatorView1.IsRunning = value;
textbox1.IsEnabled = textbox2.IsEnabled = !value;
button1.IsEnabled = !value;
});
}
}
private async void button1_Clicked(object sender, EventArgs e)
{
await Task.Run(() =>
{
if (this.Parent == null)
{
return;
}
ContentPage cp = ContentViewHelper.GetContentPage(this);
if (cp == null)
{
return;
}
App ap = ContentViewHelper.GetApp(this);
if (ap == null)
{
return;
}
this.IsBusy = true;
ServiceResult result = ap.CorporationService.Login(textbox1.Text, textbox2.Text);
loadingIndicatorView1.Message = result.Message;
this.IsBusy = false;
//ContentViewHelper.SetMainPage(this, new AppShell());
//await cp.DisplayAlert("Clicked", "Login", "OK");
if (result.IsSuccess)
{
//SetErrorMessage(string.Empty);
}
});
}
}
}
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<ContentView xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:views="clr-namespace:MobileApp1.Views"
x:Class="MobileApp1.Views.PasswordResetView">
<ContentView.Content>
<StackLayout HorizontalOptions="Fill">
<ScrollView>
<StackLayout>
<Label Text="Forgotten your password? Reset your account." Margin="0, 0, 0, 20" FontSize="Body" />
<Label Text="Enter your User ID" />
<Entry x:Name="textbox1" IsSpellCheckEnabled="False" IsTextPredictionEnabled="False" MaxLength="128"></Entry>
<Button x:Name="button1" Margin="0, 20, 0, 0" Text="Request Password Reset" Clicked="button1_Clicked"></Button>
<views:LoadingIndicatorView x:Name="loadingIndicatorView1" Margin="0, 20, 0, 0" />
</StackLayout>
</ScrollView>
</StackLayout>
</ContentView.Content>
</ContentView>
@@ -0,0 +1,89 @@
using MobileApp1.Services;
using System;
using System.Threading.Tasks;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace MobileApp1.Views
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class PasswordResetView : ContentView
{
protected bool isBusy = false;
public PasswordResetView()
{
InitializeComponent();
}
private bool IsBusy
{
get => isBusy;
set
{
isBusy = value;
LoginPage cp = ContentViewHelper.GetContentPage<LoginPage>(this);
if (cp != null)
{
cp.IsBusy = value;
}
Device.BeginInvokeOnMainThread(() =>
{
loadingIndicatorView1.IsRunning = value;
textbox1.IsEnabled = !value;
button1.IsEnabled = !value;
});
}
}
private async void button1_Clicked(object sender, EventArgs e)
{
await Task.Run(() =>
{
if (this.Parent == null)
{
return;
}
ContentPage cp = ContentViewHelper.GetContentPage(this);
if (cp == null)
{
return;
}
App ap = ContentViewHelper.GetApp(this);
if (ap == null)
{
return;
}
this.IsBusy = true;
ServiceResult result = ap.CorporationService.RequestPasswordReset(textbox1.Text);
loadingIndicatorView1.Message = result.Message;
this.IsBusy = false;
//ContentViewHelper.SetMainPage(this, new AppShell());
//await cp.DisplayAlert("Clicked", "Login", "OK");
if (result.IsSuccess)
{
// //await ContentViewHelper.GetApplication(this)?.MainPage.Navigation.PushAsync(new PasswordResetPage());
// //ContentViewHelper.GetApplication(this).MainPage = new NavigationPage(new PasswordResetPage());
ContentViewHelper.SetMainPage(this, new PasswordResetPage());
}
});
}
}
}
+31
View File
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:Selector="clr-namespace:MobileApp1.Models" xmlns:views="clr-namespace:MobileApp1.Views"
x:Class="MobileApp1.Views.LoginPage"
NavigationPage.HasNavigationBar="False">
<ContentPage.Content>
<StackLayout Margin="20">
<views:CompanyHeaderView />
<CarouselView IndicatorView="indicatorView1" x:Name="carouselView1" Margin="0, 0, 0, 10">
<CarouselView.ItemsSource>
<x:Array Type="{x:Type ContentView}">
<views:LoginView />
<views:PasswordResetView />
<views:AboutView />
</x:Array>
</CarouselView.ItemsSource>
<CarouselView.ItemTemplate>
<DataTemplate>
<ContentView Content="{Binding .}" />
</DataTemplate>
</CarouselView.ItemTemplate>
</CarouselView>
<IndicatorView
x:Name="indicatorView1"
MaximumVisible="6"
Margin="0, 0, 0, 20" />
</StackLayout>
</ContentPage.Content>
</ContentPage>
+43
View File
@@ -0,0 +1,43 @@
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace MobileApp1.Views
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class LoginPage : ContentPage
{
protected bool isBusy = false;
//public int PageIndex { get; set; } = 0;
public LoginPage()
{
InitializeComponent();
//indicatorView1.ItemsSource = new List<ContentView>() {
// new LandingLoginView(),
// new LandingRecoveryView(),
// new LandingAboutView()
//};
//indicatorView1.templ
indicatorView1.Position = 0;
}
public bool IsBusy
{
get => isBusy;
set
{
isBusy = value;
Device.BeginInvokeOnMainThread(() =>
{
carouselView1.IsSwipeEnabled = !value;
});
}
}
}
}
+25
View File
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="MobileApp1.Views.PasswordResetPage"
xmlns:views="clr-namespace:MobileApp1.Views"
Title="Reset Password">
<ContentPage.Content>
<StackLayout Margin="20">
<views:CompanyHeaderView />
<StackLayout HorizontalOptions="Fill">
<ScrollView>
<StackLayout>
<Label Text="Your password reset request has been sent." Margin="0, 0, 0, 20" FontSize="Body" />
<Label Text="Check your e-mails for your password reset message." FontSize="Body" />
<Button HorizontalOptions="Fill" Margin="0, 20, 0, 0" Text="Log In To My Account" Clicked="button1_Clicked"></Button>
</StackLayout>
</ScrollView>
</StackLayout>
</StackLayout>
</ContentPage.Content>
</ContentPage>
@@ -0,0 +1,19 @@
using System;
using Xamarin.Forms;
namespace MobileApp1.Views
{
public partial class PasswordResetPage : ContentPage
{
public PasswordResetPage()
{
InitializeComponent();
}
private void button1_Clicked(object sender, EventArgs e)
{
ContentPageHelper.SetMainPage(this, new LoginPage());
}
}
}