Exemple #1
0
        => WindowRectangle = GetConsoleRect();     // fill the entire console with the root "desktop"

        public override void Draw(IScreenBuffer screenBuffer)
        {
            base.Draw(screenBuffer);

            var clientRect = ClientRectangle;
            var y          = 0;

            screenBuffer.Draw(clientRect.X, clientRect.Y + y++, "F1 - List animals");
            screenBuffer.Draw(clientRect.X, clientRect.Y + y++, "F2 - Advance week");
            screenBuffer.Draw(clientRect.X, clientRect.Y + y++, "F3 - Show this weeks food requirement");
            screenBuffer.Draw(clientRect.X, clientRect.Y + y++, "F4 - Wipe and restart database");
        }
Exemple #2
0
        public override void Draw(IScreenBuffer screenBuffer)
        {
            base.Draw(screenBuffer);

            var rc = ClientRectangle;

            var text1 = "Do you want to reset database?";
            var text2 = "Press Y for yes or Escape to cancel.";

            screenBuffer.Draw(rc.X + rc.Width / 2 - text1.Length / 2, rc.Y, text1);
            screenBuffer.Draw(rc.X + rc.Width / 2 - text2.Length / 2, rc.Y + 1, text2);
        }
Exemple #3
0
            public void Draw(IScreenBuffer screenBuffer, Point location)
            {
                screenBuffer.Draw(location.X, location.Y, Title, ConsoleColor.Magenta);

                screenBuffer.EnableUnderline = true;

                screenBuffer.Draw(
                    location.X,
                    location.Y + 1,
                    Value.ToString().PadRight(MaxLength, ' '),
                    ConsoleColor.Gray);

                screenBuffer.EnableUnderline = false;
            }
Exemple #4
0
        public override void Draw(IScreenBuffer screenBuffer)
        {
            base.Draw(screenBuffer);

            if (_database == null)
            {
                return;
            }

            screenBuffer.Draw(ClientRectangle.X, ClientRectangle.Y, "Species");
            screenBuffer.Draw(ClientRectangle.X + 10, ClientRectangle.Y, "Name");
            screenBuffer.Draw(ClientRectangle.X + 30, ClientRectangle.Y, "Age");

            int index = 0;

            int y = ClientRectangle.Y + 2;

            foreach (var animal in _database.Animals)
            {
                var line = $"{animal.Species.PadRight(10)}{animal.Name.Clip(19).PadRight(20)}{animal.Age.ToBirthdayFormat()}";

                var foreground = ConsoleColor.Gray;
                var background = ConsoleColor.Black;

                if (index == _selectedIndex)
                {
                    background = ConsoleColor.Blue;
                }

                screenBuffer.Draw(ClientRectangle.X, y, line, foreground, background);

                if (++y >= ClientRectangle.Bottom)
                {
                    break;
                }

                ++index;
            }
        }
Exemple #5
0
        public override void Draw(IScreenBuffer screenBuffer)
        {
            base.Draw(screenBuffer);

            var totalFoodRequirement = _zooManager.CalculateWeekTotalFoodRequirement();

            var rc = ClientRectangle;
            int y  = 0;

            screenBuffer.Draw(rc.X, rc.Y + y, "Animal food requirements this week");
            y += 2;

            // print out each individual species and their food requirement
            foreach (var kv in _zooManager.CalculateIndividualSpeciesFoodRequirement().OrderBy(a => a.Key))
            {
                var species     = kv.Key;
                var requirement = kv.Value;
                screenBuffer.Draw(rc.X, rc.Y + y++, $"[{species}] {requirement:0.00} kg");
            }

            ++y;
            screenBuffer.Draw(rc.X, rc.Y + y++, $"Total required food: {totalFoodRequirement:0.00} kg");
        }
Exemple #6
0
        public override void Draw(IScreenBuffer screenBuffer)
        {
            base.Draw(screenBuffer);

            var y = ClientRectangle.Y;

            foreach (var component in _components)
            {
                component.Draw(screenBuffer, new Point(ClientRectangle.X, y));

                if (component == _components[_focusedComponentIndex])
                {
                    screenBuffer.Draw(ClientRectangle.X + component.Value.Length, y + 1, ' ', ConsoleColor.Gray, ConsoleColor.Gray);
                }

                y += 3;
            }
        }
Exemple #7
0
 public override void Draw(IScreenBuffer screenBuffer)
 {
     base.Draw(screenBuffer);
     screenBuffer.Draw(ClientRectangle.X, ClientRectangle.Y, _message);
 }