demo-xf-app-1a/MobileApp1/Views/SettingsPage.xaml.cs

87 lines
2.1 KiB
C#
Raw Normal View History

2021-08-03 16:43:16 +00:00
using System;
using System.Threading.Tasks;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace MobileApp1.Views
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class SettingsPage : ContentPage
{
protected bool isBusy = false;
2021-08-03 16:43:16 +00:00
public SettingsPage()
{
InitializeComponent();
}
protected override void OnAppearing()
{
base.OnAppearing();
if (pickerBox1.Items.Count > 0) pickerBox1.SelectedIndex = 0;
}
private bool IsBusy
{
get => isBusy;
set
{
isBusy = value;
Device.BeginInvokeOnMainThread(() =>
{
loadingIndicatorView1.IsRunning = value;
checkBox1.IsEnabled = switchBox1.IsEnabled = datePicker1.IsEnabled = pickerBox1.IsEnabled = timePicker1.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 = "Saved";
Device.BeginInvokeOnMainThread(() =>
{
DisplayAlert("Settings", "Saved", "OK");
});
this.IsBusy = false;
//ContentViewHelper.SetMainPage(this, new AppShell());
//if (result.IsSuccess)
//{
//}
});
}
2021-08-03 16:43:16 +00:00
}
}