-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUIHelper.cs
39 lines (33 loc) · 1.16 KB
/
UIHelper.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
using System;
using System.Threading.Tasks;
using Windows.Networking.Connectivity;
using Windows.UI.Popups;
namespace SmartMerchant
{
public static class UIHelper
{
public static async Task ToggleProgressBar(bool toggle, string message = "")
{
var statusBar = Windows.UI.ViewManagement.StatusBar.GetForCurrentView();
if (toggle)
{
statusBar.ProgressIndicator.Text = message;
await statusBar.ProgressIndicator.ShowAsync();
}
else
{
await statusBar.ProgressIndicator.HideAsync();
}
}
public static async Task ShowAlert(string message, string title = "")
{
MessageDialog dialog = new MessageDialog(message, title);
await dialog.ShowAsync();
}
public static bool HasInternetConnection()
{
ConnectionProfile connectionProfile = NetworkInformation.GetInternetConnectionProfile();
return (connectionProfile != null && connectionProfile.GetNetworkConnectivityLevel() == NetworkConnectivityLevel.InternetAccess);
}
}
}