SyncService + SyncPage added
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="WorkFlowCheck.MAUI.Pages.System.SyncPage"
|
||||
Title="SyncPage">
|
||||
<VerticalStackLayout>
|
||||
<Label
|
||||
Text="Welcome to .NET MAUI!"
|
||||
VerticalOptions="Center"
|
||||
HorizontalOptions="Center" />
|
||||
<Button x:Name="SyncBtn" Text="Adat szinkronizálás" Clicked="OnSyncClicked" />
|
||||
<ActivityIndicator x:Name="LoadingIndicator"
|
||||
IsRunning="False"
|
||||
IsVisible="False"
|
||||
VerticalOptions="Center"
|
||||
HorizontalOptions="Center" />
|
||||
</VerticalStackLayout>
|
||||
</ContentPage>
|
||||
@@ -0,0 +1,38 @@
|
||||
using WorkFlowCheck.MAUI.Services;
|
||||
|
||||
namespace WorkFlowCheck.MAUI.Pages.System;
|
||||
|
||||
public partial class SyncPage : ContentPage
|
||||
{
|
||||
private ISyncService _syncService;
|
||||
public SyncPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
_syncService = MauiProgram.ServiceProvider.GetRequiredService<ISyncService>();
|
||||
}
|
||||
|
||||
private async void OnSyncClicked(object sender, EventArgs e)
|
||||
{
|
||||
LoadingIndicator.IsRunning = true;
|
||||
LoadingIndicator.IsVisible = true;
|
||||
try
|
||||
{
|
||||
await _syncService.SyncDatas();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
throw;
|
||||
}
|
||||
LoadingIndicator.IsVisible = false;
|
||||
LoadingIndicator.IsRunning = false;
|
||||
|
||||
}
|
||||
|
||||
|
||||
protected override bool OnBackButtonPressed()
|
||||
{
|
||||
Shell.Current.GoToAsync("//MainPage");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user