Changed ActiveConnection to View not List

This commit is contained in:
TheJoKlLa 2022-01-15 01:44:34 +01:00
parent 45c468c2a8
commit 7b4498f8e8
6 changed files with 18 additions and 32 deletions

View File

@ -24,11 +24,11 @@
<Button Text="Scan QR-Code" Command="{Binding ScanCodeCommand}" Style="{StaticResource Style_Button_Primary}"> <Button Text="Scan QR-Code" Command="{Binding ScanCodeCommand}" Style="{StaticResource Style_Button_Primary}">
<Button.IsVisible> <Button.IsVisible>
<OnPlatform x:TypeArguments="x:Boolean" <OnPlatform x:TypeArguments="x:Boolean"
iOS="false" iOS="False"
Android="true"/> Android="True"/>
</Button.IsVisible> </Button.IsVisible>
</Button> </Button>
<ListView ItemsSource="{Binding MachineListItemViewModel_List}" SelectionMode="None"> <ListView ItemsSource="{Binding MachineListItemViewModel_List}" SelectionMode="None" SeparatorColor="Transparent">
<ListView.ItemTemplate> <ListView.ItemTemplate>
<DataTemplate> <DataTemplate>
<ViewCell> <ViewCell>

View File

@ -11,32 +11,26 @@
</ResourceDictionary> </ResourceDictionary>
</ContentPage.Resources> </ContentPage.Resources>
<ContentPage.Content> <ContentPage.Content>
<StackLayout Padding="20"> <StackLayout Padding="20" VerticalOptions="FillAndExpand">
<StackLayout IsVisible="{Binding IsBusy}"> <StackLayout IsVisible="{Binding IsBusy}">
<ActivityIndicator IsRunning="{Binding IsBusy}"></ActivityIndicator> <ActivityIndicator IsRunning="{Binding IsBusy}"></ActivityIndicator>
</StackLayout> </StackLayout>
<StackLayout IsVisible="{Binding IsBusy, Converter={StaticResource InvertBoolConverter}}"> <StackLayout IsVisible="{Binding IsBusy, Converter={StaticResource InvertBoolConverter}}" VerticalOptions="FillAndExpand">
<Label Text="Active Connection" IsVisible="{Binding HasActiveConnection}"/> <Label Text="Active Connection" IsVisible="{Binding HasActiveConnection}"/>
<ListView ItemsSource="{Binding ActiveConnection}" IsVisible="{Binding HasActiveConnection}" SelectionMode="None"> <StackLayout IsVisible="{Binding HasActiveConnection}">
<ListView.ItemTemplate> <views:ServerListItemView BindingContext="{Binding ActiveConnection}" HeightRequest="70"/>
<DataTemplate> </StackLayout>
<ViewCell>
<views:ServerListItemView />
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
<Label Text="Last Connections"/> <Label Text="Last Connections"/>
<ListView ItemsSource="{Binding ServerListItemViewModel_List}" SelectionMode="None"> <ListView ItemsSource="{Binding ServerListItemViewModel_List}" SelectionMode="None" SeparatorColor="Transparent" VerticalOptions="StartAndExpand">
<ListView.ItemTemplate> <ListView.ItemTemplate>
<DataTemplate> <DataTemplate>
<ViewCell> <ViewCell>
<views:ServerListItemView /> <views:ServerListItemView/>
</ViewCell> </ViewCell>
</DataTemplate> </DataTemplate>
</ListView.ItemTemplate> </ListView.ItemTemplate>
</ListView> </ListView>
<Button Text="Connect to new Server" Command="{Binding AddInstancesCommand}" Style="{StaticResource Style_Button_Primary}"/> <Button Text="Connect to new Server" Command="{Binding AddInstancesCommand}" Style="{StaticResource Style_Button_Primary}" VerticalOptions="End"/>
</StackLayout> </StackLayout>
</StackLayout> </StackLayout>
</ContentPage.Content> </ContentPage.Content>

View File

@ -8,7 +8,6 @@ using Prism.Commands;
using Prism.Navigation; using Prism.Navigation;
using Borepin.Service.BFFH; using Borepin.Service.BFFH;
using Borepin.Base; using Borepin.Base;
using System;
namespace Borepin.PageModel namespace Borepin.PageModel
{ {
@ -34,10 +33,7 @@ namespace Borepin.PageModel
IList<Connection> list = await _BFFHService.GetConnections().ConfigureAwait(false); IList<Connection> list = await _BFFHService.GetConnections().ConfigureAwait(false);
if (_BFFHService.IsConnected) if (_BFFHService.IsConnected)
{ {
ActiveConnection = new List<ServerListItemViewModel> ActiveConnection = new ServerListItemViewModel(_BFFHService.CurrentConnection);
{
new ServerListItemViewModel(_BFFHService.CurrentConnection),
};
list.Remove(_BFFHService.CurrentConnection); list.Remove(_BFFHService.CurrentConnection);
@ -62,8 +58,8 @@ namespace Borepin.PageModel
set => SetProperty(ref _ServerListItemViewModel_List, value); set => SetProperty(ref _ServerListItemViewModel_List, value);
} }
private IList<ServerListItemViewModel> _ActiveConnection; private ServerListItemViewModel _ActiveConnection;
public IList<ServerListItemViewModel> ActiveConnection public ServerListItemViewModel ActiveConnection
{ {
get => _ActiveConnection; get => _ActiveConnection;
set => SetProperty(ref _ActiveConnection, value); set => SetProperty(ref _ActiveConnection, value);

View File

@ -15,7 +15,7 @@
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="5" /> <ColumnDefinition Width="5" />
<ColumnDefinition Width="6*" /> <ColumnDefinition Width="6*" />
<ColumnDefinition Width="2*" /> <ColumnDefinition Width="3*" />
<ColumnDefinition Width="2*" /> <ColumnDefinition Width="2*" />
<ColumnDefinition Width="1" /> <ColumnDefinition Width="1" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>

View File

@ -16,9 +16,9 @@
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
<RowDefinition Height="1"/> <RowDefinition Height="1"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Label Grid.Row="0" Grid.Column="1" Text="{Binding Address, StringFormat='{0}'}" Style="{StaticResource LabelStyle_Primary}"/> <Label Grid.Row="0" Grid.Column="1" Text="{Binding Address, StringFormat='{0}'}" Style="{StaticResource LabelStyle_Primary}" VerticalOptions="Center"/>
<Label Grid.Row="0" Grid.Column="2" Text="{Binding Username}" Style="{StaticResource LabelStyle_Second}" HorizontalTextAlignment="End" /> <Label Grid.Row="0" Grid.Column="2" Text="{Binding Username}" Style="{StaticResource LabelStyle_Second}" HorizontalTextAlignment="End" VerticalOptions="Center"/>
<Button Grid.Row="0" Grid.Column="3" Margin="0, 3, 0, 3" Text="->" Command="{Binding Source={RelativeSource AncestorType={x:Type pagemodel:ServerListPageModel}}, 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:ServerListPageModel}}, Path=SelectInstanceCommand}" CommandParameter="{Binding .}" Style="{StaticResource Style_Button_Primary}" VerticalOptions="Center"/>
<BoxView Grid.Row="1" Grid.ColumnSpan="5" BackgroundColor="{StaticResource FifthColor}"/> <BoxView Grid.Row="1" Grid.ColumnSpan="5" BackgroundColor="{StaticResource FifthColor}"/>
</Grid> </Grid>
</ContentView.Content> </ContentView.Content>

View File

@ -1,6 +1,5 @@
using Borepin.Model; using Borepin.Model;
using Prism.Mvvm; using Prism.Mvvm;
using System;
namespace Borepin.ViewModel namespace Borepin.ViewModel
{ {
@ -32,8 +31,5 @@ namespace Borepin.ViewModel
set => SetProperty(ref _Username, value); set => SetProperty(ref _Username, value);
} }
#endregion #endregion
#region Methods
#endregion
} }
} }