WIP
This commit is contained in:
parent
17e6ca60b1
commit
9bb4888bab
@ -1,9 +0,0 @@
|
||||
namespace MobileApp1
|
||||
{
|
||||
public class ServiceResult
|
||||
{
|
||||
public bool IsSuccess { get; set; }
|
||||
public string Message { get; set; }
|
||||
|
||||
}
|
||||
}
|
16
MobileApp1/DTO/ServiceResult.cs
Normal file
16
MobileApp1/DTO/ServiceResult.cs
Normal file
@ -0,0 +1,16 @@
|
||||
namespace MobileApp1
|
||||
{
|
||||
public class ServiceResult
|
||||
{
|
||||
public static ServiceResult Create(bool isSuccess, string message) => new ServiceResult()
|
||||
{
|
||||
IsSuccess = isSuccess,
|
||||
Message = message
|
||||
};
|
||||
|
||||
|
||||
public bool IsSuccess { get; set; }
|
||||
public string Message { get; set; }
|
||||
|
||||
}
|
||||
}
|
10
MobileApp1/DTO/WelcomePackResult.cs
Normal file
10
MobileApp1/DTO/WelcomePackResult.cs
Normal file
@ -0,0 +1,10 @@
|
||||
namespace MobileApp1
|
||||
{
|
||||
public class WelcomePackResult : ServiceResult
|
||||
{
|
||||
public int NoticesCount { get; set; } = 0;
|
||||
|
||||
public int MessagesCount { get; set; } = 0;
|
||||
|
||||
}
|
||||
}
|
@ -47,9 +47,6 @@
|
||||
<Compile Update="Views\LogoutPage.xaml.cs">
|
||||
<DependentUpon>LogoutPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Update="Views\MyStuffPage.xaml.cs">
|
||||
<DependentUpon>MyStuffPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Update="Views\PasswordResetPage.xaml.cs">
|
||||
<DependentUpon>PasswordResetPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
@ -65,8 +62,11 @@
|
||||
<Compile Update="Views\Content\Login\LoginView.xaml.cs">
|
||||
<DependentUpon>LoginView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Update="Views\HomePage.xaml.cs">
|
||||
<DependentUpon>HomePage.xaml</DependentUpon>
|
||||
<Compile Update="Views\WelcomePage.xaml.cs">
|
||||
<DependentUpon>WelcomePage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Update="Views\MyFoldersPage.xaml.cs">
|
||||
<DependentUpon>MyFoldersPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
@ -86,11 +86,14 @@
|
||||
<EmbeddedResource Update="Views\MainPage.xaml">
|
||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Update="Views\HomePage.xaml">
|
||||
<EmbeddedResource Update="Views\WelcomePage.xaml">
|
||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Update="Views\SettingsPage.xaml">
|
||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Update="Views\MyFoldersPage.xaml">
|
||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -1,10 +1,15 @@
|
||||
namespace MobileApp1.Services
|
||||
using System;
|
||||
|
||||
namespace MobileApp1.Services
|
||||
{
|
||||
public class CorporationMockService : ICorporationService
|
||||
{
|
||||
private Random randy = null;
|
||||
|
||||
|
||||
public CorporationMockService()
|
||||
{
|
||||
|
||||
randy = new Random();
|
||||
}
|
||||
|
||||
|
||||
@ -19,14 +24,11 @@
|
||||
{
|
||||
System.Threading.Thread.Sleep(6000);
|
||||
|
||||
this.DisplayName = username;
|
||||
//this.DisplayName = username;
|
||||
this.DisplayName = "John";
|
||||
this.IsLoggedIn = true;
|
||||
|
||||
return new ServiceResult()
|
||||
{
|
||||
IsSuccess = true,
|
||||
Message = "Logged In"
|
||||
};
|
||||
return ServiceResult.Create(true, "Logged In");
|
||||
}
|
||||
|
||||
public ServiceResult Logout()
|
||||
@ -36,11 +38,7 @@
|
||||
this.DisplayName = string.Empty;
|
||||
this.IsLoggedIn = false;
|
||||
|
||||
return new ServiceResult()
|
||||
{
|
||||
IsSuccess = true,
|
||||
Message = "Logged Out"
|
||||
};
|
||||
return ServiceResult.Create(true, "Logged Out");
|
||||
}
|
||||
|
||||
public ServiceResult RequestPasswordReset(string username)
|
||||
@ -50,10 +48,19 @@
|
||||
this.DisplayName = string.Empty;
|
||||
this.IsLoggedIn = false;
|
||||
|
||||
return new ServiceResult()
|
||||
return ServiceResult.Create(true, "Password Reset Requested");
|
||||
}
|
||||
|
||||
public WelcomePackResult RetrieveWelcomePack()
|
||||
{
|
||||
System.Threading.Thread.Sleep(1000);
|
||||
|
||||
return new WelcomePackResult()
|
||||
{
|
||||
IsSuccess = true,
|
||||
Message = "Password Reset Requested"
|
||||
Message = "",
|
||||
MessagesCount = randy.Next(0, 25),
|
||||
NoticesCount = randy.Next(0, 10)
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -20,11 +20,7 @@
|
||||
this.DisplayName = username;
|
||||
this.IsLoggedIn = true;
|
||||
|
||||
return new ServiceResult()
|
||||
{
|
||||
IsSuccess = true,
|
||||
Message = "Logged In"
|
||||
};
|
||||
return ServiceResult.Create(true, "Logged In");
|
||||
}
|
||||
|
||||
public ServiceResult Logout()
|
||||
@ -32,11 +28,7 @@
|
||||
this.DisplayName = string.Empty;
|
||||
this.IsLoggedIn = false;
|
||||
|
||||
return new ServiceResult()
|
||||
{
|
||||
IsSuccess = true,
|
||||
Message = "Logged Out"
|
||||
};
|
||||
return ServiceResult.Create(true, "Logged Out");
|
||||
}
|
||||
|
||||
public ServiceResult RequestPasswordReset(string username)
|
||||
@ -44,10 +36,19 @@
|
||||
this.DisplayName = string.Empty;
|
||||
this.IsLoggedIn = false;
|
||||
|
||||
return new ServiceResult()
|
||||
return ServiceResult.Create(true, "Password Reset Requested");
|
||||
}
|
||||
|
||||
public WelcomePackResult RetrieveWelcomePack()
|
||||
{
|
||||
System.Threading.Thread.Sleep(1000);
|
||||
|
||||
return new WelcomePackResult()
|
||||
{
|
||||
IsSuccess = true,
|
||||
Message = "Password Reset Requested"
|
||||
Message = "",
|
||||
MessagesCount = 0,
|
||||
NoticesCount = 0
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -15,5 +15,7 @@
|
||||
|
||||
ServiceResult RequestPasswordReset(string username);
|
||||
|
||||
WelcomePackResult RetrieveWelcomePack();
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,7 @@
|
||||
</ListView.Footer>-->
|
||||
<ListView.ItemsSource>
|
||||
<x:Array Type="{x:Type models:FlyoutPageItem}">
|
||||
<models:FlyoutPageItem Title="Home" Icon="ic_home" TargetType="{x:Type views:HomePage}" />
|
||||
<models:FlyoutPageItem Title="Home" Icon="ic_home" TargetType="{x:Type views:WelcomePage}" />
|
||||
<models:FlyoutPageItem Title="My Folders" Icon="ic_folder" TargetType="{x:Type views:MyFoldersPage}" />
|
||||
<models:FlyoutPageItem Title="Settings" Icon="ic_settings" TargetType="{x:Type views:SettingsPage}" />
|
||||
<models:FlyoutPageItem Title="About" Icon="ic_helpcircle" TargetType="{x:Type views:AboutPage}" />
|
||||
|
@ -1,29 +0,0 @@
|
||||
<?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:views="clr-namespace:MobileApp1.Views"
|
||||
x:Class="MobileApp1.Views.HomePage"
|
||||
Title="Home">
|
||||
<ContentPage.Content>
|
||||
<ScrollView>
|
||||
<StackLayout Margin="20">
|
||||
<views:CompanyHeaderView />
|
||||
|
||||
<Label Text="Welcome to XYZ" FontSize="Body" />
|
||||
<Label x:Name="label1" Text="Hi, John." />
|
||||
<Label Text="" Margin="0, 0, 0, 10" />
|
||||
|
||||
<Label Text="Notices" FontSize="Body" />
|
||||
<Label x:Name="label2" Text="You have no notices" />
|
||||
<Label Text="" Margin="0, 0, 0, 10" />
|
||||
|
||||
<Label Text="Messages" FontSize="Body" />
|
||||
<Label x:Name="label3" Text="You have no messages" />
|
||||
<Label Text="" Margin="0, 0, 0, 10" />
|
||||
|
||||
<Button x:Name="button1" Margin="0, 20, 0, 0" Text="Let's Get Started" Clicked="button1_Clicked" ></Button>
|
||||
|
||||
</StackLayout>
|
||||
</ScrollView>
|
||||
</ContentPage.Content>
|
||||
</ContentPage>
|
@ -1,25 +0,0 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.Xaml;
|
||||
|
||||
namespace MobileApp1.Views
|
||||
{
|
||||
[XamlCompilation(XamlCompilationOptions.Compile)]
|
||||
public partial class HomePage : ContentPage
|
||||
{
|
||||
public HomePage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private async void button1_Clicked(object sender, EventArgs e)
|
||||
{
|
||||
await Task.Run(() =>
|
||||
{
|
||||
ContentPageHelper.SetDetailPage(this, typeof(MyFoldersPage));
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -8,7 +8,7 @@
|
||||
<FlyoutPage.Detail>
|
||||
<NavigationPage>
|
||||
<x:Arguments>
|
||||
<views:HomePage />
|
||||
<views:WelcomePage />
|
||||
</x:Arguments>
|
||||
</NavigationPage>
|
||||
</FlyoutPage.Detail>
|
||||
|
@ -1,22 +1,16 @@
|
||||
<?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.MyFoldersPage"
|
||||
xmlns:views="clr-namespace:MobileApp1.Views"
|
||||
Title="My Stuff">
|
||||
<ContentPage.Content>
|
||||
<StackLayout Margin="20">
|
||||
<views:CompanyHeaderView />
|
||||
|
||||
<StackLayout HorizontalOptions="Fill">
|
||||
<ScrollView>
|
||||
<StackLayout>
|
||||
<Label x:Name="label1" Text="" Margin="0, 0, 0, 20" FontSize="Body" />
|
||||
|
||||
</StackLayout>
|
||||
</ScrollView>
|
||||
</StackLayout>
|
||||
|
||||
</StackLayout>
|
||||
</ContentPage.Content>
|
||||
</ContentPage>
|
||||
<TabbedPage
|
||||
xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="MobileApp1.Views.MyFoldersPage"
|
||||
Title="My Folders">
|
||||
<ContentPage
|
||||
Title="Folder 1"
|
||||
IconImageSource="ic_home" />
|
||||
<ContentPage
|
||||
Title="Folder 2"
|
||||
IconImageSource="ic_home" />
|
||||
<ContentPage
|
||||
Title="Folder 3"
|
||||
IconImageSource="ic_home" />
|
||||
</TabbedPage>
|
@ -1,16 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.Xaml;
|
||||
|
||||
namespace MobileApp1.Views
|
||||
{
|
||||
public partial class MyFoldersPage : ContentPage
|
||||
[XamlCompilation(XamlCompilationOptions.Compile)]
|
||||
public partial class MyFoldersPage : TabbedPage
|
||||
{
|
||||
public MyFoldersPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
label1.Text = Guid.NewGuid().ToString();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
33
MobileApp1/Views/WelcomePage.xaml
Normal file
33
MobileApp1/Views/WelcomePage.xaml
Normal file
@ -0,0 +1,33 @@
|
||||
<?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:views="clr-namespace:MobileApp1.Views"
|
||||
x:Class="MobileApp1.Views.WelcomePage"
|
||||
Title="Home">
|
||||
<ContentPage.Content>
|
||||
<ScrollView>
|
||||
<StackLayout Margin="20">
|
||||
<views:CompanyHeaderView />
|
||||
|
||||
<StackLayout x:Name="panel1" Margin="0">
|
||||
<Label Text="Welcome to XYZ" FontSize="Body" />
|
||||
<Label x:Name="label1" Text="Hi, John." />
|
||||
<Label Text="" Margin="0, 0, 0, 10" />
|
||||
|
||||
<Label Text="Notices" FontSize="Body" />
|
||||
<Label x:Name="label2" Text="You have no notices" />
|
||||
<Label Text="" Margin="0, 0, 0, 10" />
|
||||
|
||||
<Label Text="Messages" FontSize="Body" />
|
||||
<Label x:Name="label3" Text="You have no messages" />
|
||||
<Label Text="" Margin="0, 0, 0, 10" />
|
||||
|
||||
<Button x:Name="button1" Margin="0, 20, 0, 0" Text="Let's Get Started" Clicked="button1_Clicked" ></Button>
|
||||
</StackLayout>
|
||||
|
||||
<views:LoadingIndicatorView x:Name="loadingIndicatorView1" Margin="0, 20, 0, 0" />
|
||||
|
||||
</StackLayout>
|
||||
</ScrollView>
|
||||
</ContentPage.Content>
|
||||
</ContentPage>
|
101
MobileApp1/Views/WelcomePage.xaml.cs
Normal file
101
MobileApp1/Views/WelcomePage.xaml.cs
Normal file
@ -0,0 +1,101 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.Xaml;
|
||||
|
||||
namespace MobileApp1.Views
|
||||
{
|
||||
[XamlCompilation(XamlCompilationOptions.Compile)]
|
||||
public partial class WelcomePage : ContentPage
|
||||
{
|
||||
protected bool isBusy = false;
|
||||
|
||||
|
||||
public WelcomePage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
protected override void OnAppearing()
|
||||
{
|
||||
base.OnAppearing();
|
||||
|
||||
LoadPage();
|
||||
}
|
||||
|
||||
private bool IsBusy
|
||||
{
|
||||
get => isBusy;
|
||||
set
|
||||
{
|
||||
isBusy = value;
|
||||
|
||||
//LoginPage cp = (LoginPage)ContentViewHelper.GetParentElement<LoginPage>(this);
|
||||
//if (cp != null)
|
||||
//{
|
||||
// cp.IsBusy = value;
|
||||
//}
|
||||
|
||||
Device.BeginInvokeOnMainThread(() =>
|
||||
{
|
||||
loadingIndicatorView1.IsRunning = value;
|
||||
panel1.IsVisible = !value;
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private async void button1_Clicked(object sender, EventArgs e)
|
||||
{
|
||||
await Task.Run(() =>
|
||||
{
|
||||
ContentPageHelper.SetDetailPage(this, typeof(MyFoldersPage));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private async void LoadPage()
|
||||
{
|
||||
await Task.Run(() =>
|
||||
{
|
||||
if (this.Parent == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
App ap = ContentPageHelper.GetApp(this);
|
||||
if (ap == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
IsBusy = true;
|
||||
|
||||
WelcomePackResult result = ap.CorporationService.RetrieveWelcomePack();
|
||||
|
||||
loadingIndicatorView1.Message = result.Message;
|
||||
|
||||
IsBusy = false;
|
||||
|
||||
//ContentViewHelper.SetMainPage(this, new AppShell());
|
||||
|
||||
//await cp.DisplayAlert("Clicked", "Login", "OK");
|
||||
|
||||
|
||||
if (result.IsSuccess)
|
||||
{
|
||||
|
||||
Device.BeginInvokeOnMainThread(() =>
|
||||
{
|
||||
label1.Text = string.Format("Hi, {0}.", ap.CorporationService.DisplayName);
|
||||
label2.Text = string.Format("You have {0} notice{1}", ((result.NoticesCount <= 0) ? "no": result.NoticesCount.ToString()), ((result.NoticesCount == 1) ? "" : "s"));
|
||||
label3.Text = string.Format("You have {0} message{1}", ((result.MessagesCount <= 0) ? "no": result.MessagesCount.ToString()), ((result.MessagesCount == 1) ? "" : "s"));
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user