101 lines
2.6 KiB
C#
101 lines
2.6 KiB
C#
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"));
|
|
});
|
|
}
|
|
|
|
});
|
|
}
|
|
|
|
}
|
|
} |