Example #1
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();
        }
Example #2
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();
        }
Example #3
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();
        }
Example #4
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();
        }
        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();
        }
Example #6
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();
        }