mirror of
https://gitlab.com/fabinfra/fabaccess/borepin.git
synced 2025-03-13 15:21:45 +01:00
Added: ServerPage
This commit is contained in:
parent
bf9b2f19b7
commit
8812b2bfd1
@ -6,6 +6,7 @@ using Borepin.Dialog;
|
|||||||
using Borepin.DialogModel;
|
using Borepin.DialogModel;
|
||||||
using Borepin.Service.Connections;
|
using Borepin.Service.Connections;
|
||||||
using Borepin.Service.BFFH;
|
using Borepin.Service.BFFH;
|
||||||
|
using Borepin.Service.Credentials;
|
||||||
|
|
||||||
namespace Borepin
|
namespace Borepin
|
||||||
{
|
{
|
||||||
@ -49,7 +50,10 @@ namespace Borepin
|
|||||||
// Register Service
|
// Register Service
|
||||||
IConnectionService connectionService = new ConnectionService();
|
IConnectionService connectionService = new ConnectionService();
|
||||||
containerRegistry.RegisterInstance<IConnectionService>(connectionService);
|
containerRegistry.RegisterInstance<IConnectionService>(connectionService);
|
||||||
containerRegistry.RegisterInstance<IBFFHService>(new BFFHService(connectionService));
|
ICredentialService credentialService = new CredentialService();
|
||||||
|
containerRegistry.RegisterInstance<ICredentialService>(credentialService);
|
||||||
|
|
||||||
|
containerRegistry.RegisterInstance<IBFFHService>(new BFFHService(connectionService, credentialService));
|
||||||
containerRegistry.RegisterInstance<IConnectionService>(new ConnectionService());
|
containerRegistry.RegisterInstance<IConnectionService>(new ConnectionService());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
19
Borepin/Borepin/Converter/InvertBoolConverter.cs
Normal file
19
Borepin/Borepin/Converter/InvertBoolConverter.cs
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
using System;
|
||||||
|
using System.Globalization;
|
||||||
|
using Xamarin.Forms;
|
||||||
|
|
||||||
|
namespace Borepin.Converter
|
||||||
|
{
|
||||||
|
public class InvertBoolConverter : IValueConverter
|
||||||
|
{
|
||||||
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
return !(bool)value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
return !(bool)value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,8 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Text;
|
|
||||||
using Borepin.Model;
|
|
||||||
using Xamarin.Forms;
|
using Xamarin.Forms;
|
||||||
|
|
||||||
namespace Borepin.Converter
|
namespace Borepin.Converter
|
||||||
@ -11,7 +8,7 @@ namespace Borepin.Converter
|
|||||||
{
|
{
|
||||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
{
|
{
|
||||||
return value != null ? true : false;
|
return value != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
@ -8,6 +8,7 @@ namespace Borepin.DialogModel
|
|||||||
{
|
{
|
||||||
public class ConfirmDialogModel : BindableBase, IDialogAware
|
public class ConfirmDialogModel : BindableBase, IDialogAware
|
||||||
{
|
{
|
||||||
|
private object _Instance;
|
||||||
public ConfirmDialogModel()
|
public ConfirmDialogModel()
|
||||||
{
|
{
|
||||||
ConfirmCommand = new DelegateCommand(ConfirmCommandExecute);
|
ConfirmCommand = new DelegateCommand(ConfirmCommandExecute);
|
||||||
@ -40,7 +41,14 @@ namespace Borepin.DialogModel
|
|||||||
}
|
}
|
||||||
private void ConfirmCommandExecute()
|
private void ConfirmCommandExecute()
|
||||||
{
|
{
|
||||||
RequestClose(new DialogParameters { { "confirm", true } });
|
IDialogParameters parameters = new DialogParameters()
|
||||||
|
{
|
||||||
|
{ "result", "confirm" },
|
||||||
|
{ "instance", _Instance }
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
RequestClose(parameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ICommand _AbortCommand;
|
private ICommand _AbortCommand;
|
||||||
@ -71,6 +79,7 @@ namespace Borepin.DialogModel
|
|||||||
{
|
{
|
||||||
Title = parameters.GetValue<string>("title");
|
Title = parameters.GetValue<string>("title");
|
||||||
Message = parameters.GetValue<string>("message");
|
Message = parameters.GetValue<string>("message");
|
||||||
|
_Instance = parameters.GetValue<object>("instance");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,17 @@
|
|||||||
</NavigationPage.TitleView>
|
</NavigationPage.TitleView>
|
||||||
<ContentPage.Content>
|
<ContentPage.Content>
|
||||||
<StackLayout>
|
<StackLayout>
|
||||||
|
<Label Text="Active Connection" IsVisible="{Binding HasActiveConnection}"/>
|
||||||
|
<ListView ItemsSource="{Binding ActiveConnection}" IsVisible="{Binding HasActiveConnection}">
|
||||||
|
<ListView.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<ViewCell>
|
||||||
|
<views:ServerListItemView />
|
||||||
|
</ViewCell>
|
||||||
|
</DataTemplate>
|
||||||
|
</ListView.ItemTemplate>
|
||||||
|
</ListView>
|
||||||
|
<Label Text="Last Connections"/>
|
||||||
<ListView ItemsSource="{Binding ServerListItemViewModel_List}">
|
<ListView ItemsSource="{Binding ServerListItemViewModel_List}">
|
||||||
<ListView.ItemTemplate>
|
<ListView.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
|
@ -1,12 +1,19 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
|
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||||
x:Class="Borepin.Page.ServerPage">
|
x:Class="Borepin.Page.ServerPage"
|
||||||
|
xmlns:converter="clr-namespace:Borepin.Converter">
|
||||||
|
<ContentPage.Resources>
|
||||||
|
<ResourceDictionary>
|
||||||
|
<converter:InvertBoolConverter x:Key="invertBool" />
|
||||||
|
</ResourceDictionary>
|
||||||
|
</ContentPage.Resources>
|
||||||
<ContentPage.Content>
|
<ContentPage.Content>
|
||||||
<StackLayout>
|
<StackLayout>
|
||||||
<Label Text="Server Page"
|
<Label Text="{Binding Connection_Item.Address}"/>
|
||||||
VerticalOptions="CenterAndExpand"
|
<Button IsVisible="{Binding IsConnected, Converter={StaticResource invertBool}}" Text="Connect" Command="{Binding ConnectCommand}"/>
|
||||||
HorizontalOptions="CenterAndExpand" />
|
<Button IsVisible="{Binding IsConnected}" Text="Disconnect" Command="{Binding ConnectCommand}"/>
|
||||||
|
<Button Text="Delete" Command="{Binding DeleteCommand}"/>
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
</ContentPage.Content>
|
</ContentPage.Content>
|
||||||
</ContentPage>
|
</ContentPage>
|
@ -11,11 +11,9 @@ namespace Borepin.PageModel
|
|||||||
{
|
{
|
||||||
public class LoginPasswordPageModel : BindableBase
|
public class LoginPasswordPageModel : BindableBase
|
||||||
{
|
{
|
||||||
private INavigationService _NavigationService;
|
private readonly INavigationService _NavigationService;
|
||||||
private IBFFHService _BFFHService;
|
private readonly IBFFHService _BFFHService;
|
||||||
private IConnectionService _ConnectionService;
|
private readonly IConnectionService _ConnectionService;
|
||||||
|
|
||||||
private string _KnownUsername;
|
|
||||||
|
|
||||||
public LoginPasswordPageModel(INavigationService navigationService, IBFFHService bffhService, IConnectionService connectionService)
|
public LoginPasswordPageModel(INavigationService navigationService, IBFFHService bffhService, IConnectionService connectionService)
|
||||||
{
|
{
|
||||||
@ -30,13 +28,7 @@ namespace Borepin.PageModel
|
|||||||
|
|
||||||
private void LoadData()
|
private void LoadData()
|
||||||
{
|
{
|
||||||
_KnownUsername = _BFFHService.ActiveConnection.Username;
|
|
||||||
|
|
||||||
if (_KnownUsername != null)
|
|
||||||
{
|
|
||||||
Username = _KnownUsername;
|
|
||||||
Password = "********";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private string _Username;
|
private string _Username;
|
||||||
@ -62,21 +54,13 @@ namespace Borepin.PageModel
|
|||||||
|
|
||||||
private async void AuthenticateCommandExecuted()
|
private async void AuthenticateCommandExecuted()
|
||||||
{
|
{
|
||||||
if(_KnownUsername == Username)
|
Connection connection_update = _BFFHService.ActiveConnection;
|
||||||
{
|
|
||||||
await _BFFHService.Authenticate();
|
|
||||||
await _ConnectionService.LogConnect(_BFFHService.ActiveConnection);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Connection connection_update = _BFFHService.ActiveConnection;
|
|
||||||
|
|
||||||
connection_update.Username = Username;
|
connection_update.Username = Username;
|
||||||
await _BFFHService.Authenticate(connection_update, Password);
|
await _BFFHService.Authenticate(connection_update, Password);
|
||||||
|
|
||||||
await _ConnectionService.AddConnection(_BFFHService.ActiveConnection);
|
await _ConnectionService.AddConnection(_BFFHService.ActiveConnection);
|
||||||
await _ConnectionService.LogConnect(_BFFHService.ActiveConnection);
|
await _ConnectionService.LogConnect(_BFFHService.ActiveConnection);
|
||||||
}
|
|
||||||
|
|
||||||
var result = await _NavigationService.NavigateAsync("/MainPage/NavigationPage/MachinesPage");
|
var result = await _NavigationService.NavigateAsync("/MainPage/NavigationPage/MachinesPage");
|
||||||
|
|
||||||
|
@ -9,8 +9,8 @@ namespace Borepin.PageModel
|
|||||||
{
|
{
|
||||||
public class MachinePageModel : BindableBase, INavigationAware
|
public class MachinePageModel : BindableBase, INavigationAware
|
||||||
{
|
{
|
||||||
private INavigationService _NavigationService;
|
private readonly INavigationService _NavigationService;
|
||||||
private IBFFHService _BFFHService;
|
private readonly IBFFHService _BFFHService;
|
||||||
|
|
||||||
public MachinePageModel(INavigationService navigationService, IBFFHService bffhService)
|
public MachinePageModel(INavigationService navigationService, IBFFHService bffhService)
|
||||||
{
|
{
|
||||||
|
@ -9,7 +9,7 @@ namespace Borepin.PageModel
|
|||||||
{
|
{
|
||||||
public class MachinesPageModel : BindableBase
|
public class MachinesPageModel : BindableBase
|
||||||
{
|
{
|
||||||
private INavigationService _NavigationService;
|
private readonly INavigationService _NavigationService;
|
||||||
|
|
||||||
public MachinesPageModel(INavigationService navigationService)
|
public MachinesPageModel(INavigationService navigationService)
|
||||||
{
|
{
|
||||||
@ -28,8 +28,10 @@ namespace Borepin.PageModel
|
|||||||
{
|
{
|
||||||
Machine machine = obj as Machine;
|
Machine machine = obj as Machine;
|
||||||
|
|
||||||
NavigationParameters navigationParams = new NavigationParameters();
|
NavigationParameters navigationParams = new NavigationParameters
|
||||||
navigationParams.Add("machineID", machine.ID);
|
{
|
||||||
|
{ "machineID", machine.ID }
|
||||||
|
};
|
||||||
|
|
||||||
INavigationResult result = await _NavigationService.NavigateAsync($"MachinePage", navigationParams);
|
INavigationResult result = await _NavigationService.NavigateAsync($"MachinePage", navigationParams);
|
||||||
if (!result.Success)
|
if (!result.Success)
|
||||||
|
@ -14,9 +14,9 @@ namespace Borepin.PageModel
|
|||||||
{
|
{
|
||||||
public class ServerListPageModel : BindableBase, INavigationAware
|
public class ServerListPageModel : BindableBase, INavigationAware
|
||||||
{
|
{
|
||||||
private INavigationService _NavigationService;
|
private readonly INavigationService _NavigationService;
|
||||||
private IConnectionService _ConnectionService;
|
private readonly IConnectionService _ConnectionService;
|
||||||
private IBFFHService _BFFHService;
|
private readonly IBFFHService _BFFHService;
|
||||||
|
|
||||||
public ServerListPageModel(INavigationService navigationService, IConnectionService connectionService, IBFFHService bffhService)
|
public ServerListPageModel(INavigationService navigationService, IConnectionService connectionService, IBFFHService bffhService)
|
||||||
{
|
{
|
||||||
@ -26,19 +26,30 @@ namespace Borepin.PageModel
|
|||||||
|
|
||||||
AddInstancesCommand = new DelegateCommand(AddInstancesCommandExecuted);
|
AddInstancesCommand = new DelegateCommand(AddInstancesCommandExecuted);
|
||||||
SelectInstanceCommand = new DelegateCommand<object>(SelectInstanceCommandExecuted);
|
SelectInstanceCommand = new DelegateCommand<object>(SelectInstanceCommandExecuted);
|
||||||
|
|
||||||
Task.Run(LoadData);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<bool> LoadData()
|
private async Task<bool> LoadData()
|
||||||
{
|
{
|
||||||
List<Connection> list = await _ConnectionService.GetConnectionList();
|
List<Connection> list = await _ConnectionService.GetConnectionList();
|
||||||
ServerListItemViewModel_List = list.Select(x => new ServerListItemViewModel(x)).ToList();
|
if (_BFFHService.ActiveConnection != null)
|
||||||
|
|
||||||
if(_BFFHService.ActiveConnection != null)
|
|
||||||
{
|
{
|
||||||
ActiveConnection = new ServerListItemViewModel(_BFFHService.ActiveConnection);
|
ActiveConnection = new List<ServerListItemViewModel>
|
||||||
|
{
|
||||||
|
new ServerListItemViewModel(_BFFHService.ActiveConnection)
|
||||||
|
};
|
||||||
|
|
||||||
|
list.Remove(_BFFHService.ActiveConnection);
|
||||||
|
|
||||||
|
HasActiveConnection = true;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
HasActiveConnection = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//list = (List<Connection>)list.OrderBy(x => x.LastTime);
|
||||||
|
|
||||||
|
ServerListItemViewModel_List = list.Select(x => new ServerListItemViewModel(x)).ToList();
|
||||||
|
|
||||||
return await Task.FromResult(true);
|
return await Task.FromResult(true);
|
||||||
}
|
}
|
||||||
@ -51,12 +62,19 @@ namespace Borepin.PageModel
|
|||||||
set => SetProperty(ref _ServerListItemViewModel_List, value);
|
set => SetProperty(ref _ServerListItemViewModel_List, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ServerListItemViewModel _ActiveConnection;
|
private List<ServerListItemViewModel> _ActiveConnection;
|
||||||
public ServerListItemViewModel ActiveConnection
|
public List<ServerListItemViewModel> ActiveConnection
|
||||||
{
|
{
|
||||||
get => _ActiveConnection;
|
get => _ActiveConnection;
|
||||||
set => SetProperty(ref _ActiveConnection, value);
|
set => SetProperty(ref _ActiveConnection, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool _HasActiveConnection = false;
|
||||||
|
public bool HasActiveConnection
|
||||||
|
{
|
||||||
|
get => _HasActiveConnection;
|
||||||
|
set => SetProperty(ref _HasActiveConnection, value);
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Commands
|
#region Commands
|
||||||
@ -70,10 +88,12 @@ namespace Borepin.PageModel
|
|||||||
{
|
{
|
||||||
ServerListItemViewModel viewmodel = obj as ServerListItemViewModel;
|
ServerListItemViewModel viewmodel = obj as ServerListItemViewModel;
|
||||||
|
|
||||||
NavigationParameters navigationParams = new NavigationParameters();
|
NavigationParameters parameters = new NavigationParameters
|
||||||
navigationParams.Add("instance", viewmodel.Instance);
|
{
|
||||||
|
{ "instance", viewmodel.Instance }
|
||||||
|
};
|
||||||
|
|
||||||
INavigationResult result = await _NavigationService.NavigateAsync($"ServerPage", navigationParams);
|
INavigationResult result = await _NavigationService.NavigateAsync($"ServerPage", parameters);
|
||||||
if (!result.Success)
|
if (!result.Success)
|
||||||
{
|
{
|
||||||
System.Diagnostics.Debugger.Break();
|
System.Diagnostics.Debugger.Break();
|
||||||
|
@ -1,19 +1,34 @@
|
|||||||
using Borepin.Model;
|
using Borepin.Model;
|
||||||
|
using Borepin.Service.BFFH;
|
||||||
using Borepin.Service.Connections;
|
using Borepin.Service.Connections;
|
||||||
|
using Borepin.Service.Credentials;
|
||||||
|
using Prism.Commands;
|
||||||
using Prism.Mvvm;
|
using Prism.Mvvm;
|
||||||
using Prism.Navigation;
|
using Prism.Navigation;
|
||||||
|
using Prism.Services.Dialogs;
|
||||||
|
using System.Windows.Input;
|
||||||
|
|
||||||
namespace Borepin.PageModel
|
namespace Borepin.PageModel
|
||||||
{
|
{
|
||||||
public class ServerPageModel : BindableBase, INavigationAware
|
public class ServerPageModel : BindableBase, INavigationAware
|
||||||
{
|
{
|
||||||
private INavigationService _NavigationService;
|
private readonly INavigationService _NavigationService;
|
||||||
private IConnectionService _ConnectionService;
|
private readonly IDialogService _DialogService;
|
||||||
|
private readonly IConnectionService _ConnectionService;
|
||||||
|
private readonly IBFFHService _BFFHService;
|
||||||
|
private readonly ICredentialService _CredentialService;
|
||||||
|
|
||||||
public ServerPageModel(INavigationService navigationService, IConnectionService connectionService)
|
public ServerPageModel(INavigationService navigationService, IDialogService dialogService, IConnectionService connectionService, IBFFHService bffhService, ICredentialService credentialService)
|
||||||
{
|
{
|
||||||
_NavigationService = navigationService;
|
_NavigationService = navigationService;
|
||||||
|
_DialogService = dialogService;
|
||||||
|
|
||||||
_ConnectionService = connectionService;
|
_ConnectionService = connectionService;
|
||||||
|
_BFFHService = bffhService;
|
||||||
|
_CredentialService = credentialService;
|
||||||
|
|
||||||
|
ConnectCommand = new DelegateCommand(ConnectCommandExecuted);
|
||||||
|
DeleteCommand = new DelegateCommand(DeleteCommandExecuted);
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Properties
|
#region Properties
|
||||||
@ -23,6 +38,86 @@ namespace Borepin.PageModel
|
|||||||
get => _Connection_Item;
|
get => _Connection_Item;
|
||||||
set => SetProperty(ref _Connection_Item, value);
|
set => SetProperty(ref _Connection_Item, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool _IsConnected;
|
||||||
|
public bool IsConnected
|
||||||
|
{
|
||||||
|
get => _IsConnected;
|
||||||
|
set => SetProperty(ref _IsConnected, value);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Commands
|
||||||
|
private ICommand _ConnectCommand;
|
||||||
|
public ICommand ConnectCommand
|
||||||
|
{
|
||||||
|
get => _ConnectCommand;
|
||||||
|
set => SetProperty(ref _ConnectCommand, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void ConnectCommandExecuted()
|
||||||
|
{
|
||||||
|
if(IsConnected)
|
||||||
|
{
|
||||||
|
await _BFFHService.Disconnect();
|
||||||
|
|
||||||
|
IsConnected = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
await _BFFHService.Connect(Connection_Item);
|
||||||
|
await _BFFHService.Authenticate();
|
||||||
|
|
||||||
|
IsConnected = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private ICommand _DeleteCommand;
|
||||||
|
public ICommand DeleteCommand
|
||||||
|
{
|
||||||
|
get => _DeleteCommand;
|
||||||
|
set => SetProperty(ref _DeleteCommand, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DeleteCommandExecuted()
|
||||||
|
{
|
||||||
|
DialogParameters parameters = new DialogParameters
|
||||||
|
{
|
||||||
|
{ "title", "Delete Server" },
|
||||||
|
{ "message", "Do you really want to delete this Server?" },
|
||||||
|
{ "instance", Connection_Item }
|
||||||
|
};
|
||||||
|
|
||||||
|
_DialogService.ShowDialog("ConfirmDialog", parameters, DeleteCommandExecuted_Dialog);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void DeleteCommandExecuted_Dialog(IDialogResult result)
|
||||||
|
{
|
||||||
|
if(result.Parameters.GetValue<string>("result") == "confirm")
|
||||||
|
{
|
||||||
|
Connection connection = (Connection)result.Parameters.GetValue<object>("instance");
|
||||||
|
|
||||||
|
if(_BFFHService.ActiveConnection != null && connection == _BFFHService.ActiveConnection)
|
||||||
|
{
|
||||||
|
await _BFFHService.Disconnect();
|
||||||
|
}
|
||||||
|
|
||||||
|
await _ConnectionService.RemoveConnection(connection);
|
||||||
|
|
||||||
|
await _CredentialService.RemoveCredentialsAsync(connection);
|
||||||
|
|
||||||
|
await _NavigationService.NavigateAsync("/MainPage/NavigationPage/ServerListPage");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
INavigationParameters parameters = new NavigationParameters()
|
||||||
|
{
|
||||||
|
{ "instance" , result.Parameters.GetValue<object>("instance")}
|
||||||
|
};
|
||||||
|
|
||||||
|
OnNavigatedTo(parameters);
|
||||||
|
}
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region INavigationAware
|
#region INavigationAware
|
||||||
@ -34,6 +129,15 @@ namespace Borepin.PageModel
|
|||||||
public void OnNavigatedTo(INavigationParameters parameters)
|
public void OnNavigatedTo(INavigationParameters parameters)
|
||||||
{
|
{
|
||||||
Connection_Item = parameters["instance"] as Connection;
|
Connection_Item = parameters["instance"] as Connection;
|
||||||
|
|
||||||
|
if(_BFFHService.ActiveConnection != null && Connection_Item != null)
|
||||||
|
{
|
||||||
|
IsConnected = Connection_Item.Equals(_BFFHService.ActiveConnection);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IsConnected = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
@ -14,10 +14,10 @@ namespace Borepin.Service.BFFH
|
|||||||
|
|
||||||
private FabAccessAPI.Connection _Connection;
|
private FabAccessAPI.Connection _Connection;
|
||||||
|
|
||||||
public BFFHService(IConnectionService connectionService)
|
public BFFHService(IConnectionService connectionService, ICredentialService credentialService)
|
||||||
{
|
{
|
||||||
_ConnectionService = connectionService;
|
_ConnectionService = connectionService;
|
||||||
_CredentialService = new CredentialService();
|
_CredentialService = credentialService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Model.Connection ActiveConnection { get; private set; }
|
public Model.Connection ActiveConnection { get; private set; }
|
||||||
|
@ -61,7 +61,7 @@ namespace FabAccessAPI_Test {
|
|||||||
Assert.NotNull(testmachine);
|
Assert.NotNull(testmachine);
|
||||||
var minfo = await testmachine.GetMInfo();
|
var minfo = await testmachine.GetMInfo();
|
||||||
Assert.NotNull(minfo);
|
Assert.NotNull(minfo);
|
||||||
_Log.Info($"Name: {minfo.Name}, Description: {minfo.Description}, State: {minfo.State.ToString()}");
|
_Log.Info($"Name: {minfo.Name}, Description: {minfo.Description}, State: {minfo.State}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user