added getsection method
This commit is contained in:
6
.gitignore
vendored
Normal file
6
.gitignore
vendored
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
.vscode
|
||||||
|
.bin
|
||||||
|
TerminalGui.csproj
|
||||||
|
Program.cs
|
||||||
|
bin
|
||||||
|
obj
|
||||||
15
section.cs
15
section.cs
@@ -3,6 +3,7 @@ using System;
|
|||||||
namespace sections
|
namespace sections
|
||||||
{
|
{
|
||||||
public class Section {
|
public class Section {
|
||||||
|
string _name;
|
||||||
int _x;
|
int _x;
|
||||||
int _y;
|
int _y;
|
||||||
int _padding;
|
int _padding;
|
||||||
@@ -14,6 +15,7 @@ public class Section {
|
|||||||
string _value;
|
string _value;
|
||||||
|
|
||||||
public Section(){
|
public Section(){
|
||||||
|
_name = nameof(this);
|
||||||
_x = 0;
|
_x = 0;
|
||||||
_y = 0;
|
_y = 0;
|
||||||
_padding = 2;
|
_padding = 2;
|
||||||
@@ -23,6 +25,7 @@ public class Section {
|
|||||||
_toTop = null;
|
_toTop = null;
|
||||||
}
|
}
|
||||||
public Section (int x, int y, int padding = 2) {
|
public Section (int x, int y, int padding = 2) {
|
||||||
|
_name = nameof(this);
|
||||||
_x = x;
|
_x = x;
|
||||||
_y = y;
|
_y = y;
|
||||||
_value = "This value was not set.";
|
_value = "This value was not set.";
|
||||||
@@ -90,22 +93,12 @@ public class Section {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public string Value {
|
|
||||||
get {
|
|
||||||
return _value;
|
|
||||||
} set {
|
|
||||||
_value = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private string[] Output {
|
private string[] Output {
|
||||||
get {
|
get {
|
||||||
string[] outputString;
|
string[] outputString;
|
||||||
string buffer = "";
|
string buffer = "";
|
||||||
bool isMultiLine = false;
|
bool isMultiLine = false;
|
||||||
int colsFromAllowedEdge = (int)((Console.WindowWidth - X - _padding)/2);
|
int colsFromAllowedEdge = Console.WindowWidth - X - _padding;
|
||||||
for (int i = 0; i < _value.Length; i++) {
|
for (int i = 0; i < _value.Length; i++) {
|
||||||
if (i < 0 && colsFromAllowedEdge % i == 0) {
|
if (i < 0 && colsFromAllowedEdge % i == 0) {
|
||||||
buffer += '|';
|
buffer += '|';
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ namespace window
|
|||||||
|
|
||||||
public class Display
|
public class Display
|
||||||
{
|
{
|
||||||
Dictionary<int, Section> sectionList;
|
Dictionary<string, Section> sectionList;
|
||||||
|
|
||||||
|
|
||||||
public Display () {
|
public Display () {
|
||||||
@@ -15,7 +15,10 @@ namespace window
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void AddSection(Section section) {
|
public void AddSection(Section section) {
|
||||||
sectionList.Add(sectionList.Count,section);
|
sectionList.Add(section._name,section);
|
||||||
|
}
|
||||||
|
public Section GetSection (string sectionName) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Present() {
|
public void Present() {
|
||||||
|
|||||||
Reference in New Issue
Block a user