File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change 1212using System . Collections . Generic ;
1313using System . Linq ;
1414using System . Threading . Tasks ;
15+ using Windows . Networking . Connectivity ;
1516using Windows . UI . Xaml . Media . Animation ;
1617using Windows . UI . Xaml . Media . Imaging ;
1718using FluentWeather . Adapters ;
@@ -153,6 +154,16 @@ private void Initialize()
153154 // Initialize the refresh timer
154155 _refreshTimer . Tick += RefreshTimerTickEvent ;
155156 UpdateRefreshTimerSettings ( ) ;
157+
158+ NetworkInformation . NetworkStatusChanged += sender =>
159+ {
160+ var profile = NetworkInformation . GetInternetConnectionProfile ( ) ;
161+ var level = profile ? . GetNetworkConnectivityLevel ( ) ;
162+ if ( level == NetworkConnectivityLevel . InternetAccess )
163+ {
164+ _appViewModel . UpdateUi ( ) ;
165+ }
166+ } ;
156167 }
157168
158169 private async void RefreshTimerTickEvent ( object sender , object e )
You can’t perform that action at this time.
0 commit comments