Exemple #1
0
        private void Submit()
        {
            if (string.IsNullOrWhiteSpace(from.Value) || !int.TryParse(from.Value, out var ifrom))
            {
                validationErrors.Text = "Need to fill in 'from'";
                return;
            }

            if (!legalInput.Contains(ifrom))
            {
                validationErrors.Text = $"No object with id '{ifrom}'";
                return;
            }

            if (string.IsNullOrWhiteSpace(to.Value) || !int.TryParse(to.Value, out var ito))
            {
                validationErrors.Text = "Need to fill in 'to'";
                return;
            }

            if (!legalInput.Contains(ito))
            {
                validationErrors.Text = $"No object with id '{ito}'";
                return;
            }

            titled.RemoveMeAndChildren();
            OnSubmit(ifrom, ito);
        }
Exemple #2
0
        public Popup(GuiComponent parent, string message)
        {
            var titled = new TitledWindow(parent, "About...")
            {
                BackGround = ConsoleColor.DarkBlue,
                Foreground = ConsoleColor.White
            };

            var label = new TextLabel(titled, message, new Coord(4, 1));

            titled.Dimensions = label.GetSize();
            titled.Dimensions.Height.Pixels += 5;
            titled.Dimensions.Width.Pixels  += 6;
            titled.Position = new Coord((State.MaxX - titled.Dimensions.Width.Pixels) / 2,
                                        ((State.MaxY - titled.Dimensions.Height.Pixels) / 2) - 1);

            label.AdjustWhenParentsReposition();

            var screenCenter = new Coord(titled.Dimensions.Width.Pixels / 2, label.Height + 2);
            var ok           = new Button(titled, "OK", () => { titled.RemoveMeAndChildren(); }, screenCenter)
            {
                BackGround = ConsoleColor.DarkGray,
                Foreground = ConsoleColor.Green
            };

            ok.Focus();
        }
Exemple #3
0
 void Submit()
 {
     if (string.IsNullOrWhiteSpace(selected.Value))
     {
         validationErrors.Text = errorMessage;
         return;
     }
     titled.RemoveMeAndChildren();
     OnSubmit(selected.Value);
 }
        private void Submit()
        {
            if (string.IsNullOrWhiteSpace(selected.Value) || !int.TryParse(selected.Value, out var ifrom))
            {
                validationErrors.Text = "Need to fill in a number";
                return;
            }
            if (!legalInput.Contains(ifrom))
            {
                validationErrors.Text = "No object with that ID";
                return;
            }

            titled.RemoveMeAndChildren();
            OnSubmit(ifrom);
        }
Exemple #5
0
 void Submit()
 {
     titled.RemoveMeAndChildren();
     OnSubmit(textArea.Value);
 }