Ejemplo n.º 1
0
        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();
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
 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;
 }
Ejemplo n.º 4
0
        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();
        }
Ejemplo n.º 5
0
        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();
        }
Ejemplo n.º 6
0
        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;
        }
Ejemplo n.º 7
0
        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);
        }
Ejemplo n.º 8
0
        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();
        }
Ejemplo n.º 9
0
        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();
        }
Ejemplo n.º 10
0
        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;
        }
Ejemplo n.º 11
0
        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;
        }
Ejemplo n.º 12
0
        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;
        }
Ejemplo n.º 13
0
        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();
        }
Ejemplo n.º 14
0
        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();
        }
Ejemplo n.º 15
0
        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();
        }
Ejemplo n.º 16
0
 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);
 }
Ejemplo n.º 17
0
 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);
 }
Ejemplo n.º 18
0
        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;
        }
Ejemplo n.º 19
0
        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;
        }
Ejemplo n.º 20
0
 public TuiPopupWindow(string title, int x, int y, int width, int height, TuiWindow parentTuiWindow)
     : base(x, y, width, height, parentTuiWindow, ConsoleColor.Gray)
 {
     Title = title;
 }
Ejemplo n.º 21
0
 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;
 }
Ejemplo n.º 22
0
 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);
 }
Ejemplo n.º 23
0
 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);
 }
Ejemplo n.º 24
0
 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);
 }
Ejemplo n.º 25
0
 public TuiCheckBox(int x, int y, String id, TuiWindow parentWindow)
     : base(x, y, 1, 3, parentWindow, id)
 {
     BackgroundColour = parentWindow.BackgroundColor;
     Selectable = true;
 }
Ejemplo n.º 26
0
 public TuiCheckBox(int x, int y, String id, TuiWindow parentWindow) : base(x, y, 1, 3, parentWindow, id)
 {
     BackgroundColour = parentWindow.BackgroundColor;
     Selectable       = true;
 }