3 using System.Reflection;
4 using System.Globalization;
7 using System.ComponentModel;
9 namespace Tizen.NUI.XamlBinding
11 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
12 [EditorBrowsable(EditorBrowsableState.Never)]
13 public class Vector2TypeConverter : TypeConverter
15 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
16 [EditorBrowsable(EditorBrowsableState.Never)]
17 public override object ConvertFromInvariantString(string value)
21 string[] parts = value.Split(',');
22 if (parts.Length == 2 )
24 return new Vector2(Single.Parse(parts[0].Trim(), CultureInfo.InvariantCulture),
25 Single.Parse(parts[1].Trim(), CultureInfo.InvariantCulture));
29 throw new InvalidOperationException($"Cannot convert \"{value}\" into {typeof(Vector2)}");
33 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
34 [EditorBrowsable(EditorBrowsableState.Never)]
35 public class Vector3TypeConverter : TypeConverter
37 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
38 [EditorBrowsable(EditorBrowsableState.Never)]
39 public override object ConvertFromInvariantString(string value)
43 string[] parts = value.Split(',');
44 if (parts.Length == 3 )
46 return new Vector3(Single.Parse(parts[0].Trim(), CultureInfo.InvariantCulture),
47 Single.Parse(parts[1].Trim(), CultureInfo.InvariantCulture),
48 Single.Parse(parts[2].Trim(), CultureInfo.InvariantCulture));
52 throw new InvalidOperationException($"Cannot convert \"{value}\" into {typeof(Vector3)}");
56 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
57 [EditorBrowsable(EditorBrowsableState.Never)]
58 public class Vector4TypeConverter : TypeConverter
60 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
61 [EditorBrowsable(EditorBrowsableState.Never)]
62 public override object ConvertFromInvariantString(string value)
66 string[] parts = value.Split(',');
67 if (parts.Length == 4 )
69 return new Vector4(Single.Parse(parts[0].Trim(), CultureInfo.InvariantCulture),
70 Single.Parse(parts[1].Trim(), CultureInfo.InvariantCulture),
71 Single.Parse(parts[2].Trim(), CultureInfo.InvariantCulture),
72 Single.Parse(parts[3].Trim(), CultureInfo.InvariantCulture));
76 throw new InvalidOperationException($"Cannot convert \"{value}\" into {typeof(Vector4)}");
80 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
81 [EditorBrowsable(EditorBrowsableState.Never)]
82 public class RelativeVector2TypeConverter : TypeConverter
84 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
85 [EditorBrowsable(EditorBrowsableState.Never)]
86 public override object ConvertFromInvariantString(string value)
90 string[] parts = value.Split(',');
91 if (parts.Length == 2 )
93 return new RelativeVector2(Single.Parse(parts[0].Trim(), CultureInfo.InvariantCulture),
94 Single.Parse(parts[1].Trim(), CultureInfo.InvariantCulture));
98 throw new InvalidOperationException("Cannot convert \"{value}\" into {typeof(RelativeVector2)}");
102 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
103 [EditorBrowsable(EditorBrowsableState.Never)]
104 public class RelativeVector3TypeConverter : TypeConverter
106 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
107 [EditorBrowsable(EditorBrowsableState.Never)]
108 public override object ConvertFromInvariantString(string value)
112 string[] parts = value.Split(',');
113 if (parts.Length == 3 )
115 return new RelativeVector3(Single.Parse(parts[0].Trim(), CultureInfo.InvariantCulture),
116 Single.Parse(parts[1].Trim(), CultureInfo.InvariantCulture),
117 Single.Parse(parts[2].Trim(), CultureInfo.InvariantCulture));
121 throw new InvalidOperationException($"Cannot convert \"{value}\" into {typeof(RelativeVector3)}");
125 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
126 [EditorBrowsable(EditorBrowsableState.Never)]
127 public class RelativeVector4TypeConverter : TypeConverter
129 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
130 [EditorBrowsable(EditorBrowsableState.Never)]
131 public override object ConvertFromInvariantString(string value)
135 string[] parts = value.Split(',');
136 if (parts.Length == 4 )
138 return new RelativeVector4(Single.Parse(parts[0].Trim(), CultureInfo.InvariantCulture),
139 Single.Parse(parts[1].Trim(), CultureInfo.InvariantCulture),
140 Single.Parse(parts[2].Trim(), CultureInfo.InvariantCulture),
141 Single.Parse(parts[3].Trim(), CultureInfo.InvariantCulture));
145 throw new InvalidOperationException($"Cannot convert \"{value}\" into {typeof(RelativeVector4)}");