mirror of
https://gitlab.com/fabinfra/fabaccess/borepin.git
synced 2025-03-13 07:11:56 +01:00
83 lines
2.4 KiB
C#
83 lines
2.4 KiB
C#
using Borepin.Base;
|
|
using Borepin.Model;
|
|
using Borepin.Service.Connections;
|
|
using Prism.Commands;
|
|
using Prism.Navigation;
|
|
using System.Collections.Generic;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Input;
|
|
|
|
namespace Borepin.PageModel
|
|
{
|
|
public class StartUpDistributorPageModel : PageModelBase
|
|
{
|
|
#region Private Properties
|
|
private readonly IConnectionService _ConnectionService;
|
|
#endregion
|
|
|
|
#region Constructors
|
|
public StartUpDistributorPageModel(INavigationService navigationService, IConnectionService connectionService) : base(navigationService)
|
|
{
|
|
_ConnectionService = connectionService;
|
|
|
|
DistributePageCommand = new DelegateCommand<string>(DistributePageCommandExecuted);
|
|
|
|
DistributePageCommand.Execute(null);
|
|
}
|
|
#endregion
|
|
|
|
#region LoadData
|
|
public override Task LoadData()
|
|
{
|
|
return Task.CompletedTask;
|
|
}
|
|
#endregion
|
|
|
|
#region Command
|
|
private ICommand _DistributePageCommand;
|
|
|
|
public ICommand DistributePageCommand
|
|
{
|
|
get => _DistributePageCommand;
|
|
set => SetProperty(ref _DistributePageCommand, value);
|
|
}
|
|
|
|
private async void DistributePageCommandExecuted(string view)
|
|
{
|
|
List<Connection> connection_list = await _ConnectionService.GetConnectionList();
|
|
if (connection_list.Count == 0)
|
|
{
|
|
INavigationResult result = await _NavigationService.NavigateAsync("MainPage/NavigationPage/SetUpProcess_WelcomePage");
|
|
if (!result.Success)
|
|
{
|
|
System.Diagnostics.Debugger.Break();
|
|
}
|
|
}
|
|
else
|
|
{
|
|
INavigationResult result = await _NavigationService.NavigateAsync("MainPage/NavigationPage/ServerListPage");
|
|
if (!result.Success)
|
|
{
|
|
System.Diagnostics.Debugger.Break();
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region Properties
|
|
#endregion
|
|
|
|
#region INavigationAware
|
|
public override void OnNavigatedFrom(INavigationParameters parameters)
|
|
{
|
|
|
|
}
|
|
|
|
public override void OnNavigatedTo(INavigationParameters parameters)
|
|
{
|
|
|
|
}
|
|
#endregion
|
|
}
|
|
}
|