Fixed MachineList Crash if not connected to server

This commit is contained in:
TheJoKlLa 2022-01-05 00:57:59 +01:00
parent e089d8ab39
commit b69b206c6e
2 changed files with 27 additions and 19 deletions

View File

@ -51,6 +51,10 @@ namespace Borepin.Base
{
await _BFFHService.Reconnect().ConfigureAwait(false);
}
else if(_BFFHService.CurrentConnection == null)
{
return false;
}
return true;
}

View File

@ -16,26 +16,30 @@
<ActivityIndicator IsRunning="{Binding IsBusy}"></ActivityIndicator>
</StackLayout>
<StackLayout IsVisible="{Binding IsBusy, Converter={StaticResource InvertBoolConverter}}">
<Button Text="Scan QR-Code" Command="{Binding ScanCodeCommand}" Style="{StaticResource Style_Button_Primary}">
<Button.IsVisible>
<OnPlatform x:TypeArguments="x:Boolean"
iOS="false"
Android="true"/>
</Button.IsVisible>
</Button>
<RefreshView Command="{Binding RefreshCommand}" IsRefreshing="{Binding IsRefreshing}">
<ListView ItemsSource="{Binding MachineListItemViewModel_List}" IsVisible="{Binding IsConnected}" SelectionMode="None">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<views:MachineListItemView />
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</RefreshView>
<StackLayout IsVisible="{Binding IsConnected}">
<Button Text="Scan QR-Code" Command="{Binding ScanCodeCommand}" Style="{StaticResource Style_Button_Primary}">
<Button.IsVisible>
<OnPlatform x:TypeArguments="x:Boolean"
iOS="false"
Android="true"/>
</Button.IsVisible>
</Button>
<RefreshView Command="{Binding RefreshCommand}" IsRefreshing="{Binding IsRefreshing}">
<ListView ItemsSource="{Binding MachineListItemViewModel_List}" IsVisible="{Binding IsConnected}" SelectionMode="None">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<views:MachineListItemView />
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</RefreshView>
</StackLayout>
<StackLayout IsVisible="{Binding IsConnected, Converter={StaticResource InvertBoolConverter}}">
<Label Text="Please connect to Server" ></Label>
</StackLayout>
</StackLayout>
<Label Text="Please connect to Server" IsVisible="{Binding IsConnected, Converter={StaticResource InvertBoolConverter}}"></Label>
</StackLayout>
</ContentPage.Content>
</ContentPage>