diff options
Diffstat (limited to 'Juick/ViewModels/AppViewModel.cs')
-rw-r--r-- | Juick/ViewModels/AppViewModel.cs | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/Juick/ViewModels/AppViewModel.cs b/Juick/ViewModels/AppViewModel.cs index 07ba7cf..4b30c08 100644 --- a/Juick/ViewModels/AppViewModel.cs +++ b/Juick/ViewModels/AppViewModel.cs @@ -16,7 +16,7 @@ namespace Juick.ViewModels public class AppViewModel : ViewModelBase { static readonly string IsNetworkAvailablePropertyName = ExpressionHelper.GetPropertyName<AppViewModel>(x => x.NetworkUnavailable); - readonly HttpNotificationChannel _pushChannel; + readonly HttpNotificationChannel pushChannel; // The name of our push channel. private const string channelName = "JuickChannel"; @@ -26,11 +26,16 @@ namespace Juick.ViewModels NetworkUnavailable = !DeviceNetworkInformation.IsNetworkAvailable; } + public void UpdateNetworkStatus() + { + NetworkUnavailable = !DeviceNetworkInformation.IsNetworkAvailable; + } + public AppViewModel() { UpdateNetworkStatus(); NetworkChange.NetworkAddressChanged += (sender, args) => UpdateNetworkStatus(); - _pushChannel = HttpNotificationChannel.Find(channelName); + pushChannel = HttpNotificationChannel.Find(channelName); // If the channel was not found, then create a new connection to the push service. if (_pushChannel == null) @@ -129,6 +134,16 @@ namespace Juick.ViewModels } } } + private bool _isNetworkUnavailable; + public bool NetworkUnavailable + { + get { return _isNetworkUnavailable; } + set + { + _isNetworkUnavailable = value; + NotifyPropertyChanged(IsNetworkAvailablePropertyName); + } + } private bool _isNetworkUnavailable; public bool NetworkUnavailable |