mirror of
https://gitlab.com/fabinfra/fabaccess/borepin.git
synced 2025-03-13 07:11:56 +01:00
parent
2334cbc20d
commit
ee6d2814a5
@ -29,6 +29,7 @@
|
|||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
|
<PackageReference Include="NaturalSort.Extension" Version="3.2.0" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
||||||
<PackageReference Include="Plugin.Multilingual" Version="1.0.2" />
|
<PackageReference Include="Plugin.Multilingual" Version="1.0.2" />
|
||||||
<PackageReference Include="Prism.DryIoc.Forms" Version="8.1.97" />
|
<PackageReference Include="Prism.DryIoc.Forms" Version="8.1.97" />
|
||||||
|
@ -5,6 +5,9 @@
|
|||||||
x:Class="Borepin.Page.MachineListPage"
|
x:Class="Borepin.Page.MachineListPage"
|
||||||
xmlns:converters="clr-namespace:Borepin.Converter"
|
xmlns:converters="clr-namespace:Borepin.Converter"
|
||||||
Title="Machines">
|
Title="Machines">
|
||||||
|
<NavigationPage.TitleView>
|
||||||
|
<Button Text="Refresh" HorizontalOptions="End" BackgroundColor="{StaticResource SecondColor}" TextColor="{StaticResource FirstColor}" Command="{Binding RefreshCommand}"/>
|
||||||
|
</NavigationPage.TitleView>
|
||||||
<ContentPage.Resources>
|
<ContentPage.Resources>
|
||||||
<ResourceDictionary>
|
<ResourceDictionary>
|
||||||
<converters:InvertBoolConverter x:Key="InvertBoolConverter"/>
|
<converters:InvertBoolConverter x:Key="InvertBoolConverter"/>
|
||||||
@ -25,17 +28,6 @@
|
|||||||
Android="true"/>
|
Android="true"/>
|
||||||
</Button.IsVisible>
|
</Button.IsVisible>
|
||||||
</Button>
|
</Button>
|
||||||
<Label Text="Your Machines" IsVisible="{Binding UserAssignedMachineListItemViewModel_List, Converter={StaticResource ListNotEmptyConverter}}"/>
|
|
||||||
<ListView ItemsSource="{Binding UserAssignedMachineListItemViewModel_List}" IsVisible="{Binding UserAssignedMachineListItemViewModel_List, Converter={StaticResource ListNotEmptyConverter}}" SelectionMode="None">
|
|
||||||
<ListView.ItemTemplate>
|
|
||||||
<DataTemplate>
|
|
||||||
<ViewCell>
|
|
||||||
<views:MachineListItemView />
|
|
||||||
</ViewCell>
|
|
||||||
</DataTemplate>
|
|
||||||
</ListView.ItemTemplate>
|
|
||||||
</ListView>
|
|
||||||
<Label Text="All Machines"/>
|
|
||||||
<ListView ItemsSource="{Binding MachineListItemViewModel_List}" SelectionMode="None">
|
<ListView ItemsSource="{Binding MachineListItemViewModel_List}" SelectionMode="None">
|
||||||
<ListView.ItemTemplate>
|
<ListView.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
|
@ -11,6 +11,9 @@ using Prism.Services.Dialogs;
|
|||||||
using Prism.Services;
|
using Prism.Services;
|
||||||
using Prism.AppModel;
|
using Prism.AppModel;
|
||||||
using static FabAccessAPI.Schema.Machine;
|
using static FabAccessAPI.Schema.Machine;
|
||||||
|
using System;
|
||||||
|
using NaturalSort.Extension;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace Borepin.PageModel
|
namespace Borepin.PageModel
|
||||||
{
|
{
|
||||||
@ -55,35 +58,34 @@ namespace Borepin.PageModel
|
|||||||
|
|
||||||
IReadOnlyList<Machine> machine_list = await machine_infoInterface.GetMachineList().ConfigureAwait(false);
|
IReadOnlyList<Machine> machine_list = await machine_infoInterface.GetMachineList().ConfigureAwait(false);
|
||||||
|
|
||||||
List<MachineListItemViewModel> viewmodel_list = new List<MachineListItemViewModel>();
|
|
||||||
List<MachineListItemViewModel> viewmodel_list_user_assigned = new List<MachineListItemViewModel>();
|
List<MachineListItemViewModel> viewmodel_list_user_assigned = new List<MachineListItemViewModel>();
|
||||||
|
List<MachineListItemViewModel> viewmodel_list_not_user_assigned = new List<MachineListItemViewModel>();
|
||||||
foreach (Machine machine in machine_list)
|
foreach (Machine machine in machine_list)
|
||||||
{
|
{
|
||||||
if(((InUseInterface_Proxy)machine.Inuse).IsNull)
|
if(!((InUseInterface_Proxy)machine.Inuse).IsNull)
|
||||||
{
|
{
|
||||||
viewmodel_list.Add(new MachineListItemViewModel(machine));
|
MachineListItemViewModel new_viewmodel = new MachineListItemViewModel(machine)
|
||||||
|
{
|
||||||
|
IsUserAssigned = true
|
||||||
|
};
|
||||||
|
viewmodel_list_user_assigned.Add(new_viewmodel);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
viewmodel_list_user_assigned.Add(new MachineListItemViewModel(machine));
|
viewmodel_list_not_user_assigned.Add(new MachineListItemViewModel(machine));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MachineListItemViewModel_List = viewmodel_list;
|
List<MachineListItemViewModel> viewmodel_list_sorted = new List<MachineListItemViewModel>();
|
||||||
UserAssignedMachineListItemViewModel_List = viewmodel_list_user_assigned;
|
viewmodel_list_sorted.AddRange(viewmodel_list_user_assigned.OrderBy(x => x.Name, StringComparison.OrdinalIgnoreCase.WithNaturalSort()));
|
||||||
|
viewmodel_list_sorted.AddRange(viewmodel_list_not_user_assigned.OrderBy(x => x.Name, StringComparison.OrdinalIgnoreCase.WithNaturalSort()));
|
||||||
|
MachineListItemViewModel_List = viewmodel_list_sorted;
|
||||||
|
|
||||||
IsBusy = false;
|
IsBusy = false;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Fields
|
#region Fields
|
||||||
private IList<MachineListItemViewModel> _UserAssignedMachineListItemViewModel_List;
|
|
||||||
public IList<MachineListItemViewModel> UserAssignedMachineListItemViewModel_List
|
|
||||||
{
|
|
||||||
get => _UserAssignedMachineListItemViewModel_List;
|
|
||||||
set => SetProperty(ref _UserAssignedMachineListItemViewModel_List, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
private IList<MachineListItemViewModel> _MachineListItemViewModel_List;
|
private IList<MachineListItemViewModel> _MachineListItemViewModel_List;
|
||||||
public IList<MachineListItemViewModel> MachineListItemViewModel_List
|
public IList<MachineListItemViewModel> MachineListItemViewModel_List
|
||||||
{
|
{
|
||||||
@ -201,6 +203,7 @@ namespace Borepin.PageModel
|
|||||||
|
|
||||||
public override async void OnNavigatedTo(INavigationParameters parameters)
|
public override async void OnNavigatedTo(INavigationParameters parameters)
|
||||||
{
|
{
|
||||||
|
IsBusy = true;
|
||||||
await LoadData().ConfigureAwait(false);
|
await LoadData().ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -157,6 +157,7 @@ namespace Borepin.Service.BFFH
|
|||||||
|
|
||||||
if (! await _AuthenticatePlainAsync(connection.Username, password).ConfigureAwait(false))
|
if (! await _AuthenticatePlainAsync(connection.Username, password).ConfigureAwait(false))
|
||||||
{
|
{
|
||||||
|
await Disconnect().ConfigureAwait(false);
|
||||||
throw new AuthenticatingFailedException();
|
throw new AuthenticatingFailedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -195,6 +196,7 @@ namespace Borepin.Service.BFFH
|
|||||||
|
|
||||||
if (!await _AuthenticatePlainAsync(connection.Username, password).ConfigureAwait(false))
|
if (!await _AuthenticatePlainAsync(connection.Username, password).ConfigureAwait(false))
|
||||||
{
|
{
|
||||||
|
await Disconnect().ConfigureAwait(false);
|
||||||
throw new AuthenticatingFailedException();
|
throw new AuthenticatingFailedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,7 +24,10 @@
|
|||||||
<RowDefinition Height="1"/>
|
<RowDefinition Height="1"/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<Label Grid.Row="0" Grid.Column="1" Text="{Binding Name}" Style="{StaticResource LabelStyle_Primary}"/>
|
<Label Grid.Row="0" Grid.Column="1" Text="{Binding Name}" Style="{StaticResource LabelStyle_Primary}"/>
|
||||||
<Label Grid.Row="0" Grid.Column="2" Text="{Binding State, Converter={StaticResource MachineStateStringConverter}}" TextColor="{Binding State, Converter={StaticResource MachineStateColorConverter}}" Style="{StaticResource LabelStyle_Second}" HorizontalTextAlignment="End" />
|
<StackLayout Grid.Row="0" Grid.Column="2" Orientation="Horizontal" HorizontalOptions="End">
|
||||||
|
<Label Text="{Binding State, Converter={StaticResource MachineStateStringConverter}}" TextColor="{Binding State, Converter={StaticResource MachineStateColorConverter}}" Style="{StaticResource LabelStyle_Second}"/>
|
||||||
|
<Label Text="by Me" IsVisible="{Binding IsUserAssigned}" Style="{StaticResource LabelStyle_Second}"/>
|
||||||
|
</StackLayout>
|
||||||
<Button Grid.Row="0" Grid.Column="3" Margin="0, 3, 0, 3" Text="->" Command="{Binding Source={RelativeSource AncestorType={x:Type pagemodel:MachineListPageModel}}, Path=SelectInstanceCommand}" CommandParameter="{Binding .}" Style="{StaticResource Style_Button_Primary}"/>
|
<Button Grid.Row="0" Grid.Column="3" Margin="0, 3, 0, 3" Text="->" Command="{Binding Source={RelativeSource AncestorType={x:Type pagemodel:MachineListPageModel}}, Path=SelectInstanceCommand}" CommandParameter="{Binding .}" Style="{StaticResource Style_Button_Primary}"/>
|
||||||
<BoxView Grid.Row="1" Grid.ColumnSpan="5" BackgroundColor="{StaticResource FifthColor}"/>
|
<BoxView Grid.Row="1" Grid.ColumnSpan="5" BackgroundColor="{StaticResource FifthColor}"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
@ -33,5 +33,12 @@ namespace Borepin.ViewModel
|
|||||||
get => _State;
|
get => _State;
|
||||||
set => SetProperty(ref _State, value);
|
set => SetProperty(ref _State, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool _IsUserAssigned = false;
|
||||||
|
public bool IsUserAssigned
|
||||||
|
{
|
||||||
|
get => _IsUserAssigned;
|
||||||
|
set => SetProperty(ref _IsUserAssigned, value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user