private void Create(String Message, Window parentWindow) { var count = 0; while ((count*45) < Message.Count()) { var splitMessage = Message.PadRight(textLength * (count + 1), ' ').Substring((count * textLength), textLength); var messageLabel = new Label(splitMessage, PostionX + 2 + count, PostionY + 2, "messageLabel", this); Inputs.Add(messageLabel); count++; } /* var messageLabel = new Label(Message, PostionX + 2, PostionY + 2, "messageLabel", this); messageLabel.BackgroundColour = BackgroundColour;*/ okBtn = new Button(PostionX + Height - 2, PostionY + 2, "OK", "OkBtn", this); okBtn.Action = delegate() { ExitWindow(); }; Inputs.Add(okBtn); CurrentlySelected = okBtn; Draw(); MainLoop(); }
public LoadMenu(String path, Dictionary<String, String> fileTypes, Window parentWindow) : base("Load Menu", Math.Min(6, Console.WindowHeight - 22), (Console.WindowWidth / 2) - 30, 60, 20, parentWindow) { BackgroundColour = ConsoleColor.White; FileTypes = fileTypes; fileSelect = new FileBrowser(PostionX + 2, PostionY + 2, 56, 13, path, "fileSelect", this, true, "txt"); fileSelect.ChangeItem = delegate() { UpdateCurrentlySelectedFileName(); }; fileSelect.SelectFile = delegate() { LoadFile(); }; var openLabel = new Label("Open", PostionX + 16, PostionY + 2, "openLabel", this); openTxtBox = new TextBox(PostionX + 16, PostionY + 7, "openTxtBox", this, Width - 13) { Selectable = false }; fileTypeDropdown = new Dropdown(PostionX + 18, PostionY + 40, FileTypes.Select(x => x.Value).ToList(), "fileTypeDropdown", this, 17); fileTypeDropdown.OnUnselect = delegate() { UpdateFileTypeFilter(); }; loadBtn = new Button(PostionX + 18, PostionY + 2, "Load", "loadBtn", this); loadBtn.Action = delegate() { LoadFile(); }; cancelBtn = new Button(PostionX + 18, PostionY + 9, "Cancel", "cancelBtn", this); cancelBtn.Action = delegate() { ExitWindow(); }; Inputs.Add(fileSelect); Inputs.Add(loadBtn); Inputs.Add(cancelBtn); Inputs.Add(openLabel); Inputs.Add(openTxtBox); Inputs.Add(fileTypeDropdown); CurrentlySelected = fileSelect; Draw(); MainLoop(); }
public SaveMenu(String data, Window parentWindow) : base("Save Menu", 6, (Console.WindowWidth / 2) - 30, 60, 20, parentWindow) { Text = data; fileSelect = new FileBrowser(PostionX + 2, PostionY + 2, Width - 4, 13, FileInfo.Path, "fileSelect", this); var openLabel = new Label("Name", PostionX + 16, PostionY + 2, "openLabel", this); openTxtBox = new TextBox(PostionX + 16, PostionY + 7, FileInfo.Filename, "openTxtBox", this) { Selectable = true }; saveBtn = new Button(PostionX + 18, PostionY + 2, "Save", "loadBtn", this); saveBtn.Action = delegate() { SaveFile(); }; cancelBtn = new Button(PostionX + 18, PostionY + 9, "Cancel", "cancelBtn", this); cancelBtn.Action = delegate() { ExitWindow(); }; Inputs.Add(fileSelect); Inputs.Add(openLabel); Inputs.Add(openTxtBox); Inputs.Add(saveBtn); Inputs.Add(cancelBtn); CurrentlySelected = saveBtn; Draw(); MainLoop(); }
public Resolution(Window parentWindow) : base("Change Resolution", 6, (Console.WindowWidth / 2) - 15, 30, 8, parentWindow) { var widthLabel = new Label("Width", PostionX + 2, PostionY + 2, "widthLabel", parentWindow) { BackgroundColour = ConsoleColor.Gray }; widthTxtBox = new TextBox(PostionX + 2, PostionY + 10, Console.WindowWidth.ToString(), "widthTxtBox", this, 5); var widthMaxBtn = new Button(PostionX + 2, PostionY + 17, "Max", "widthMaxBtn", this); widthMaxBtn.Action = delegate() { widthTxtBox.SetText(Console.LargestWindowWidth.ToString()); }; var heightLabel = new Label("Height", PostionX + 4, PostionY + 2, "widthLabel", parentWindow) { BackgroundColour = ConsoleColor.Gray }; heightTxtBox = new TextBox(PostionX + 4, PostionY + 10, Console.WindowHeight.ToString(), "heightTxtBox", this, 5); var heightMaxBtn = new Button(PostionX + 4, PostionY + 17, "Max", "heighthMaxBtn", this); heightMaxBtn.Action = delegate() { heightTxtBox.SetText(Console.LargestWindowHeight.ToString()); }; applyBtn = new Button(PostionX + 6, PostionY + 2, "Apply", "applyBtn", this); applyBtn.Action = delegate() { Apply(); }; exitBtn = new Button(PostionX + 6, PostionY + 10, "Exit", "exitBtn", this); exitBtn.Action = delegate() { ExitWindow(); }; Inputs.Add(widthLabel); Inputs.Add(widthTxtBox); Inputs.Add(widthMaxBtn); Inputs.Add(heightLabel); Inputs.Add(heightTxtBox); Inputs.Add(heightMaxBtn); Inputs.Add(applyBtn); Inputs.Add(exitBtn); CurrentlySelected = applyBtn; Draw(); MainLoop(); }
public MainWindow() : base(0, 0, Console.WindowWidth, Console.WindowHeight, null) { Display = new TextBox(2, 3, "0", "displayTxtBox", this, 21) { Selectable = false }; Button PointBtn = new Button(13, 8, " . ", "pointBtn", this) { Action = delegate() { AddPoint(); } }; Button ClearBtn = new Button(5, 2, " C ", "clearBtn", this) { Action = delegate() { Clear(); } }; Button ZeroBtn = new Button(13, 2, " 0 ", "zeroBtn", this) { Action = delegate() { Number('0'); } }; Button OneBtn = new Button(11, 2, " 1 ", "oneBtn", this) { Action = delegate() { Number('1'); } }; Button TwoBtn = new Button(11, 8, " 2 ", "twoBtn", this) { Action = delegate() { Number('2'); } }; Button ThreeBtn = new Button(11, 14, " 3 ", "threeBtn", this) { Action = delegate() { Number('3'); } }; Button FourBtn = new Button(9, 2, " 4 ", "fourBtn", this) { Action = delegate() { Number('4'); } }; Button FiveBtn = new Button(9, 8, " 5 ", "fiveBtn", this) { Action = delegate() { Number('5'); } }; Button SixBtn = new Button(9, 14, " 6 ", "sixBtn", this) { Action = delegate() { Number('6'); } }; Button SevenBtn = new Button(7, 2, " 7 ", "sevenBtn", this) { Action = delegate() { Number('7'); } }; Button EightBtn = new Button(7, 8, " 8 ", "eightBtn", this) { Action = delegate() { Number('8'); } }; Button NineBtn = new Button(7, 14, " 9 ", "nineBtn", this) { Action = delegate() { Number('9'); } }; var minusBtn = new Button(5, 20, " - ", "minusBtn", this) { Action = delegate() { Operator('-'); } }; var addBtn = new Button(7, 20, " + ", "addBtn", this) { Action = delegate() { Operator('+'); } }; var timesBtn = new Button(9, 20, " x ", "timesBtn", this) { Action = delegate() { Operator('*'); } }; var divideBtn = new Button(11, 20, " / ", "divideBtn", this) { Action = delegate() { Operator('/'); } }; var equalsBtn = new Button(13, 14, " = ", "equalsBtn", this) { Action = delegate() { Operator('='); } }; Inputs.Add(Display); Inputs.Add(ClearBtn); Inputs.Add(minusBtn); Inputs.Add(SevenBtn); Inputs.Add(EightBtn); Inputs.Add(NineBtn); Inputs.Add(addBtn); Inputs.Add(FourBtn); Inputs.Add(FiveBtn); Inputs.Add(SixBtn); Inputs.Add(timesBtn); Inputs.Add(OneBtn); Inputs.Add(TwoBtn); Inputs.Add(ThreeBtn); Inputs.Add(divideBtn); Inputs.Add(ZeroBtn); Inputs.Add(PointBtn); Inputs.Add(equalsBtn); CurrentlySelected = OneBtn; Draw(); MainLoop(); }
public MainWindow() : base("Change Folder", 1, (Console.WindowWidth / 2) - ((Console.WindowWidth - 4) / 2), Console.WindowWidth - 4, Console.WindowHeight - 2, null) { var folderSelect = new FileSelect(3, 3, Console.WindowWidth - 6, Height - 6, Directory.GetCurrentDirectory(), "folderSelect", this, true); folderSelect.SelectFile = delegate() { Path = folderSelect.CurrentPath; changePath = true; ExitWindow(); }; var selectBtn = new Button(PostionX + Height - 2, 3, "Select", "selectBtn", this); selectBtn.Action = delegate() { Path = folderSelect.CurrentPath; changePath = true; ExitWindow(); }; var cancelBtn = new Button(PostionX + Height - 2, 12, "Cancel", "cancelBtn", this); cancelBtn.Action = delegate() { changePath = false; ExitWindow(); }; Inputs.Add(folderSelect); Inputs.Add(selectBtn); Inputs.Add(cancelBtn); CurrentlySelected = selectBtn; Draw(); MainLoop(); }
public SettingsWindow(Window parentWindow) : base("Settings", 6, 10, 80, 20, parentWindow) { BackgroundColour = ConsoleColor.White; var appTitleLabel = new Label("App Title", 8, 12, "appTitleLabel", this); var appTitleTxtBox = new TextBox(8, 25, Console.Title, "appTitleTxtBox", this, 10); var saveOnExitLabel = new Label("Save On Exit", 10, 12, "saveOnExitLabel", this); var saveOneExitChkBox = new CheckBox(10, 25, "saveOnExitCheckBox", this); var byAllLabel = new Label("For All", 12, 12, "forAll", this); var byAllRadioBtn = new RadioButton(12, 25, "byAllRadioBtn", "Users", this) { Checked = true }; var justYouLabel = new Label("Just You", 14, 12, "justYou", this); var justYouRadioBtn = new RadioButton(14, 25, "justYouRadioBtn", "Users", this); var applyBtn = new Button(24, 12, "Apply", "exitBtn", this) { Action = delegate() { ExitWindow(); } }; var exitBtn = new Button(24, 20, "Exit", "exitBtn", this) { Action = delegate() { ExitWindow(); } }; Inputs.Add(appTitleLabel); Inputs.Add(appTitleTxtBox); Inputs.Add(saveOnExitLabel); Inputs.Add(saveOneExitChkBox); Inputs.Add(byAllLabel); Inputs.Add(byAllRadioBtn); Inputs.Add(justYouLabel); Inputs.Add(justYouRadioBtn); Inputs.Add(applyBtn); Inputs.Add(exitBtn); CurrentlySelected = exitBtn; Draw(); MainLoop(); }
public MainWindow() : base(0, 0, Console.WindowWidth, Console.WindowHeight, null) { var oneBtn = new Button(2, 2, "Button One", "oneBtn", this) { Action = delegate() { new Alert("You Clicked Button One", this, ConsoleColor.White); } }; var twoBtn = new Button(4, 2, "Button Two", "twoBtn", this) { Action = delegate() { new Alert("You Clicked Button Two", this, ConsoleColor.White); } }; var threeBtn = new Button(6, 2, "Long Alert", "threeoBtn", this) { Action = delegate() { new Alert("A web browser (commonly referred to as a browser) is a software application for retrieving, presenting and traversing information resources on the World Wide", this, ConsoleColor.White); } }; var displayAlertBtn = new Button(2, 20, "Display Alert", "displayAlertBtn", this) { Action = delegate() { new Alert("This is an Alert!", this, ConsoleColor.White); } }; var displayConfirmBtn = new Button(4, 20, "Display Confirm", "displayConfirmBtn", this) { Action = delegate() { new Confirm("This is a Confirm!", this, ConsoleColor.White); } }; var exitBtn = new Button(6, 20, "Exit", "exitBtn", this) { Action = delegate() { ExitWindow(); } }; var displaySettingBtn = new Button(2, 40, "Display Settings", "displaySettingsBtn", this) { Action = delegate() { new SettingsWindow(this); } }; var displaySaveBtn = new Button(4, 40, "Display Save Menu", "displaySaveMenuBtn", this) { Action = delegate() { new SaveMenu("Untitled.txt", Directory.GetCurrentDirectory(), "Test Data", this); } }; var displayLoadBtn = new Button(6, 40, "Display Load Menu", "displayLoadMenuBtn", this) { Action = delegate() { new LoadMenu(Directory.GetCurrentDirectory(), new Dictionary<string, string>() {{"txt", "Text Document"}, {"*","All Files"}}, this); } }; var oneCheckBox = new CheckBox(10, 2, "oneCheckBox", this); var oneCheckBoxLabel = new Label("Check Box One", 10, 6, "oneCheckBoxLabel", this); var twoCheckBox = new CheckBox(12, 2, "twoCheckBox", this) { Checked = true }; var twoCheckBoxLabel = new Label("Check Box Two", 12, 6, "twoCheckBoxLabel", this); var threeCheckBox = new CheckBox(14, 2, "threeCheckBox", this); var threeCheckBoxLabel = new Label("Check Box Three", 14, 6, "threeCheckBoxLabel", this); var groupOneLabel = new Label("Radio Button Group One", 9, 25, "oneCheckBoxLabel", this); var oneRadioBtnGroupOne = new RadioButton(10, 25, "oneRadioBtnGroupOne", "groupOne", this) { Checked = true }; var oneRadioBtnGroupOneLabel = new Label("Radio Button One", 10, 29, "oneCheckBoxLabel", this); var twoRadioBtnGroupOne = new RadioButton(12, 25, "twoRadioBtnGroupOne", "groupOne", this); var twoRadioBtnGroupOneLabel = new Label("Radio Button Two", 12, 29, "oneCheckBoxLabel", this); var threeRadioBtnGroupOne = new RadioButton(14, 25, "threeRadioBtnGroupOne", "groupOne", this); var threeRadioBtnGroupOneLabel = new Label("Radio Button Three", 14, 29, "oneCheckBoxLabel", this); var groupTwoLabel = new Label("Radio Button Group Two", 9, 50, "oneCheckBoxLabel", this); var oneRadioBtnGroupTwo = new RadioButton(10, 50, "oneRadioBtnGroupTwo", "groupTwo", this) { Checked = true }; var twoRadioBtnGroupTwo = new RadioButton(12, 50, "twoRadioBtnGroupTwo", "groupTwo", this); var threeRadioBtnGroupTwo = new RadioButton(14, 50, "threeRadioBtnGroupTwo", "groupTwo", this); var textAreaLabel = new Label("Text Area", 16, 2, "textAreaLabel", this); var textArea = new TextArea(17, 2, 60, 6, "txtArea", this); textArea.BackgroundColour = ConsoleColor.DarkGray; var txtBoxLabel = new Label("Text Box", 24, 2, "txtBoxLabel", this); var txtBox = new TextBox(24, 11, "txtBox", this); var fileSelect = new FileBrowser(26, 2, 40, 10, Directory.GetCurrentDirectory(), "fileSelect", this, true); Inputs.Add(oneBtn); Inputs.Add(twoBtn); Inputs.Add(threeBtn); Inputs.Add(oneCheckBox); Inputs.Add(oneCheckBoxLabel); Inputs.Add(twoCheckBox); Inputs.Add(twoCheckBoxLabel); Inputs.Add(threeCheckBox); Inputs.Add(threeCheckBoxLabel); Inputs.Add(displayAlertBtn); Inputs.Add(displayConfirmBtn); Inputs.Add(exitBtn); Inputs.Add(groupOneLabel); Inputs.Add(oneRadioBtnGroupOne); Inputs.Add(oneRadioBtnGroupOneLabel); Inputs.Add(twoRadioBtnGroupOne); Inputs.Add(twoRadioBtnGroupOneLabel); Inputs.Add(threeRadioBtnGroupOne); Inputs.Add(threeRadioBtnGroupOneLabel); Inputs.Add(displaySettingBtn); Inputs.Add(displaySaveBtn); Inputs.Add(displayLoadBtn); Inputs.Add(groupTwoLabel); Inputs.Add(oneRadioBtnGroupTwo); Inputs.Add(twoRadioBtnGroupTwo); Inputs.Add(threeRadioBtnGroupTwo); Inputs.Add(textAreaLabel); Inputs.Add(textArea); Inputs.Add(txtBoxLabel); Inputs.Add(txtBox); Inputs.Add(fileSelect); CurrentlySelected = oneBtn; Draw(); MainLoop(); }