mirror of
https://gitlab.com/fabinfra/fabaccess/borepin.git
synced 2025-03-12 14:51:44 +01:00
Added: IsBusy
This commit is contained in:
parent
158cab6b23
commit
8d6bd2a1e4
@ -39,6 +39,7 @@ namespace Borepin
|
||||
result = await NavigationService.NavigateAsync("/MainPage/NavigationPage/ServerListPage");
|
||||
}
|
||||
|
||||
//result = await NavigationService.NavigateAsync("/NavigationPage/TestPage");
|
||||
if (!result.Success)
|
||||
{
|
||||
System.Diagnostics.Debugger.Break();
|
||||
@ -59,6 +60,7 @@ namespace Borepin
|
||||
containerRegistry.RegisterForNavigation<ServerListPage, ServerListPageModel>();
|
||||
containerRegistry.RegisterForNavigation<ServerPage, ServerPageModel>();
|
||||
containerRegistry.RegisterForNavigation<ListPage, ListPageModel>();
|
||||
containerRegistry.RegisterForNavigation<TestPage, TestPageModel>();
|
||||
|
||||
// Register Dialog
|
||||
containerRegistry.RegisterDialog<ConfirmDialog, ConfirmDialogModel>();
|
||||
|
48
Borepin/Borepin/Base/PageModelBase.cs
Normal file
48
Borepin/Borepin/Base/PageModelBase.cs
Normal file
@ -0,0 +1,48 @@
|
||||
using Prism.Mvvm;
|
||||
using Prism.Navigation;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Borepin.Base
|
||||
{
|
||||
/// <summary>
|
||||
/// Base for all BFFH Based PageModels
|
||||
/// </summary>
|
||||
public abstract class PageModelBase : BindableBase, INavigationAware
|
||||
{
|
||||
#region Private Properties
|
||||
protected readonly INavigationService _NavigationService;
|
||||
#endregion
|
||||
|
||||
#region Contructors
|
||||
public PageModelBase(INavigationService navigationService)
|
||||
{
|
||||
_NavigationService = navigationService;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
/// <summary>
|
||||
/// PageModel is Busy
|
||||
/// </summary>
|
||||
private bool _IsBusy = true;
|
||||
public bool IsBusy
|
||||
{
|
||||
get => _IsBusy;
|
||||
set => SetProperty(ref _IsBusy, value);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Data
|
||||
/// <summary>
|
||||
/// Load Data async
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public abstract Task<bool> LoadData();
|
||||
#endregion
|
||||
|
||||
#region INavigationAware
|
||||
public abstract void OnNavigatedFrom(INavigationParameters parameters);
|
||||
public abstract void OnNavigatedTo(INavigationParameters parameters);
|
||||
#endregion
|
||||
}
|
||||
}
|
@ -82,6 +82,9 @@
|
||||
<EmbeddedResource Update="Page\SettingsPage.xaml">
|
||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Update="Page\TestPage.xaml">
|
||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Update="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
@ -93,6 +96,9 @@
|
||||
<EmbeddedResource Update="Styles\LightTheme.xaml">
|
||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Update="View\IsBusyView.xaml">
|
||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Update="View\ListItemView.xaml">
|
||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||
</EmbeddedResource>
|
||||
@ -101,7 +107,6 @@
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Base\" />
|
||||
<Folder Include="Behaviour\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@ -2,12 +2,22 @@
|
||||
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:views="clr-namespace:Borepin.View"
|
||||
x:Class="Borepin.Page.MachineListPage">
|
||||
x:Class="Borepin.Page.MachineListPage"
|
||||
xmlns:converters="clr-namespace:Borepin.Converter">
|
||||
<NavigationPage.TitleView>
|
||||
<Label Text="Machines" HorizontalOptions="End" Margin="0, 0, 10, 0" VerticalOptions="CenterAndExpand" FontSize="Medium" TextColor="{StaticResource FirstColor}"/>
|
||||
</NavigationPage.TitleView>
|
||||
<ContentPage.Resources>
|
||||
<ResourceDictionary>
|
||||
<converters:InvertBoolConverter x:Key="InvertBoolConverter"/>
|
||||
</ResourceDictionary>
|
||||
</ContentPage.Resources>
|
||||
<ContentPage.Content>
|
||||
<StackLayout>
|
||||
<StackLayout Padding="20">
|
||||
<StackLayout IsVisible="{Binding IsBusy}">
|
||||
<ActivityIndicator IsRunning="{Binding IsBusy}"></ActivityIndicator>
|
||||
</StackLayout>
|
||||
<StackLayout IsVisible="{Binding IsBusy, Converter={StaticResource InvertBoolConverter}}">
|
||||
<ListView ItemsSource="{Binding MachineListItemViewModel_List}">
|
||||
<ListView.ItemTemplate>
|
||||
<DataTemplate>
|
||||
@ -18,5 +28,6 @@
|
||||
</ListView.ItemTemplate>
|
||||
</ListView>
|
||||
</StackLayout>
|
||||
</StackLayout>
|
||||
</ContentPage.Content>
|
||||
</ContentPage>
|
@ -10,14 +10,20 @@
|
||||
<ResourceDictionary>
|
||||
<converters:MachineStateColorConverter x:Key="MachineStateColorConverter"/>
|
||||
<converters:IsNotNullBoolConverter x:Key="IsNotNullBoolConverter"/>
|
||||
<converters:InvertBoolConverter x:Key="InvertBoolConverter"/>
|
||||
</ResourceDictionary>
|
||||
</ContentPage.Resources>
|
||||
<ContentPage.Content>
|
||||
<StackLayout Padding="20">
|
||||
<StackLayout IsVisible="{Binding IsBusy}">
|
||||
<ActivityIndicator IsRunning="{Binding IsBusy}"></ActivityIndicator>
|
||||
</StackLayout>
|
||||
<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 ButtonStyle_Primary}"/>
|
||||
<Button Text="GiveBack" Command="{Binding GiveBackMachineCommand}" IsVisible="{Binding CanGiveBack}" Style="{StaticResource ButtonStyle_Primary}"/>
|
||||
</StackLayout>
|
||||
</StackLayout>
|
||||
</ContentPage.Content>
|
||||
</ContentPage>
|
@ -2,12 +2,22 @@
|
||||
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:views="clr-namespace:Borepin.View"
|
||||
x:Class="Borepin.Page.ServerListPage">
|
||||
x:Class="Borepin.Page.ServerListPage"
|
||||
xmlns:converters="clr-namespace:Borepin.Converter">
|
||||
<NavigationPage.TitleView>
|
||||
<Label Text="Servers" HorizontalOptions="End" Margin="0, 0, 10, 0" VerticalOptions="CenterAndExpand" FontSize="Medium" TextColor="{StaticResource FirstColor}"/>
|
||||
</NavigationPage.TitleView>
|
||||
<ContentPage.Resources>
|
||||
<ResourceDictionary>
|
||||
<converters:InvertBoolConverter x:Key="InvertBoolConverter"/>
|
||||
</ResourceDictionary>
|
||||
</ContentPage.Resources>
|
||||
<ContentPage.Content>
|
||||
<StackLayout>
|
||||
<StackLayout Padding="20">
|
||||
<StackLayout IsVisible="{Binding IsBusy}">
|
||||
<ActivityIndicator IsRunning="{Binding IsBusy}"></ActivityIndicator>
|
||||
</StackLayout>
|
||||
<StackLayout IsVisible="{Binding IsBusy, Converter={StaticResource InvertBoolConverter}}">
|
||||
<Label Text="Active Connection" IsVisible="{Binding HasActiveConnection}"/>
|
||||
<ListView ItemsSource="{Binding ActiveConnection}" IsVisible="{Binding HasActiveConnection}">
|
||||
<ListView.ItemTemplate>
|
||||
@ -30,5 +40,6 @@
|
||||
</ListView>
|
||||
<Button Text="Connect to new Server" Command="{Binding AddInstancesCommand}"/>
|
||||
</StackLayout>
|
||||
</StackLayout>
|
||||
</ContentPage.Content>
|
||||
</ContentPage>
|
@ -2,18 +2,23 @@
|
||||
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="Borepin.Page.ServerPage"
|
||||
xmlns:converter="clr-namespace:Borepin.Converter">
|
||||
xmlns:converters="clr-namespace:Borepin.Converter">
|
||||
<ContentPage.Resources>
|
||||
<ResourceDictionary>
|
||||
<converter:InvertBoolConverter x:Key="invertBool" />
|
||||
<converters:InvertBoolConverter x:Key="InvertBoolConverter"/>
|
||||
</ResourceDictionary>
|
||||
</ContentPage.Resources>
|
||||
<ContentPage.Content>
|
||||
<StackLayout>
|
||||
<StackLayout Padding="20">
|
||||
<StackLayout IsVisible="{Binding IsBusy}">
|
||||
<ActivityIndicator IsRunning="{Binding IsBusy}"></ActivityIndicator>
|
||||
</StackLayout>
|
||||
<StackLayout IsVisible="{Binding IsBusy, Converter={StaticResource InvertBoolConverter}}">
|
||||
<Label Text="{Binding Connection_Item.Address}"/>
|
||||
<Button IsVisible="{Binding IsConnected, Converter={StaticResource invertBool}}" Text="Connect" Command="{Binding ConnectCommand}"/>
|
||||
<Button IsVisible="{Binding IsConnected, Converter={StaticResource InvertBoolConverter}}" Text="Connect" Command="{Binding ConnectCommand}"/>
|
||||
<Button IsVisible="{Binding IsConnected}" Text="Disconnect" Command="{Binding ConnectCommand}"/>
|
||||
<Button Text="Delete" Command="{Binding DeleteCommand}"/>
|
||||
</StackLayout>
|
||||
</StackLayout>
|
||||
</ContentPage.Content>
|
||||
</ContentPage>
|
21
Borepin/Borepin/Page/TestPage.xaml
Normal file
21
Borepin/Borepin/Page/TestPage.xaml
Normal file
@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="Borepin.Page.TestPage"
|
||||
xmlns:converters="clr-namespace:Borepin.Converter">
|
||||
<ContentPage.Resources>
|
||||
<ResourceDictionary>
|
||||
<converters:InvertBoolConverter x:Key="InvertBoolConverter"/>
|
||||
</ResourceDictionary>
|
||||
</ContentPage.Resources>
|
||||
<ContentPage.Content>
|
||||
<StackLayout Padding="20">
|
||||
<StackLayout IsVisible="{Binding IsBusy}">
|
||||
<ActivityIndicator IsRunning="{Binding IsBusy}"></ActivityIndicator>
|
||||
</StackLayout>
|
||||
<StackLayout IsVisible="{Binding IsBusy, Converter={StaticResource InvertBoolConverter}}">
|
||||
<Label Text="TestPage"/>
|
||||
</StackLayout>
|
||||
</StackLayout>
|
||||
</ContentPage.Content>
|
||||
</ContentPage>
|
20
Borepin/Borepin/Page/TestPage.xaml.cs
Normal file
20
Borepin/Borepin/Page/TestPage.xaml.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.Xaml;
|
||||
|
||||
namespace Borepin.Page
|
||||
{
|
||||
[XamlCompilation(XamlCompilationOptions.Compile)]
|
||||
public partial class TestPage : ContentPage
|
||||
{
|
||||
public TestPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,5 +1,4 @@
|
||||
using Borepin.ViewModel;
|
||||
using Prism.Mvvm;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
@ -8,30 +7,38 @@ using Prism.Navigation;
|
||||
using Borepin.Service.Connections;
|
||||
using Borepin.Service.BFFH;
|
||||
using Borepin.Model;
|
||||
using Borepin.Base;
|
||||
|
||||
namespace Borepin.PageModel
|
||||
{
|
||||
public class MachineListPageModel : BindableBase, INavigationAware
|
||||
public class MachineListPageModel : PageModelBase
|
||||
{
|
||||
private readonly INavigationService _NavigationService;
|
||||
#region Private Properties
|
||||
private readonly IConnectionService _ConnectionService;
|
||||
private readonly IBFFHService _BFFHService;
|
||||
#endregion
|
||||
|
||||
public MachineListPageModel(INavigationService navigationService, IConnectionService connectionService, IBFFHService bffhService)
|
||||
#region Constructors
|
||||
public MachineListPageModel(INavigationService navigationService, IConnectionService connectionService, IBFFHService bFFHService) : base(navigationService)
|
||||
{
|
||||
_NavigationService = navigationService;
|
||||
_ConnectionService = connectionService;
|
||||
_BFFHService = bffhService;
|
||||
_BFFHService = bFFHService;
|
||||
|
||||
SelectInstanceCommand = new DelegateCommand<object>(SelectInstanceCommandExecuted);
|
||||
}
|
||||
#endregion
|
||||
|
||||
private async Task<bool> LoadData()
|
||||
#region Data
|
||||
public override async Task<bool> LoadData()
|
||||
{
|
||||
if (_BFFHService.ActiveConnection == null)
|
||||
{
|
||||
return await Task.FromResult(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
IsConnected = true;
|
||||
}
|
||||
|
||||
FabAccessAPI.Machines machineInterface = await _BFFHService.GetMachineInterface();
|
||||
|
||||
@ -51,10 +58,19 @@ namespace Borepin.PageModel
|
||||
|
||||
MachineListItemViewModel_List = viewmodel_list;
|
||||
|
||||
IsBusy = false;
|
||||
return await Task.FromResult(true);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
private bool _IsConnected = false;
|
||||
public bool IsConnected
|
||||
{
|
||||
get => _IsConnected;
|
||||
set => SetProperty(ref _IsConnected, value);
|
||||
}
|
||||
|
||||
private List<MachineListItemViewModel> _MachineListItemViewModel_List;
|
||||
public List<MachineListItemViewModel> MachineListItemViewModel_List
|
||||
{
|
||||
@ -88,13 +104,14 @@ namespace Borepin.PageModel
|
||||
#endregion
|
||||
|
||||
#region INavigationAware
|
||||
public void OnNavigatedFrom(INavigationParameters parameters)
|
||||
public override void OnNavigatedFrom(INavigationParameters parameters)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void OnNavigatedTo(INavigationParameters parameters)
|
||||
public override void OnNavigatedTo(INavigationParameters parameters)
|
||||
{
|
||||
IsBusy = true;
|
||||
Task.Run(LoadData);
|
||||
}
|
||||
#endregion
|
||||
|
@ -1,26 +1,43 @@
|
||||
using Borepin.Model;
|
||||
using Borepin.Base;
|
||||
using Borepin.Model;
|
||||
using Prism.Commands;
|
||||
using Prism.Mvvm;
|
||||
using Prism.Navigation;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
using static FabAccessAPI.Schema.Machine.WriteInterface;
|
||||
|
||||
namespace Borepin.PageModel
|
||||
{
|
||||
public class MachinePageModel : BindableBase, INavigationAware
|
||||
public class MachinePageModel : PageModelBase
|
||||
{
|
||||
private readonly INavigationService _NavigationService;
|
||||
|
||||
public MachinePageModel(INavigationService navigationService)
|
||||
#region Contructors
|
||||
public MachinePageModel(INavigationService navigationService) : base(navigationService)
|
||||
{
|
||||
_NavigationService = navigationService;
|
||||
|
||||
UseMachineCommand = new DelegateCommand(UseMachineCommandExecuted);
|
||||
GiveBackMachineCommand = new DelegateCommand(GiveBackMachineCommandExecuted);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Data
|
||||
public override async Task<bool> LoadData()
|
||||
{
|
||||
Name = MachineItem.MInfo.Name;
|
||||
|
||||
CanUse = MachineItem.MInfo.State == FabAccessAPI.Schema.State.free;
|
||||
|
||||
//if (GiveBack == null)
|
||||
//{
|
||||
// GiveBack = await MachineItem.Instance.GetGiveBack();
|
||||
//}
|
||||
|
||||
CanGiveBack = GiveBack != null;
|
||||
|
||||
IsBusy = false;
|
||||
return await Task.FromResult(true);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
private Machine _MachineItem;
|
||||
public Machine MachineItem
|
||||
{
|
||||
@ -36,11 +53,11 @@ namespace Borepin.PageModel
|
||||
}
|
||||
|
||||
private IGiveBack _GiveBack;
|
||||
//public IGiveBack GiveBack
|
||||
//{
|
||||
// get => _GiveBack;
|
||||
// set => SetProperty(ref _GiveBack, value);
|
||||
//}
|
||||
public IGiveBack GiveBack
|
||||
{
|
||||
get => _GiveBack;
|
||||
set => SetProperty(ref _GiveBack, value);
|
||||
}
|
||||
|
||||
private bool _CanUse;
|
||||
public bool CanUse
|
||||
@ -55,7 +72,6 @@ namespace Borepin.PageModel
|
||||
get => _CanGiveBack;
|
||||
set => SetProperty(ref _CanGiveBack, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Commands
|
||||
@ -68,8 +84,8 @@ namespace Borepin.PageModel
|
||||
|
||||
private async void UseMachineCommandExecuted()
|
||||
{
|
||||
_GiveBack = await MachineItem.Instance.Use();
|
||||
CanGiveBack = _GiveBack != null;
|
||||
GiveBack = await MachineItem.Instance.Use();
|
||||
CanGiveBack = GiveBack != null;
|
||||
|
||||
MachineItem.MInfo = await MachineItem.Instance.GetMInfo();
|
||||
|
||||
@ -85,10 +101,10 @@ namespace Borepin.PageModel
|
||||
|
||||
private async void GiveBackMachineCommandExecuted()
|
||||
{
|
||||
await _GiveBack.Ret();
|
||||
await GiveBack.Ret();
|
||||
|
||||
_GiveBack = null;
|
||||
CanGiveBack = _GiveBack != null;
|
||||
GiveBack = null;
|
||||
CanGiveBack = GiveBack != null;
|
||||
|
||||
MachineItem.MInfo = await MachineItem.Instance.GetMInfo();
|
||||
|
||||
@ -97,20 +113,18 @@ namespace Borepin.PageModel
|
||||
|
||||
#endregion
|
||||
|
||||
#region INavigationAware
|
||||
public void OnNavigatedFrom(INavigationParameters parameters)
|
||||
#region INavigationService
|
||||
public override void OnNavigatedFrom(INavigationParameters parameters)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void OnNavigatedTo(INavigationParameters parameters)
|
||||
public override void OnNavigatedTo(INavigationParameters parameters)
|
||||
{
|
||||
MachineItem = parameters["instance"] as Machine;
|
||||
|
||||
Name = MachineItem.MInfo.Name;
|
||||
|
||||
CanUse = MachineItem.MInfo.State == FabAccessAPI.Schema.State.free;
|
||||
CanGiveBack = _GiveBack != null;
|
||||
IsBusy = true;
|
||||
Task.Run(LoadData);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
@ -9,26 +9,30 @@ using Prism.Commands;
|
||||
using Prism.Navigation;
|
||||
using Borepin.Service.Connections;
|
||||
using Borepin.Service.BFFH;
|
||||
using Borepin.Base;
|
||||
|
||||
namespace Borepin.PageModel
|
||||
{
|
||||
public class ServerListPageModel : BindableBase, INavigationAware
|
||||
public class ServerListPageModel : PageModelBase
|
||||
{
|
||||
private readonly INavigationService _NavigationService;
|
||||
#region Private Properties
|
||||
private readonly IConnectionService _ConnectionService;
|
||||
private readonly IBFFHService _BFFHService;
|
||||
#endregion
|
||||
|
||||
public ServerListPageModel(INavigationService navigationService, IConnectionService connectionService, IBFFHService bffhService)
|
||||
#region Constructors
|
||||
public ServerListPageModel(INavigationService navigationService, IConnectionService connectionService, IBFFHService bffhService) : base(navigationService)
|
||||
{
|
||||
_NavigationService = navigationService;
|
||||
_ConnectionService = connectionService;
|
||||
_BFFHService = bffhService;
|
||||
|
||||
AddInstancesCommand = new DelegateCommand(AddInstancesCommandExecuted);
|
||||
SelectInstanceCommand = new DelegateCommand<object>(SelectInstanceCommandExecuted);
|
||||
}
|
||||
#endregion
|
||||
|
||||
private async Task<bool> LoadData()
|
||||
#region Data
|
||||
public override async Task<bool> LoadData()
|
||||
{
|
||||
List<Connection> list = await _ConnectionService.GetConnectionList();
|
||||
if (_BFFHService.ActiveConnection != null)
|
||||
@ -47,12 +51,12 @@ namespace Borepin.PageModel
|
||||
HasActiveConnection = false;
|
||||
}
|
||||
|
||||
//list = (List<Connection>)list.OrderBy(x => x.LastTime);
|
||||
|
||||
ServerListItemViewModel_List = list.Select(x => new ServerListItemViewModel(x)).ToList();
|
||||
|
||||
IsBusy = false;
|
||||
return await Task.FromResult(true);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
private List<ServerListItemViewModel> _ServerListItemViewModel_List;
|
||||
@ -117,13 +121,14 @@ namespace Borepin.PageModel
|
||||
#endregion
|
||||
|
||||
#region INavigationAware
|
||||
public void OnNavigatedFrom(INavigationParameters parameters)
|
||||
public override void OnNavigatedFrom(INavigationParameters parameters)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void OnNavigatedTo(INavigationParameters parameters)
|
||||
public override void OnNavigatedTo(INavigationParameters parameters)
|
||||
{
|
||||
IsBusy = true;
|
||||
Task.Run(LoadData);
|
||||
}
|
||||
#endregion
|
||||
|
@ -1,4 +1,5 @@
|
||||
using Borepin.Model;
|
||||
using Borepin.Base;
|
||||
using Borepin.Model;
|
||||
using Borepin.Service.BFFH;
|
||||
using Borepin.Service.Connections;
|
||||
using Borepin.Service.Credentials;
|
||||
@ -11,17 +12,18 @@ using System.Windows.Input;
|
||||
|
||||
namespace Borepin.PageModel
|
||||
{
|
||||
public class ServerPageModel : BindableBase, INavigationAware
|
||||
public class ServerPageModel : PageModelBase
|
||||
{
|
||||
private readonly INavigationService _NavigationService;
|
||||
#region Private Properties
|
||||
private readonly IDialogService _DialogService;
|
||||
private readonly IConnectionService _ConnectionService;
|
||||
private readonly IBFFHService _BFFHService;
|
||||
private readonly ICredentialService _CredentialService;
|
||||
#endregion
|
||||
|
||||
public ServerPageModel(INavigationService navigationService, IDialogService dialogService, IConnectionService connectionService, IBFFHService bffhService, ICredentialService credentialService)
|
||||
#region Constructors
|
||||
public ServerPageModel(INavigationService navigationService, IDialogService dialogService, IConnectionService connectionService, IBFFHService bffhService, ICredentialService credentialService) : base(navigationService)
|
||||
{
|
||||
_NavigationService = navigationService;
|
||||
_DialogService = dialogService;
|
||||
|
||||
_ConnectionService = connectionService;
|
||||
@ -31,6 +33,14 @@ namespace Borepin.PageModel
|
||||
ConnectCommand = new DelegateCommand(async () => await ConnectCommandExecuted());
|
||||
DeleteCommand = new DelegateCommand(DeleteCommandExecuted);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Data
|
||||
public override Task<bool> LoadData()
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
private Connection _Connection_Item;
|
||||
@ -58,6 +68,8 @@ namespace Borepin.PageModel
|
||||
|
||||
private async Task ConnectCommandExecuted()
|
||||
{
|
||||
IsBusy = true;
|
||||
|
||||
if(IsConnected)
|
||||
{
|
||||
_BFFHService.Disconnect();
|
||||
@ -71,6 +83,8 @@ namespace Borepin.PageModel
|
||||
|
||||
IsConnected = true;
|
||||
}
|
||||
|
||||
IsBusy = false;
|
||||
}
|
||||
|
||||
private ICommand _DeleteCommand;
|
||||
@ -122,12 +136,12 @@ namespace Borepin.PageModel
|
||||
#endregion
|
||||
|
||||
#region INavigationAware
|
||||
public void OnNavigatedFrom(INavigationParameters parameters)
|
||||
public override void OnNavigatedFrom(INavigationParameters parameters)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void OnNavigatedTo(INavigationParameters parameters)
|
||||
public override void OnNavigatedTo(INavigationParameters parameters)
|
||||
{
|
||||
Connection_Item = parameters["instance"] as Connection;
|
||||
|
||||
@ -139,6 +153,8 @@ namespace Borepin.PageModel
|
||||
{
|
||||
IsConnected = false;
|
||||
}
|
||||
|
||||
IsBusy = false;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
39
Borepin/Borepin/PageModel/TestPageModel.cs
Normal file
39
Borepin/Borepin/PageModel/TestPageModel.cs
Normal file
@ -0,0 +1,39 @@
|
||||
using Borepin.Base;
|
||||
using Prism.Navigation;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Borepin.PageModel
|
||||
{
|
||||
class TestPageModel : PageModelBase
|
||||
{
|
||||
#region Contructors
|
||||
public TestPageModel(INavigationService navigationService) : base(navigationService)
|
||||
{
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Data
|
||||
public override async Task<bool> LoadData()
|
||||
{
|
||||
await Task.Delay(3000);
|
||||
|
||||
IsBusy = false;
|
||||
return await Task.FromResult(true);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region INavigationService
|
||||
public override void OnNavigatedFrom(INavigationParameters parameters)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void OnNavigatedTo(INavigationParameters parameters)
|
||||
{
|
||||
IsBusy = true;
|
||||
Task.Run(LoadData);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
10
Borepin/Borepin/View/IsBusyView.xaml
Normal file
10
Borepin/Borepin/View/IsBusyView.xaml
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ContentView xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="Borepin.View.IsBusyView">
|
||||
<ContentView.Content>
|
||||
<StackLayout>
|
||||
<Label Text="IsBusy" />
|
||||
</StackLayout>
|
||||
</ContentView.Content>
|
||||
</ContentView>
|
20
Borepin/Borepin/View/IsBusyView.xaml.cs
Normal file
20
Borepin/Borepin/View/IsBusyView.xaml.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.Xaml;
|
||||
|
||||
namespace Borepin.View
|
||||
{
|
||||
[XamlCompilation(XamlCompilationOptions.Compile)]
|
||||
public partial class IsBusyView : ContentView
|
||||
{
|
||||
public IsBusyView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -113,6 +113,22 @@ namespace FabAccessAPI
|
||||
return writeCap.Use();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Try to get a GiveBack capability for a machine.
|
||||
/// </summary>
|
||||
/// <returns>Capability to give back the machine or null</returns>
|
||||
/// <exception cref="UnauthorizedException"></exception>
|
||||
public Task<Schema.Machine.WriteInterface.IGiveBack> GetGiveBack()
|
||||
{
|
||||
var writeCap = _machine.Write;
|
||||
if (writeCap == null)
|
||||
{
|
||||
throw new UnauthorizedException();
|
||||
}
|
||||
|
||||
return writeCap.GetGiveBack();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Try to reserve a machine. Throws a UnauthorizedException if the user does not have the required
|
||||
/// permissions to use this machine.
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 4adb05341763b96a43440a6a96e0d9959ba71e89
|
||||
Subproject commit 2dc488d13b2a8eaa743fb759b4929d50843ccb23
|
Loading…
x
Reference in New Issue
Block a user