mirror of
https://gitlab.com/fabinfra/fabaccess/borepin.git
synced 2025-03-12 23:01:52 +01:00
Added: New API Struktur
This commit is contained in:
parent
f54e6ed98b
commit
91f71083fa
@ -79,6 +79,7 @@
|
||||
<Compile Include="Services\APIBinder.cs" />
|
||||
<Compile Include="Services\APIBindedService.cs" />
|
||||
<Compile Include="Services\APIService.cs" />
|
||||
<Compile Include="Services\APIService_New.cs" />
|
||||
<Compile Include="Services\APIServiceConnection.cs" />
|
||||
<Compile Include="Services\PreferenceStorageService.cs" />
|
||||
<Compile Include="Services\SecretStorage.cs" />
|
||||
|
@ -1,6 +1,4 @@
|
||||
using Android.App;
|
||||
using Android.Content;
|
||||
using Borepin.Service;
|
||||
using Borepin.Service;
|
||||
using FabAccessAPI;
|
||||
|
||||
namespace Borepin.Droid.Services
|
||||
@ -8,21 +6,18 @@ namespace Borepin.Droid.Services
|
||||
public class APIService : IAPIService
|
||||
{
|
||||
#region Private Members
|
||||
private readonly APIServiceConnection _APIServiceConnection;
|
||||
private readonly IAPI _API;
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
public APIService()
|
||||
{
|
||||
Context context = Application.Context;
|
||||
Intent service = new Intent(context, typeof(APIBindedService));
|
||||
context.BindService(service, _APIServiceConnection, Bind.AutoCreate);
|
||||
_API = new API();
|
||||
}
|
||||
#endregion
|
||||
|
||||
public IAPI GetAPI()
|
||||
{
|
||||
return _APIServiceConnection?.Binder?.Service?.GetAPI();
|
||||
return _API;
|
||||
}
|
||||
}
|
||||
}
|
28
Borepin/Borepin.Android/Services/APIService_New.cs
Normal file
28
Borepin/Borepin.Android/Services/APIService_New.cs
Normal file
@ -0,0 +1,28 @@
|
||||
using Android.App;
|
||||
using Android.Content;
|
||||
using Borepin.Service;
|
||||
using FabAccessAPI;
|
||||
|
||||
namespace Borepin.Droid.Services
|
||||
{
|
||||
public class APIService_New : IAPIService
|
||||
{
|
||||
#region Private Members
|
||||
private readonly APIServiceConnection _APIServiceConnection;
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
public APIService_New()
|
||||
{
|
||||
Context context = Application.Context;
|
||||
Intent service = new Intent(context, typeof(APIBindedService));
|
||||
context.BindService(service, _APIServiceConnection, Bind.AutoCreate);
|
||||
}
|
||||
#endregion
|
||||
|
||||
public IAPI GetAPI()
|
||||
{
|
||||
return _APIServiceConnection?.Binder?.Service?.GetAPI();
|
||||
}
|
||||
}
|
||||
}
|
@ -110,26 +110,6 @@ namespace Borepin.PageModel
|
||||
|
||||
await _NavigationService.NavigateAsync("ScanPage", parameters).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
public async void ScanCode_Result(string value)
|
||||
{
|
||||
if (! _API.IsConnected)
|
||||
{
|
||||
IsConnected = false;
|
||||
IsBusy = false;
|
||||
return;
|
||||
}
|
||||
|
||||
Machine machine = (await _API.Session.MachineSystem.Info.GetMachineURN(value).ConfigureAwait(false)).Just;
|
||||
|
||||
if(machine == null)
|
||||
{
|
||||
IsBusy = false;
|
||||
return;
|
||||
}
|
||||
|
||||
IsBusy = false;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
@ -97,7 +97,7 @@ namespace Borepin.PageModel
|
||||
{
|
||||
NavigationParameters parameters = new NavigationParameters
|
||||
{
|
||||
{ "id", id },
|
||||
{ "instance", id },
|
||||
};
|
||||
|
||||
Device.BeginInvokeOnMainThread(async () =>
|
||||
|
@ -177,8 +177,8 @@ namespace Borepin.PageModel
|
||||
}
|
||||
public async Task DisonnectCommandExecute()
|
||||
{
|
||||
await _API.Disconnect().ConfigureAwait(false);
|
||||
_API.UnbindAllEvents();
|
||||
await _API.Disconnect().ConfigureAwait(false);
|
||||
|
||||
await LoadInstance(Connection_Item).ConfigureAwait(false);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user