Nice error messages

This commit is contained in:
2016-01-19 22:52:20 +01:00
parent 5e94d4508c
commit 337f0c308f
2 changed files with 44 additions and 5 deletions
+42 -3
View File
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.Diagnostics;
using YJMPD_UWP.Model.Object;
namespace YJMPD_UWP.ViewModels
@@ -36,7 +37,8 @@ namespace YJMPD_UWP.ViewModels
dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
{
NotifyPropertyChanged(nameof(MatchAvailable));
NotifyPropertyChanged(nameof(ConnectingServer));
NotifyPropertyChanged(nameof(ServerAvailable));
NotifyPropertyChanged(nameof(ServerMessage));
});
}
@@ -45,7 +47,8 @@ namespace YJMPD_UWP.ViewModels
dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
{
NotifyPropertyChanged(nameof(MatchAvailable));
NotifyPropertyChanged(nameof(ConnectingServer));
NotifyPropertyChanged(nameof(ServerAvailable));
NotifyPropertyChanged(nameof(ServerMessage));
});
}
@@ -77,7 +80,7 @@ namespace YJMPD_UWP.ViewModels
}
}
public bool ConnectingServer
public bool ServerAvailable
{
get
{
@@ -85,6 +88,42 @@ namespace YJMPD_UWP.ViewModels
}
}
public string ServerMessage
{
get
{
string str = "";
switch (App.Network.Status)
{
case Model.NetworkHandler.NetworkStatus.DISCONNECTED:
str = "Disconnected";
break;
case Model.NetworkHandler.NetworkStatus.CONNECTING:
str = "Connecting to server...";
break;
}
switch(App.Geo.Status)
{
case Windows.Devices.Geolocation.PositionStatus.Disabled:
case Windows.Devices.Geolocation.PositionStatus.NotAvailable:
case Windows.Devices.Geolocation.PositionStatus.NoData:
str = "GPS not available";
break;
case Windows.Devices.Geolocation.PositionStatus.NotInitialized:
case Windows.Devices.Geolocation.PositionStatus.Initializing:
str = "Waiting on GPS...";
break;
}
if (str == "")
str = "Connected";
return str;
}
}
public bool StartMatch
{
get
+2 -2
View File
@@ -45,9 +45,9 @@
</StackPanel>
</ScrollViewer>
<StackPanel Orientation="Horizontal" Grid.Row="1" Visibility="{Binding ConnectingServer, Converter={StaticResource BoolToVisConverter}}" Padding="20" Background="Gray">
<StackPanel Orientation="Horizontal" Grid.Row="1" Visibility="{Binding ServerAvailable, Converter={StaticResource BoolToVisConverter}}" Padding="20" Background="Gray">
<ProgressRing Width="20" Height="20" IsActive="True" Margin="0,0,10,0" Foreground="White"/>
<TextBlock Text="Waiting on server..." Foreground="White" />
<TextBlock Text="{Binding ServerMessage}" Foreground="White" />
</StackPanel>
</Grid>
</Page>