mirror of
https://gitlab.com/fabinfra/fabaccess/borepin.git
synced 2025-03-12 23:01:52 +01:00
Changed: MachinePage to new Machine API
This commit is contained in:
parent
3be3bbabea
commit
dfeb167691
@ -41,16 +41,18 @@ namespace Borepin
|
||||
containerRegistry.RegisterForNavigation<MachinePage, MachinePageModel>();
|
||||
containerRegistry.RegisterForNavigation<SettingsPage>();
|
||||
containerRegistry.RegisterForNavigation<MachineListPage, MachineListPageModel>();
|
||||
containerRegistry.RegisterForNavigation<LoginPasswordPage, LoginPasswordPageModel>("AddServerProcess_LoginPasswordPage");
|
||||
containerRegistry.RegisterForNavigation<HostSelectPage, HostSelectPageModel>("AddServerProcess_HostSelectPage");
|
||||
containerRegistry.RegisterForNavigation<LoginChoosePage, LoginChoosePageModel>("AddServerProcess_LoginChoosePage");
|
||||
containerRegistry.RegisterForNavigation<ServerListPage, ServerListPageModel>();
|
||||
containerRegistry.RegisterForNavigation<ServerPage, ServerPageModel>();
|
||||
containerRegistry.RegisterForNavigation<ListPage, ListPageModel>();
|
||||
containerRegistry.RegisterForNavigation<TestPage, TestPageModel>();
|
||||
|
||||
containerRegistry.RegisterForNavigation<WelcomePage, WelcomePageModel>("SetUpProcess_WelcomePage");
|
||||
containerRegistry.RegisterForNavigation<ScanPage, ScanPageModel>("SetUpProcess_ScanPage");
|
||||
|
||||
containerRegistry.RegisterForNavigation<LoginPasswordPage, LoginPasswordPageModel>("AddServerProcess_LoginPasswordPage");
|
||||
containerRegistry.RegisterForNavigation<HostSelectPage, HostSelectPageModel>("AddServerProcess_HostSelectPage");
|
||||
containerRegistry.RegisterForNavigation<LoginChoosePage, LoginChoosePageModel>("AddServerProcess_LoginChoosePage");
|
||||
|
||||
// Register Dialog
|
||||
containerRegistry.RegisterDialog<ConfirmDialog, ConfirmDialogModel>();
|
||||
|
||||
|
@ -98,6 +98,9 @@
|
||||
<EmbeddedResource Update="Page\SetUpProcess\WelcomePage.xaml">
|
||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Update="Page\StartUpDistributorPage.xaml">
|
||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Update="Page\TestPage.xaml">
|
||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||
</EmbeddedResource>
|
||||
|
@ -21,8 +21,8 @@
|
||||
<StackLayout IsVisible="{Binding IsBusy, Converter={StaticResource InvertBoolConverter}}">
|
||||
<Label Text="{Binding Name}" Style="{StaticResource LabelStyle_Title}"/>
|
||||
|
||||
<Button Text="Use" Command="{Binding UseMachineCommand}" IsVisible="{Binding CanUse}" Style="{StaticResource Style_Button_Primary}"/>
|
||||
<Button Text="GiveBack" Command="{Binding GiveBackMachineCommand}" IsVisible="{Binding CanGiveBack}" Style="{StaticResource Style_Button_Primary}"/>
|
||||
<Button Text="Use" Command="{Binding UseMachineCommand}" IsVisible="{Binding MachineItem.Use, Converter=IsNotNullBoolConverter}" Style="{StaticResource Style_Button_Primary}"/>
|
||||
<Button Text="GiveBack" Command="{Binding GiveBackMachineCommand}" IsVisible="{Binding MachineItem.Inuse, Converter=IsNotNullBoolConverter}" Style="{StaticResource Style_Button_Primary}"/>
|
||||
</StackLayout>
|
||||
</StackLayout>
|
||||
</ContentPage.Content>
|
||||
|
@ -5,8 +5,8 @@ using System.Windows.Input;
|
||||
using Prism.Commands;
|
||||
using Prism.Navigation;
|
||||
using Borepin.Service.BFFH;
|
||||
using Borepin.Model;
|
||||
using Borepin.Base;
|
||||
using FabAccessAPI.Schema;
|
||||
|
||||
namespace Borepin.PageModel
|
||||
{
|
||||
@ -37,22 +37,18 @@ namespace Borepin.PageModel
|
||||
IsConnected = true;
|
||||
}
|
||||
|
||||
FabAccessAPI.Schema.IMachineSystem machineInterface = await _BFFHService.GetMachineSystemInterface();
|
||||
FabAccessAPI.Schema.MachineSystem.IInfoInterface infoInterface = await machineInterface.Info();
|
||||
IMachineSystem machineInterface = await _BFFHService.GetMachineSystemInterface();
|
||||
MachineSystem.IInfoInterface infoInterface = await machineInterface.Info();
|
||||
|
||||
//IReadOnlyList<FabAccessAPI.Machine> machine_list = await machineInterface.Info();
|
||||
//foreach (FabAccessAPI.Machine machine in machine_list)
|
||||
//{
|
||||
// list.Add(new Machine() { Instance = machine, MInfo = await machine.GetMInfo() });
|
||||
//}
|
||||
IReadOnlyList<Machine> machine_list = await infoInterface.GetMachineList();
|
||||
|
||||
//List<MachineListItemViewModel> viewmodel_list = new List<MachineListItemViewModel>();
|
||||
//foreach (Machine machine in list)
|
||||
//{
|
||||
// viewmodel_list.Add(new MachineListItemViewModel(machine));
|
||||
//}
|
||||
List<MachineListItemViewModel> viewmodel_list = new List<MachineListItemViewModel>();
|
||||
foreach (Machine machine in machine_list)
|
||||
{
|
||||
viewmodel_list.Add(new MachineListItemViewModel(machine));
|
||||
}
|
||||
|
||||
MachineListItemViewModel_List = null;//viewmodel_list;
|
||||
MachineListItemViewModel_List = viewmodel_list;
|
||||
|
||||
IsBusy = false;
|
||||
}
|
||||
@ -87,7 +83,7 @@ namespace Borepin.PageModel
|
||||
|
||||
NavigationParameters parameters = new NavigationParameters
|
||||
{
|
||||
//{ "instance", viewmodel.Instance }
|
||||
{ "id", viewmodel.Instance.Id }
|
||||
};
|
||||
|
||||
INavigationResult result = await _NavigationService.NavigateAsync($"MachinePage", parameters);
|
||||
|
@ -1,66 +1,56 @@
|
||||
using Borepin.Base;
|
||||
using Borepin.Model;
|
||||
using Prism.Commands;
|
||||
using Prism.Navigation;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
using FabAccessAPI.Schema;
|
||||
using Borepin.Service.BFFH;
|
||||
using static FabAccessAPI.Schema.MachineSystem;
|
||||
|
||||
namespace Borepin.PageModel
|
||||
{
|
||||
public class MachinePageModel : PageModelBase
|
||||
{
|
||||
#region Private Properties
|
||||
private IBFFHService _BFFHService;
|
||||
private UUID _ID;
|
||||
#endregion
|
||||
|
||||
#region Contructors
|
||||
public MachinePageModel(INavigationService navigationService) : base(navigationService)
|
||||
public MachinePageModel(INavigationService navigationService, IBFFHService bffhService) : base(navigationService)
|
||||
{
|
||||
_BFFHService = bffhService;
|
||||
|
||||
UseMachineCommand = new DelegateCommand(UseMachineCommandExecuted);
|
||||
GiveBackMachineCommand = new DelegateCommand(GiveBackMachineCommandExecuted);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Data
|
||||
public override Task LoadData()
|
||||
public override async Task LoadData()
|
||||
{
|
||||
//Name = MachineItem.MInfo.Name;
|
||||
IMachineSystem machineSystem = await _BFFHService.GetMachineSystemInterface();
|
||||
|
||||
IInfoInterface info = await machineSystem.Info();
|
||||
|
||||
MachineItem = (await info.GetMachine(_ID)).Item1;
|
||||
|
||||
IsBusy = false;
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
//private Machine _MachineItem;
|
||||
//public Machine MachineItem
|
||||
//{
|
||||
// get => _MachineItem;
|
||||
// set => SetProperty(ref _MachineItem, value);
|
||||
//}
|
||||
|
||||
private string _Name;
|
||||
public string Name
|
||||
private Machine _MachineItem;
|
||||
public Machine MachineItem
|
||||
{
|
||||
get => _Name;
|
||||
set => SetProperty(ref _Name, value);
|
||||
}
|
||||
|
||||
private bool _CanUse;
|
||||
public bool CanUse
|
||||
{
|
||||
get => _CanUse;
|
||||
set => SetProperty(ref _CanUse, value);
|
||||
}
|
||||
|
||||
private bool _CanGiveBack;
|
||||
public bool CanGiveBack
|
||||
{
|
||||
get => _CanGiveBack;
|
||||
set => SetProperty(ref _CanGiveBack, value);
|
||||
get => _MachineItem;
|
||||
set => SetProperty(ref _MachineItem, value);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Commands
|
||||
private ICommand _UseMachineCommand;
|
||||
|
||||
public ICommand UseMachineCommand
|
||||
{
|
||||
get => _UseMachineCommand;
|
||||
@ -69,12 +59,9 @@ namespace Borepin.PageModel
|
||||
|
||||
private async void UseMachineCommandExecuted()
|
||||
{
|
||||
//GiveBack = await MachineItem.Instance.Use();
|
||||
//CanGiveBack = GiveBack != null;
|
||||
Machine.IUseInterface useInterface = MachineItem.Use;
|
||||
|
||||
//MachineItem.MInfo = await MachineItem.Instance.GetMInfo();
|
||||
|
||||
//CanUse = MachineItem.MInfo.State == FabAccessAPI.Schema.Machine.MachineState.free;
|
||||
await useInterface.Use();
|
||||
}
|
||||
|
||||
private ICommand _GiveBackMachineCommand;
|
||||
@ -86,14 +73,9 @@ namespace Borepin.PageModel
|
||||
|
||||
private async void GiveBackMachineCommandExecuted()
|
||||
{
|
||||
//await GiveBack.Ret();
|
||||
Machine.IInUseInterface inUseInterface = MachineItem.Inuse;
|
||||
|
||||
//GiveBack = null;
|
||||
//CanGiveBack = GiveBack != null;
|
||||
|
||||
//MachineItem.MInfo = await MachineItem.Instance.GetMInfo();
|
||||
|
||||
//CanUse = MachineItem.MInfo.State == FabAccessAPI.Schema.Machine.MachineState.free;
|
||||
await inUseInterface.GiveBack();
|
||||
}
|
||||
#endregion
|
||||
|
||||
@ -105,7 +87,7 @@ namespace Borepin.PageModel
|
||||
|
||||
public override void OnNavigatedTo(INavigationParameters parameters)
|
||||
{
|
||||
//MachineItem = parameters["instance"] as Machine;
|
||||
MachineItem = parameters["instance"] as Machine;
|
||||
|
||||
IsBusy = true;
|
||||
Task.Run(LoadData);
|
||||
|
@ -1,23 +1,24 @@
|
||||
using Prism.Mvvm;
|
||||
using FabAccessAPI.Schema;
|
||||
|
||||
namespace Borepin.ViewModel
|
||||
{
|
||||
public class MachineListItemViewModel : BindableBase
|
||||
{
|
||||
public MachineListItemViewModel()//Model.Machine instance)
|
||||
public MachineListItemViewModel(Machine instance)
|
||||
{
|
||||
//_Instance = null;
|
||||
_Instance = instance;
|
||||
|
||||
//Name = instance.MInfo.Name;
|
||||
//State = instance.MInfo.State;
|
||||
Name = instance.Name;
|
||||
State = instance.State;
|
||||
}
|
||||
|
||||
//private Model.Machine _Instance;
|
||||
//public Model.Machine Instance
|
||||
//{
|
||||
// get => _Instance;
|
||||
// set => SetProperty(ref _Instance, value);
|
||||
//}
|
||||
private Machine _Instance;
|
||||
public Machine Instance
|
||||
{
|
||||
get => _Instance;
|
||||
set => SetProperty(ref _Instance, value);
|
||||
}
|
||||
|
||||
private string _Name;
|
||||
public string Name
|
||||
@ -26,8 +27,8 @@ namespace Borepin.ViewModel
|
||||
set => SetProperty(ref _Name, value);
|
||||
}
|
||||
|
||||
private FabAccessAPI.Schema.Machine.MachineState _State;
|
||||
public FabAccessAPI.Schema.Machine.MachineState State
|
||||
private Machine.MachineState _State;
|
||||
public Machine.MachineState State
|
||||
{
|
||||
get => _State;
|
||||
set => SetProperty(ref _State, value);
|
||||
|
Loading…
x
Reference in New Issue
Block a user