mirror of
https://gitlab.com/fabinfra/fabaccess/borepin.git
synced 2025-03-12 14:51:44 +01:00
Merge branch 'feature/opendoor' into feature/NFC
This commit is contained in:
commit
f42bcfd3a1
@ -80,6 +80,7 @@ namespace Borepin.Model
|
|||||||
CanManage = !((ManageInterface_Proxy)_Machine.Manage).IsNull;
|
CanManage = !((ManageInterface_Proxy)_Machine.Manage).IsNull;
|
||||||
CanAdmin = !((AdminInterface_Proxy)_Machine.Admin).IsNull;
|
CanAdmin = !((AdminInterface_Proxy)_Machine.Admin).IsNull;
|
||||||
CanNotUseByPermission = State == MachineState.free && !CanUse;
|
CanNotUseByPermission = State == MachineState.free && !CanUse;
|
||||||
|
IsLock = !((ProdInterface_Proxy)_Machine.Prodable).IsNull;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@ -202,6 +203,13 @@ namespace Borepin.Model
|
|||||||
get => _CanNotUseByPermission;
|
get => _CanNotUseByPermission;
|
||||||
set => SetProperty(ref _CanNotUseByPermission, value);
|
set => SetProperty(ref _CanNotUseByPermission, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool _IsLock;
|
||||||
|
public bool IsLock
|
||||||
|
{
|
||||||
|
get => _IsLock;
|
||||||
|
set => SetProperty(ref _IsLock, value);
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -46,6 +46,25 @@
|
|||||||
<Button Text="{x:Static resource_text:TextResource.MachinePage_Use}" IsVisible="{Binding MachineItem.CanUse}" Command="{Binding UseMachineCommand}" Style="{StaticResource Style_Button_Primary}"/>
|
<Button Text="{x:Static resource_text:TextResource.MachinePage_Use}" IsVisible="{Binding MachineItem.CanUse}" Command="{Binding UseMachineCommand}" Style="{StaticResource Style_Button_Primary}"/>
|
||||||
<Label Text="{x:Static resource_text:TextResource.MachinePage_CanNotUseByPermission}" IsVisible="{Binding MachineItem.CanNotUseByPermission}" Style="{StaticResource Style_Label_Text_Center}" TextColor="{StaticResource FourthColor}"/>
|
<Label Text="{x:Static resource_text:TextResource.MachinePage_CanNotUseByPermission}" IsVisible="{Binding MachineItem.CanNotUseByPermission}" Style="{StaticResource Style_Label_Text_Center}" TextColor="{StaticResource FourthColor}"/>
|
||||||
<Button Text="{x:Static resource_text:TextResource.MachinePage_GiveBack}" IsVisible="{Binding MachineItem.CanInUse}" Command="{Binding GiveBackMachineCommand}" Style="{StaticResource Style_Button_Primary}"/>
|
<Button Text="{x:Static resource_text:TextResource.MachinePage_GiveBack}" IsVisible="{Binding MachineItem.CanInUse}" Command="{Binding GiveBackMachineCommand}" Style="{StaticResource Style_Button_Primary}"/>
|
||||||
|
|
||||||
|
<Button Text="{x:Static resource_text:TextResource.MachinePage_Unlock}" Command="{Binding UnlockLockCommand}" Style="{StaticResource Style_Button_Primary}">
|
||||||
|
<Button.IsVisible>
|
||||||
|
<MultiBinding Converter="{StaticResource AllTrueBoolConverter}">
|
||||||
|
<Binding Path="MachineItem.CanInUse" Converter="{StaticResource InvertBoolConverter}"/>
|
||||||
|
<Binding Path="MachineItem.IsLock" />
|
||||||
|
</MultiBinding>
|
||||||
|
</Button.IsVisible>
|
||||||
|
</Button>
|
||||||
|
<Button Text="{x:Static resource_text:TextResource.MachinePage_Identify}" Command="{Binding IdentifyLockCommand}" Style="{StaticResource Style_Button_Primary}">
|
||||||
|
<Button.IsVisible>
|
||||||
|
<MultiBinding Converter="{StaticResource AllTrueBoolConverter}">
|
||||||
|
<Binding Path="MachineItem.CanInUse" Converter="{StaticResource InvertBoolConverter}"/>
|
||||||
|
<Binding Path="MachineItem.IsLock" />
|
||||||
|
</MultiBinding>
|
||||||
|
</Button.IsVisible>
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
|
||||||
<Button VerticalOptions="End" Text="{x:Static resource_text:TextResource.MachinePage_OpenWiki}" IsVisible="{Binding MachineItem.Wiki, Converter={StaticResource IsNotNullBoolConverter}}" Command="{Binding OpenWikiCommand}" Style="{StaticResource Style_Button_Primary}"/>
|
<Button VerticalOptions="End" Text="{x:Static resource_text:TextResource.MachinePage_OpenWiki}" IsVisible="{Binding MachineItem.Wiki, Converter={StaticResource IsNotNullBoolConverter}}" Command="{Binding OpenWikiCommand}" Style="{StaticResource Style_Button_Primary}"/>
|
||||||
<StackLayout Grid.Row="2" VerticalOptions="End" IsVisible="{Binding MachineItem.CanManage}" Margin="0,50,0,0">
|
<StackLayout Grid.Row="2" VerticalOptions="End" IsVisible="{Binding MachineItem.CanManage}" Margin="0,50,0,0">
|
||||||
<Label Text="{x:Static resource_text:TextResource.MachinePage_ManageMachine}" Style="{StaticResource Style_Label_Property_Title}"/>
|
<Label Text="{x:Static resource_text:TextResource.MachinePage_ManageMachine}" Style="{StaticResource Style_Label_Property_Title}"/>
|
||||||
|
@ -11,6 +11,7 @@ using Borepin.Base.Exceptions;
|
|||||||
using Capnp.Rpc;
|
using Capnp.Rpc;
|
||||||
using System;
|
using System;
|
||||||
using Borepin.Service.Browser;
|
using Borepin.Service.Browser;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
namespace Borepin.PageModel
|
namespace Borepin.PageModel
|
||||||
{
|
{
|
||||||
@ -236,6 +237,60 @@ namespace Borepin.PageModel
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ICommand _UnlockLockCommand;
|
||||||
|
public ICommand UnlockLockCommand
|
||||||
|
{
|
||||||
|
get => _UnlockLockCommand;
|
||||||
|
set => SetProperty(ref _UnlockLockCommand, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async void UnlockLockCommandExecute()
|
||||||
|
{
|
||||||
|
IsBusy = true;
|
||||||
|
|
||||||
|
if (_API.IsConnected)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Machine.IProdInterface prodInterface = _Machine.Prodable;
|
||||||
|
await prodInterface.ProdWithData(Encoding.ASCII.GetBytes("action: unlock")).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
catch (RpcException exception) when (string.Equals(exception.Message, "RPC connection is broken. Task would never return.", StringComparison.Ordinal))
|
||||||
|
{
|
||||||
|
Log.Debug("RPC Connection Loss");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
IsBusy = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private ICommand _IdentifyLockCommand;
|
||||||
|
public ICommand IdentifyLockCommand
|
||||||
|
{
|
||||||
|
get => _IdentifyLockCommand;
|
||||||
|
set => SetProperty(ref _IdentifyLockCommand, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async void IdentifyLockCommandExecute()
|
||||||
|
{
|
||||||
|
IsBusy = true;
|
||||||
|
|
||||||
|
if (_API.IsConnected)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Machine.IProdInterface prodInterface = _Machine.Prodable;
|
||||||
|
await prodInterface.ProdWithData(Encoding.ASCII.GetBytes("action: identify")).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
catch (RpcException exception) when (string.Equals(exception.Message, "RPC connection is broken. Task would never return.", StringComparison.Ordinal))
|
||||||
|
{
|
||||||
|
Log.Debug("RPC Connection Loss");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
IsBusy = false;
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -531,6 +531,15 @@ namespace Borepin.Resources.Text {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sucht eine lokalisierte Zeichenfolge, die Identify ähnelt.
|
||||||
|
/// </summary>
|
||||||
|
internal static string MachinePage_Identify {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("MachinePage_Identify", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sucht eine lokalisierte Zeichenfolge, die Last User: ähnelt.
|
/// Sucht eine lokalisierte Zeichenfolge, die Last User: ähnelt.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -293,6 +293,9 @@ Please speak with the staff at the Space to receive the necessary training and a
|
|||||||
<data name="MachinePage_GiveBack" xml:space="preserve">
|
<data name="MachinePage_GiveBack" xml:space="preserve">
|
||||||
<value>GiveBack</value>
|
<value>GiveBack</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="MachinePage_Identify" xml:space="preserve">
|
||||||
|
<value>Identify</value>
|
||||||
|
</data>
|
||||||
<data name="MachinePage_LastUser" xml:space="preserve">
|
<data name="MachinePage_LastUser" xml:space="preserve">
|
||||||
<value>Last User:</value>
|
<value>Last User:</value>
|
||||||
</data>
|
</data>
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using FabAccessAPI;
|
using FabAccessAPI;
|
||||||
|
using NUnit.Framework;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
@ -11,6 +12,7 @@ namespace FabAccessAPI_Test
|
|||||||
public const int TESTSERVER_PORT = 59661;
|
public const int TESTSERVER_PORT = 59661;
|
||||||
public const string PASSWORD = "secret";
|
public const string PASSWORD = "secret";
|
||||||
|
|
||||||
|
[TestCase("Testuser")]
|
||||||
public static ConnectionData CreateConnetionData(string username)
|
public static ConnectionData CreateConnetionData(string username)
|
||||||
{
|
{
|
||||||
ConnectionData connectionData = new ConnectionData()
|
ConnectionData connectionData = new ConnectionData()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user