private void Create(String Message, TuiWindow parentTuiWindow) { var count = 0; while ((count * 45) < Message.Count()) { var splitMessage = Message.PadRight(textLength * (count + 1), ' ').Substring((count * textLength), textLength); var messageLabel = new TuiLabel(splitMessage, X + 2 + count, Y + 2, "messageLabel", this); AddControl(messageLabel); count++; } okBtn = new TuiButton(X + Height - 2, Y + 2, "OK", "OkBtn", this); okBtn.Action = delegate() { Result = true; Close(); }; cancelBtn = new TuiButton(X + Height - 2, Y + 8, "Cancel", "cancelBtn", this); cancelBtn.Action = delegate() { Close(); }; AddControl(okBtn); AddControl(cancelBtn); CurrentlySelected = okBtn; Draw(); }
public TuiConfirm(String Message, TuiWindow parentTuiWindow, ConsoleColor backgroundColor, String Title = "Message") : base(Title, 6, (Console.WindowWidth / 2) - 25, 50, 5 + (int)Math.Ceiling(((Double)Message.Count() / textLength)), parentTuiWindow) { BackgroundColor = backgroundColor; Create(Message, parentTuiWindow); }
public TuiRadioButton(int x, int y, String id, String radioGroup, TuiWindow parentWindow) : base(x, y, 1, 3, parentWindow, id) { RadioGroup = radioGroup; BackgroundColour = parentWindow.BackgroundColor; Selectable = true; }
private void Init(String Message, TuiWindow parentTuiWindow) { var count = 0; while ((count * 45) < Message.Count()) { var splitMessage = Message.PadRight(textLength * (count + 1), ' ').Substring((count * textLength), textLength); var messageLabel = new TuiLabel(splitMessage, X + 2 + count, Y + 2, "messageLabel", this); AddControl(messageLabel); count++; } /* * var messageLabel = new TuiLabel(Message, X + 2, Y + 2, "messageLabel", this); * messageLabel.BackgroundColor = BackgroundColor;*/ okBtn = new TuiButton(X + Height - 2, Y + 2, "OK", "OkBtn", this) { Action = delegate { Close(); } }; AddControl(okBtn); CurrentlySelected = okBtn; Draw(); }
public TuiSaveMenu(String fileName, String path, String data, TuiWindow parentTuiWindow) : base("Save Menu", 6, (Console.WindowWidth / 2) - 30, 60, 20, parentTuiWindow) { BackgroundColor = ConsoleColor.White; Text = data; _tuiFileSelect = new TuiFileBrowser(X + 2, Y + 2, 56, 12, path, "FileSelect", this); var openLabel = new TuiLabel("Name", X + 16, Y + 2, "openLabel", this); openTxtBox = new TuiTextBox(X + 16, Y + 7, fileName, "openTxtBox", this, Width - 13) { Selectable = true }; saveBtn = new TuiButton(X + 18, Y + 2, "Save", "loadBtn", this); saveBtn.Action = delegate() { SaveFile(); }; cancelBtn = new TuiButton(X + 18, Y + 9, "Cancel", "cancelBtn", this); cancelBtn.Action = delegate() { Close(); }; AddControl(_tuiFileSelect); AddControl(openLabel); AddControl(openTxtBox); AddControl(saveBtn); AddControl(cancelBtn); CurrentlySelected = saveBtn; Draw(); }
public TuiDropdownItem(String text, int x, String id, TuiWindow parentWindow) : base(x, parentWindow.Y + 1, 1, parentWindow.Width - 2, parentWindow, id) { Text = text; Selectable = true; }
public TuiAlert(String Message, TuiWindow parentTuiWindow, ConsoleColor backgroundColor, String Title) : base(Title, 6, (Console.WindowWidth / 2) - 25, 50, 5 + (int)Math.Ceiling(((Double)Message.Count() / textLength)), parentTuiWindow) { BackgroundColor = backgroundColor; Init(Message, parentTuiWindow); }
public TuiDropdown(int x, int y, List <String> options, String id, TuiWindow parentWindow, int length = 20) : base(x, y, 1, length - 2 + 3, parentWindow, id) { X = x; Y = y; Options = options; Text = Options.First(); Length = length; BackgroudColour = parentWindow.BackgroundColor; Selectable = true; }
public TuiDropdown(int x, int y, List<String> options, String id, TuiWindow parentWindow, int length = 20) : base(x, y, 1, length - 2 + 3, parentWindow, id) { X = x; Y = y; Options = options; Text = Options.First(); Length = length; BackgroudColour = parentWindow.BackgroundColor; Selectable = true; }
public TuiFileBrowser(int x, int y, int width, int height, String path, String id, TuiWindow parentWindow, bool includeFiles = false, string filterByExtension = "*") : base(x, y, height, width, parentWindow, id) { CurrentPath = path; CurrentlySelectedFile = ""; IncludeFiles = includeFiles; FilterByExtension = filterByExtension; Drives = Directory.GetLogicalDrives().ToList(); GetFileNames(); Selectable = true; }
public TuiDropdownSpread(int Xpostion, int Ypostion, List <String> options, TuiWindow parentTuiWindow, TuiDropdown root) : base(Xpostion, Ypostion, 20, options.Count, parentTuiWindow, ConsoleColor.Gray) { for (var i = 0; i < options.Count(); i++) { var item = new TuiDropdownItem(options[i], Xpostion + i, "option" + i, this); item.Action = delegate() { root.Text = ((TuiDropdownItem)CurrentlySelected).Text; root.Draw(); }; DropdownItems.Add(item); } _controls.AddRange(DropdownItems); CurrentlySelected = DropdownItems.FirstOrDefault(x => x.Text == root.Text); BackgroundColor = ConsoleColor.DarkGray; Draw(); }
public TuiDropdownSpread(int Xpostion, int Ypostion, List<String> options, TuiWindow parentTuiWindow, TuiDropdown root) : base(Xpostion, Ypostion, 20, options.Count, parentTuiWindow, ConsoleColor.Gray) { for (var i = 0; i < options.Count(); i++) { var item = new TuiDropdownItem(options[i], Xpostion + i, "option" + i, this); item.Action = delegate() { root.Text = ((TuiDropdownItem)CurrentlySelected).Text; root.Draw(); }; DropdownItems.Add(item); } _controls.AddRange(DropdownItems); CurrentlySelected = DropdownItems.FirstOrDefault(x => x.Text == root.Text); BackgroundColor = ConsoleColor.DarkGray; Draw(); }
public TuiLoadMenu(String path, Dictionary <String, String> fileTypes, TuiWindow parentTuiWindow) : base("Load TuiMenu", Math.Min(6, Console.WindowHeight - 22), (Console.WindowWidth / 2) - 30, 60, 20, parentTuiWindow) { BackgroundColor = ConsoleColor.White; FileTypes = fileTypes; _tuiFileSelect = new TuiFileBrowser(X + 2, Y + 2, 56, 13, path, "_tuiFileSelect", this, true, "txt"); _tuiFileSelect.ChangeItem = delegate() { UpdateCurrentlySelectedFileName(); }; _tuiFileSelect.SelectFile = delegate() { LoadFile(); }; var openLabel = new TuiLabel("Open", X + 16, Y + 2, "openLabel", this); openTxtBox = new TuiTextBox(X + 16, Y + 7, "openTxtBox", this, Width - 13) { Selectable = false }; _fileTypeTuiDropdown = new TuiDropdown(X + 18, Y + 40, FileTypes.Select(x => x.Value).ToList(), "_fileTypeTuiDropdown", this, 17); _fileTypeTuiDropdown.OnUnselect = delegate() { UpdateFileTypeFilter(); }; loadBtn = new TuiButton(X + 18, Y + 2, "Load", "loadBtn", this); loadBtn.Action = delegate() { LoadFile(); }; cancelBtn = new TuiButton(X + 18, Y + 9, "Cancel", "cancelBtn", this); cancelBtn.Action = delegate() { Close(); }; AddControl(_tuiFileSelect); AddControl(loadBtn); AddControl(cancelBtn); AddControl(openLabel); AddControl(openTxtBox); AddControl(_fileTypeTuiDropdown); CurrentlySelected = _tuiFileSelect; Draw(); }
public TuiTextArea(int x, int y, int width, int height, string id, TuiWindow parentWindow) : base(x, y, height, width, parentWindow, id) { IsSelectable = true; TextCursor = new TuiTextCursor(parentWindow); }
public TuiAlert(String Message, TuiWindow parentTuiWindow, String Title) : base(Title, 6, (Console.WindowWidth / 2) - 30, 25, 5 + (int)Math.Ceiling(((Double)Message.Count() / textLength)), parentTuiWindow) { Init(Message, parentTuiWindow); }
public TuiPopupWindow(string title, int x, int y, int width, int height, TuiWindow parentTuiWindow) : base(x, y, width, height, parentTuiWindow, ConsoleColor.Gray) { Title = title; }
public TuiConfirm(TuiWindow parentTuiWindow, String Message, String Title = "TuiConfirm") : base(Title, 6, (Console.WindowWidth / 2) - 25, 50, 5 + (int)Math.Ceiling(((Double)Message.Count() / textLength)), parentTuiWindow) { Create(Message, parentTuiWindow); }
public TuiCheckBox(int x, int y, String id, TuiWindow parentWindow) : base(x, y, 1, 3, parentWindow, id) { BackgroundColour = parentWindow.BackgroundColor; Selectable = true; }