2 using System.Collections.Generic;
3 using System.ComponentModel;
5 using System.Reflection;
6 using System.Threading;
7 using System.Threading.Tasks;
8 using Tizen.NUI.Binding.Internals;
10 namespace Tizen.NUI.Binding
12 internal static class Device
14 public const string iOS = "iOS";
15 public const string Android = "Android";
16 public const string UWP = "UWP";
17 public const string macOS = "macOS";
18 public const string GTK = "GTK";
19 public const string Tizen = "Tizen";
20 public const string WPF = "WPF";
22 [EditorBrowsable(EditorBrowsableState.Never)]
23 public static DeviceInfo info;
25 [EditorBrowsable(EditorBrowsableState.Never)]
26 public static void SetIdiom(TargetIdiom value) => Idiom = value;
27 public static TargetIdiom Idiom { get; internal set; }
29 //TODO: Why are there two of these? This is never used...?
30 [EditorBrowsable(EditorBrowsableState.Never)]
31 public static void SetTargetIdiom(TargetIdiom value) => Idiom = value;
33 [Obsolete("TargetPlatform is obsolete as of version 2.3.4. Please use RuntimePlatform instead.")]
34 #pragma warning disable 0618
35 public static TargetPlatform OS
39 TargetPlatform platform;
40 if (Enum.TryParse(RuntimePlatform, out platform))
43 // In the old TargetPlatform, there was no distinction between WinRT/UWP
44 if (RuntimePlatform == UWP)
46 return TargetPlatform.Windows;
49 return TargetPlatform.Other;
52 #pragma warning restore 0618
54 public static string RuntimePlatform => null;
56 [EditorBrowsable(EditorBrowsableState.Never)]
57 public static DeviceInfo Info
62 // throw new InvalidOperationException("You MUST call Tizen.NUI.Xaml.Init(); prior to using it.");
68 [EditorBrowsable(EditorBrowsableState.Never)]
69 public static void SetFlowDirection(FlowDirection value) => FlowDirection = value;
70 public static FlowDirection FlowDirection { get; internal set; }
72 [EditorBrowsable(EditorBrowsableState.Never)]
73 public static IReadOnlyList<string> Flags { get; private set; }
75 [EditorBrowsable(EditorBrowsableState.Never)]
76 public static void SetFlags(IReadOnlyList<string> flags)
81 public static void BeginInvokeOnMainThread(Action action)
84 Console.WriteLine("Device BeginInvokeOnMainThread action called");
87 // public static double GetNamedSize(NamedSize size, Element targetElement)
89 // return GetNamedSize(size, targetElement.GetType());
92 // public static double GetNamedSize(NamedSize size, Type targetElementType)
94 // return GetNamedSize(size, targetElementType, false);
97 [Obsolete("OnPlatform<> (generic) is obsolete as of version 2.3.4. Please use switch(RuntimePlatform) instead.")]
98 public static T OnPlatform<T>(T iOS, T Android, T WinPhone)
102 case TargetPlatform.iOS:
104 case TargetPlatform.Android:
106 case TargetPlatform.Windows:
107 case TargetPlatform.WinPhone:
114 public static void OpenUri(Uri uri)
116 // PlatformServices?.OpenUriAction(uri);
119 [EditorBrowsable(EditorBrowsableState.Never)]
120 public static Assembly[] GetAssemblies()
125 // [EditorBrowsable(EditorBrowsableState.Never)]
126 // public static double GetNamedSize(NamedSize size, Type targetElementType, bool useOldSizes)
128 // return PlatformServices.GetNamedSize(size, targetElementType, useOldSizes);
131 public static class Styles
133 public static readonly string TitleStyleKey = "TitleStyle";
135 public static readonly string SubtitleStyleKey = "SubtitleStyle";
137 public static readonly string BodyStyleKey = "BodyStyle";
139 public static readonly string ListItemTextStyleKey = "ListItemTextStyle";
141 public static readonly string ListItemDetailTextStyleKey = "ListItemDetailTextStyle";
143 public static readonly string CaptionStyleKey = "CaptionStyle";
145 public static readonly Style TitleStyle = new Style(typeof(Tizen.NUI.BaseComponents.TextLabel)) { BaseResourceKey = TitleStyleKey };
147 public static readonly Style SubtitleStyle = new Style(typeof(Tizen.NUI.BaseComponents.TextLabel)) { BaseResourceKey = SubtitleStyleKey };
149 public static readonly Style BodyStyle = new Style(typeof(Tizen.NUI.BaseComponents.TextLabel)) { BaseResourceKey = BodyStyleKey };
151 public static readonly Style ListItemTextStyle = new Style(typeof(Tizen.NUI.BaseComponents.TextLabel)) { BaseResourceKey = ListItemTextStyleKey };
153 public static readonly Style ListItemDetailTextStyle = new Style(typeof(Tizen.NUI.BaseComponents.TextLabel)) { BaseResourceKey = ListItemDetailTextStyleKey };
155 public static readonly Style CaptionStyle = new Style(typeof(Tizen.NUI.BaseComponents.TextLabel)) { BaseResourceKey = CaptionStyleKey };