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.IsVisible>
<OnPlatform x:TypeArguments="x:Boolean"
iOS="false"
Android="true"/>
iOS="False"
Android="True"/>
</Button.IsVisible>
</Button>
<ListView ItemsSource="{Binding MachineListItemViewModel_List}" SelectionMode="None">
<ListView ItemsSource="{Binding MachineListItemViewModel_List}" SelectionMode="None" SeparatorColor="Transparent">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>

View File

@ -11,32 +11,26 @@
</ResourceDictionary>
</ContentPage.Resources>
<ContentPage.Content>
<StackLayout Padding="20">
<StackLayout Padding="20" VerticalOptions="FillAndExpand">
<StackLayout IsVisible="{Binding IsBusy}">
<ActivityIndicator IsRunning="{Binding IsBusy}"></ActivityIndicator>
</StackLayout>
<StackLayout IsVisible="{Binding IsBusy, Converter={StaticResource InvertBoolConverter}}">
<StackLayout IsVisible="{Binding IsBusy, Converter={StaticResource InvertBoolConverter}}" VerticalOptions="FillAndExpand">
<Label Text="Active Connection" IsVisible="{Binding HasActiveConnection}"/>
<ListView ItemsSource="{Binding ActiveConnection}" IsVisible="{Binding HasActiveConnection}" SelectionMode="None">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<views:ServerListItemView />
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
<StackLayout IsVisible="{Binding HasActiveConnection}">
<views:ServerListItemView BindingContext="{Binding ActiveConnection}" HeightRequest="70"/>
</StackLayout>
<Label Text="Last Connections"/>
<ListView ItemsSource="{Binding ServerListItemViewModel_List}" SelectionMode="None">
<ListView ItemsSource="{Binding ServerListItemViewModel_List}" SelectionMode="None" SeparatorColor="Transparent" VerticalOptions="StartAndExpand">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<views:ServerListItemView />
<views:ServerListItemView/>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</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>
</ContentPage.Content>

View File

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

View File

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

View File

@ -16,9 +16,9 @@
<RowDefinition Height="*"/>
<RowDefinition Height="1"/>
</Grid.RowDefinitions>
<Label Grid.Row="0" Grid.Column="1" Text="{Binding Address, StringFormat='{0}'}" Style="{StaticResource LabelStyle_Primary}"/>
<Label Grid.Row="0" Grid.Column="2" Text="{Binding Username}" Style="{StaticResource LabelStyle_Second}" HorizontalTextAlignment="End" />
<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}"/>
<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" 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}" VerticalOptions="Center"/>
<BoxView Grid.Row="1" Grid.ColumnSpan="5" BackgroundColor="{StaticResource FifthColor}"/>
</Grid>
</ContentView.Content>

View File

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