Skip to content

Commit a2d6bbf

Browse files
authored
Merge pull request #42 from MADE-Apps/headeredtextblock
PR for #1 - Add support for a headered text block control
2 parents 11eeb15 + 4a66cbd commit a2d6bbf

126 files changed

Lines changed: 18358 additions & 2365 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,3 +289,13 @@ __pycache__/
289289

290290
# Additionals
291291
*.bak
292+
*.yml
293+
.manifest
294+
**/DROP/
295+
**/TEMP/
296+
**/packages/
297+
**/bin/
298+
**/obj/
299+
**/_site
300+
**/log.txt
301+
**/docfx.json

MADE.App.Design/Color/Color.cs

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99

1010
namespace MADE.App.Design.Color
1111
{
12+
using System.Globalization;
13+
1214
/// <summary>
1315
/// Defines a model for a UI element color.
1416
/// </summary>
@@ -37,6 +39,33 @@ internal Color(byte a, byte r, byte g, byte b)
3739
this.B = b;
3840
}
3941

42+
/// <summary>
43+
/// Initializes a new instance of the <see cref="Color"/> class.
44+
/// </summary>
45+
/// <param name="hexValue">
46+
/// The ARGB or RGB hex value represented as a string.
47+
/// </param>
48+
public Color(string hexValue)
49+
{
50+
string val = hexValue.ToUpper();
51+
52+
switch (val.Length)
53+
{
54+
case 7:
55+
this.A = 255;
56+
this.R = byte.Parse(val.Substring(1, 2), NumberStyles.AllowHexSpecifier);
57+
this.G = byte.Parse(val.Substring(3, 2), NumberStyles.AllowHexSpecifier);
58+
this.B = byte.Parse(val.Substring(5, 2), NumberStyles.AllowHexSpecifier);
59+
break;
60+
case 9:
61+
this.A = byte.Parse(val.Substring(1, 2), NumberStyles.AllowHexSpecifier);
62+
this.R = byte.Parse(val.Substring(3, 2), NumberStyles.AllowHexSpecifier);
63+
this.G = byte.Parse(val.Substring(5, 2), NumberStyles.AllowHexSpecifier);
64+
this.B = byte.Parse(val.Substring(7, 2), NumberStyles.AllowHexSpecifier);
65+
break;
66+
}
67+
}
68+
4069
#if WINDOWS_UWP || __ANDROID__
4170
/// <summary>
4271
/// Initializes a new instance of the <see cref="Color"/> class with a <see cref="System.Drawing.Color"/>.
@@ -186,7 +215,7 @@ public Color(UIKit.UIColor color)
186215
{
187216
if (color.CGColor.NumberOfComponents == 2)
188217
{
189-
var rgb = (byte)(color.CGColor.Components[0] * 255);
218+
byte rgb = (byte)(color.CGColor.Components[0] * 255);
190219
this.R = rgb;
191220
this.G = rgb;
192221
this.B = rgb;

MADE.App.Design/MADE.App.Design.csproj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,11 @@
5252
</ItemGroup>
5353

5454
<ItemGroup>
55-
<PackageReference Include="docfx.console" Version="2.36.0" PrivateAssets="All" />
5655
<PackageReference Include="MSBuild.Sdk.Extras" Version="1.5.4" PrivateAssets="All" />
5756
</ItemGroup>
5857

5958
<ItemGroup Condition=" '$(TargetFramework)' == 'uap10.0.16299' ">
60-
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform" Version="6.1.4" />
59+
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform" Version="6.1.5" />
6160
</ItemGroup>
6261

6362
<Import Project="$(MSBuildSDKExtrasTargets)" Condition="Exists('$(MSBuildSDKExtrasTargets)')" />
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
// --------------------------------------------------------------------------------------------------------------------
2+
// <copyright file="BaseStyle.iOS.cs" company="MADE Apps">
3+
// Copyright (c) MADE Apps.
4+
// </copyright>
5+
// <summary>
6+
// Defines a base class for creating styles that can be applied to iOS UIView elements.
7+
// </summary>
8+
// --------------------------------------------------------------------------------------------------------------------
9+
10+
#if __IOS__
11+
namespace MADE.App.Design.Styles
12+
{
13+
using MADE.App.Design.Color;
14+
15+
using UIKit;
16+
17+
/// <summary>
18+
/// Defines a base class for creating styles that can be applied to iOS <see cref="UIView"/> elements.
19+
/// </summary>
20+
/// <typeparam name="TView">
21+
/// The type of <see cref="UIView"/> to apply the style to.
22+
/// </typeparam>
23+
public abstract class BaseStyle<TView> where TView : UIView
24+
{
25+
/// <summary>
26+
/// Gets or sets the level of alpha transparency for the view from 0 to 1.
27+
/// </summary>
28+
public float? Opacity { get; set; }
29+
30+
/// <summary>
31+
/// Gets or sets the background color of the view.
32+
/// </summary>
33+
public Color BackgroundColor { get; set; }
34+
35+
/// <summary>
36+
/// Applies the properties of the style to the given <see cref="UIView"/>.
37+
/// </summary>
38+
/// <param name="view">
39+
/// The view to apply the style to.
40+
/// </param>
41+
public virtual void Apply(TView view)
42+
{
43+
if (view == null)
44+
{
45+
return;
46+
}
47+
48+
if (this.BackgroundColor != null)
49+
{
50+
view.BackgroundColor = this.BackgroundColor;
51+
}
52+
53+
if (this.Opacity != null && this.Opacity >= 0.0 && this.Opacity <= 1.0)
54+
{
55+
view.Alpha = (System.nfloat)this.Opacity;
56+
}
57+
}
58+
}
59+
}
60+
#endif
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
// --------------------------------------------------------------------------------------------------------------------
2+
// <copyright file="UILabelStyle.cs" company="MADE Apps">
3+
// Copyright (c) MADE Apps.
4+
// </copyright>
5+
// <summary>
6+
// Defines the style model for an iOS UILabel.
7+
// </summary>
8+
// --------------------------------------------------------------------------------------------------------------------
9+
10+
#if __IOS__
11+
namespace MADE.App.Design.Styles
12+
{
13+
using MADE.App.Design.Color;
14+
15+
using UIKit;
16+
17+
/// <summary>
18+
/// Defines the style model for an iOS <see cref="UILabel"/>.
19+
/// </summary>
20+
public class UILabelStyle : BaseStyle<UILabel>
21+
{
22+
/// <summary>
23+
/// Gets or sets the foreground color (color of the text) of the view.
24+
/// </summary>
25+
public Color ForegroundColor { get; set; }
26+
27+
/// <summary>
28+
/// Gets or sets the alignment of the text in the view.
29+
/// </summary>
30+
public UITextAlignment TextAlignment { get; set; }
31+
32+
/// <summary>
33+
/// Applies the properties of the style to the given <see cref="UILabel"/>.
34+
/// </summary>
35+
/// <param name="view">
36+
/// The view to apply the style to.
37+
/// </param>
38+
public override void Apply(UILabel view)
39+
{
40+
base.Apply(view);
41+
42+
if (this.ForegroundColor != null)
43+
{
44+
view.TextColor = this.ForegroundColor;
45+
}
46+
47+
view.TextAlignment = this.TextAlignment;
48+
}
49+
}
50+
}
51+
#endif

MADE.App.Mvvm/MADE.App.Mvvm.csproj

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,4 @@
4646
<None Remove="toc.yml" />
4747
</ItemGroup>
4848

49-
<ItemGroup>
50-
<PackageReference Include="docfx.console" Version="2.36.0" PrivateAssets="All" />
51-
</ItemGroup>
52-
5349
</Project>

0 commit comments

Comments
 (0)