blob: b66167fa8bccbeabfa09c6cf1af7ad2ff42494eb (
plain)
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
|
namespace Xamarin.Forms
{
public class OnPlatform<T>
{
public T Android { get; set; }
public T iOS { get; set; }
public T WinPhone { get; set; }
public static implicit operator T(OnPlatform<T> onPlatform)
{
switch (Device.OS)
{
case TargetPlatform.iOS:
return onPlatform.iOS;
case TargetPlatform.Android:
return onPlatform.Android;
case TargetPlatform.Windows:
case TargetPlatform.WinPhone:
return onPlatform.WinPhone;
}
return onPlatform.iOS;
}
}
}
|