Exemple #1
0
        private static void RunNonBasicInformationDisplay(string[,] textToDisplay, string[] columnNames, int[] columnStartLocation, int totalLength) //rename
        {
            byte maxLength = (byte)textToDisplay.GetLength(0);

            while (columnStartLocation[maxLength - 1] > OutPut.UIWidth())
            {
                maxLength--;
            }

            OutPut.FullScreenClear();
            string underscore = "|".PadRight(totalLength, '-');
            int    y          = 1;

            OutPut.DisplayColouredMessageAtLocation(underscore, 0, y, Colours.White);
            for (int n = 0; n < maxLength; n++) //displays all information in the 2D array textToDisplay
            {
                y = 0;
                OutPut.DisplayColouredMessageAtLocation("|" + columnNames[n], columnStartLocation[n], y, Colours.White);
                for (int m = 0; m < textToDisplay.GetLength(1); m++)
                {
                    OutPut.DisplayColouredMessageAtLocation("|" + textToDisplay[n, m], columnStartLocation[n], m + 2, Colours.White);
                }
            }

            Support.WaitOnKeyInput();
            Support.ActiveCursor();
        }
Exemple #2
0
        /// <summary>
        /// Displays the basic information listen in <paramref name="information"/>.
        /// </summary>
        /// <param name="information">Contains the information to display. Each string[] should be a seperate object</param>
        public static void WareDisplay(List <string[]> information)
        {
            OutPut.FullScreenClear();
            Support.DeactiveCursor();
            int y = 0;

            string[] titles       = new string[] { "Name", "ID", "Amount", "Type" };
            int[]    xLocation    = new int[titles.Length];
            byte     increasement = 20;

            for (int n = 1; n < xLocation.Length; n++) //calculates the start location of each column
            {
                xLocation[n] = increasement * n;
            }
            for (int n = 0; n < titles.Length; n++) //displays the titles and '|'
            {
                OutPut.DisplayColouredMessageAtLocation("| " + titles[n], xLocation[n], 0, Colours.White);
            }
            y += 2;
            string underline = "|";

            foreach (int xloc in xLocation) //calculates the line seperator
            {
                underline += Pad(increasement, '-', "|");
            }
            OutPut.DisplayMessage(Pad(increasement - titles[titles.Length - 1].Length - 2, ' ') + "|" + Environment.NewLine + underline, true); //Console.WriteLine(Pad(increasement - titles[titles.Length-1].Length-2,' ') + "|" + Environment.NewLine + underline);
            for (int n = 0; n < information.Count; n++)                                                                                         //writes out the information of each string array
            {
                string[] wareInfo = information[n];
                for (int m = 0; m < wareInfo.Length; m++)
                {
                    OutPut.DisplayColouredMessageAtLocation("| " + wareInfo[m], xLocation[m], y, Colours.White);
                }
                y++;
                OutPut.DisplayMessage(Pad(increasement - wareInfo[wareInfo.Length - 1].Length - 2) + "|");;
                OutPut.DisplayColouredMessageAtLocation(underline, 0, y++, Colours.White);
            }
            Support.ActiveCursor();

            string Pad(int value, char padding = ' ', string addToo = "")
            {
                value = value < 0 ? 0 : value;
                return(addToo.PadLeft(value, padding));
            }
        }
Exemple #3
0
        private static readonly int optionDisplayLowering = 1; //1 because of the possiblity of titles

        /// <summary>
        /// Runs the menu and retuns the selected entry point of <paramref name="options"/>.
        /// </summary>
        /// <param name="options">The options of the menu.</param>
        /// <param name="title">The title of the menu.</param>
        /// <returns>Returns the number of the selected index.</returns>
        /// <exception cref="NullReferenceException">Thrown when <paramref name="options"/> is null.</exception>
        public static byte MenuRun(string[] options, string title = null)
        {
            if (options == null)
            {
                throw new NullReferenceException();
            }
            byte hoveredOver    = 0;
            byte oldHoveredOver = 0;
            bool selected;

            Support.DeactiveCursor();
            MenuDisplay(options, hoveredOver, title);
            do
            {
                hoveredOver = MenuSelection(out selected, options.Length, hoveredOver);
                MenuDisplayUpdater(options, ref oldHoveredOver, hoveredOver);
            } while (!selected);
            Support.ActiveCursor();
            return(hoveredOver);
        }