Last active
August 29, 2015 14:16
-
-
Save FredrikAugust/47347ee97060b27c0cdd to your computer and use it in GitHub Desktop.
Simple GUI Sketch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace SimpleGUI_sketch | |
{ | |
interface IOption | |
{ | |
string Name { get; set; } | |
string Desc { get; set; } | |
} | |
class Option | |
{ | |
private string name; | |
private string desc; | |
public string Name | |
{ | |
get | |
{ | |
return this.name; | |
} | |
set | |
{ | |
if (value.Length > 1) | |
{ | |
this.name = value; | |
} | |
} | |
} | |
public string Desc | |
{ | |
get | |
{ | |
return this.desc; | |
} | |
set | |
{ | |
if (value.Length > 1) | |
{ | |
this.desc = value; | |
} | |
} | |
} | |
} | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
// Create some random options | |
Option newFile = new Option(); | |
Option removeFile = new Option(); | |
newFile.Name = "New File"; | |
newFile.Desc = "Creates a new file"; | |
removeFile.Name = "Delete File"; | |
removeFile.Desc = "Deletes a file"; | |
List<Option> Options = new List<Option>(); | |
Options.Add(newFile); | |
Options.Add(removeFile); | |
for (int i = 0; i < Options.Count; i++ ) | |
{ | |
string _name = Options[i].Name; | |
string _desc = Options[i].Desc; | |
if (i == 0) | |
{ | |
Console.BackgroundColor = ConsoleColor.White; | |
Console.ForegroundColor = ConsoleColor.Black; | |
Console.WriteLine("Name: {0}".PadRight(Console.WindowWidth - (1 + _name.Length)), _name); | |
Console.WriteLine("Desc: {0}".PadRight(Console.WindowWidth - (1 + _desc.Length)), _desc); | |
Console.ResetColor(); | |
Console.WriteLine(); | |
continue; | |
} | |
Console.WriteLine("Name: {0}", _name); | |
Console.WriteLine("Desc: {0}", _desc); | |
Console.WriteLine(); | |
} | |
Console.ReadKey(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
this is not a representation of the finished "product", this one does not feature any user interaction, it simply shows how the program looks. roughly