mirror of
https://gitlab.com/fabinfra/fabaccess/borepin.git
synced 2025-03-12 06:41:54 +01:00
Added: Unlock and Identify Button
This commit is contained in:
parent
1a7e4ed236
commit
bbbe3e7e2e
@ -75,6 +75,7 @@ namespace Borepin.Model
|
||||
CanManage = !((ManageInterface_Proxy)_Machine.Manage).IsNull;
|
||||
CanAdmin = !((AdminInterface_Proxy)_Machine.Admin).IsNull;
|
||||
CanNotUseByPermission = State == MachineState.free && !CanUse;
|
||||
IsLock = !((ProdInterface_Proxy)_Machine.Prodable).IsNull;
|
||||
}
|
||||
#endregion
|
||||
|
||||
@ -197,6 +198,13 @@ namespace Borepin.Model
|
||||
get => _CanNotUseByPermission;
|
||||
set => SetProperty(ref _CanNotUseByPermission, value);
|
||||
}
|
||||
|
||||
private bool _IsLock;
|
||||
public bool IsLock
|
||||
{
|
||||
get => _IsLock;
|
||||
set => SetProperty(ref _IsLock, value);
|
||||
}
|
||||
#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}"/>
|
||||
<Label Text="{x:Static resource_text:TextResource.MachinePage_CanNotUseByPermission}" IsVisible="{Binding MachineItem.CanNotUseByPermission}" Style="{StaticResource Style_Label_Text_Center}"/>
|
||||
<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}"/>
|
||||
<StackLayout Grid.Row="2" VerticalOptions="End" IsVisible="{Binding MachineItem.CanManage}">
|
||||
<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 System;
|
||||
using Borepin.Service.Browser;
|
||||
using System.Text;
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
|
@ -504,6 +504,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>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die Last User: ähnelt.
|
||||
/// </summary>
|
||||
|
@ -284,6 +284,9 @@ Ask in your Space if you can be trained on the machine to be unlocked for the ma
|
||||
<data name="MachinePage_GiveBack" xml:space="preserve">
|
||||
<value>GiveBack</value>
|
||||
</data>
|
||||
<data name="MachinePage_Identify" xml:space="preserve">
|
||||
<value>Identify</value>
|
||||
</data>
|
||||
<data name="MachinePage_LastUser" xml:space="preserve">
|
||||
<value>Last User:</value>
|
||||
</data>
|
||||
|
Loading…
x
Reference in New Issue
Block a user