• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

MorganKryze / ConsoleAppVisuals / 8158191062

05 Mar 2024 02:47PM UTC coverage: 86.165% (+0.9%) from 85.231%
8158191062

push

github

MorganKryze
📖 (readme) update roadmap

931 of 1144 branches covered (81.38%)

Branch coverage included in aggregate %.

1803 of 2029 relevant lines covered (88.86%)

412.64 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

100.0
/src/ConsoleAppVisuals/elements/static_elements/Footer.cs
1
/*
2
    GNU GPL License 2024 MorganKryze(Yann Vidamment)
3
    For full license information, please visit: https://github.com/MorganKryze/ConsoleAppVisuals/blob/main/LICENSE
4
*/
5
namespace ConsoleAppVisuals.Elements;
6

7
/// <summary>
8
/// Defines the footer of the console window.
9
/// </summary>
10
/// <remarks>
11
/// For more information, refer to the following resources:
12
/// <list type="bullet">
13
/// <item><description><a href="https://morgankryze.github.io/ConsoleAppVisuals/">Documentation</a></description></item>
14
/// <item><description><a href="https://github.com/MorganKryze/ConsoleAppVisuals/blob/main/example/">Example Project</a></description></item>
15
/// </list>
16
/// </remarks>
17
public class Footer : Element
18
{
19
    #region Fields
20
    private (string, string, string) _text;
21
    #endregion
22

23
    #region Constants
24
    private const int TEXT_HEIGHT = 1;
25
    #endregion
26

27
    #region Properties
28
    /// <summary>
29
    /// The placement of the footer.
30
    /// </summary>
31
    public override Placement Placement => Placement.BottomCenterFullWidth;
12✔
32

33
    /// <summary>
34
    /// The height of the footer.
35
    /// </summary>
36
    public override int Height => TEXT_HEIGHT;
2✔
37

38
    /// <summary>
39
    /// The width of the footer.
40
    /// </summary>
41
    public override int Width => Console.WindowWidth;
2✔
42

43
    /// <summary>
44
    /// The text of the footer.
45
    /// </summary>
46
    public (string, string, string) Text => _text;
16✔
47
    #endregion
48

49

50

51
    #region Constructor
52
    /// <summary>
53
    /// The natural constructor of the footer.
54
    /// </summary>
55
    /// <param name="leftText">The text on the left of the footer.</param>
56
    /// <param name="centerText">The text in the center of the footer.</param>
57
    /// <param name="rightText">The text on the right of the footer.</param>
58
    /// <remarks>
59
    /// For more information, refer to the following resources:
60
    /// <list type="bullet">
61
    /// <item><description><a href="https://morgankryze.github.io/ConsoleAppVisuals/">Documentation</a></description></item>
62
    /// <item><description><a href="https://github.com/MorganKryze/ConsoleAppVisuals/blob/main/example/">Example Project</a></description></item>
63
    /// </list>
64
    /// </remarks>
65
    public Footer(
30✔
66
        string leftText = "Footer Left",
30✔
67
        string centerText = "Footer Center",
30✔
68
        string rightText = "Footer Right"
30✔
69
    )
30✔
70
    {
71
        _text.Item1 = leftText;
30✔
72
        _text.Item2 = centerText;
30✔
73
        _text.Item3 = rightText;
30✔
74
    }
30✔
75
    #endregion
76

77
    #region Methods
78
    /// <summary>
79
    /// This method is used to update the text on the left of the footer.
80
    /// </summary>
81
    /// <param name="leftText">The new text on the left of the footer.</param>
82
    /// <remarks>
83
    /// For more information, refer to the following resources:
84
    /// <list type="bullet">
85
    /// <item><description><a href="https://morgankryze.github.io/ConsoleAppVisuals/">Documentation</a></description></item>
86
    /// <item><description><a href="https://github.com/MorganKryze/ConsoleAppVisuals/blob/main/example/">Example Project</a></description></item>
87
    /// </list>
88
    /// </remarks>
89
    public void UpdateLeftText(string leftText)
90
    {
91
        _text.Item1 = leftText;
4✔
92
    }
4✔
93

94
    /// <summary>
95
    /// This method is used to update the text in the center of the footer.
96
    /// </summary>
97
    /// <param name="centerText">The new text in the center of the footer.</param>
98
    /// <remarks>
99
    /// For more information, refer to the following resources:
100
    /// <list type="bullet">
101
    /// <item><description><a href="https://morgankryze.github.io/ConsoleAppVisuals/">Documentation</a></description></item>
102
    /// <item><description><a href="https://github.com/MorganKryze/ConsoleAppVisuals/blob/main/example/">Example Project</a></description></item>
103
    /// </list>
104
    /// </remarks>
105
    public void UpdateCenterText(string centerText)
106
    {
107
        _text.Item2 = centerText;
4✔
108
    }
4✔
109

110
    /// <summary>
111
    /// This method is used to update the text on the right of the footer.
112
    /// </summary>
113
    /// <param name="rightText">The new text on the right of the footer.</param>
114
    /// <remarks>
115
    /// For more information, refer to the following resources:
116
    /// <list type="bullet">
117
    /// <item><description><a href="https://morgankryze.github.io/ConsoleAppVisuals/">Documentation</a></description></item>
118
    /// <item><description><a href="https://github.com/MorganKryze/ConsoleAppVisuals/blob/main/example/">Example Project</a></description></item>
119
    /// </list>
120
    /// </remarks>
121
    public void UpdateRightText(string rightText)
122
    {
123
        _text.Item3 = rightText;
4✔
124
    }
4✔
125

126
    /// <summary>
127
    /// This method is used to render the footer on the console.
128
    /// </summary>
129
    [Visual]
130
    protected override void RenderElementActions()
131
    {
132
        Core.WritePositionedString(_text.BannerToString(), TextAlignment.Center, true, Line, false);
133
    }
134
    #endregion
135
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc