public static void Alert(string alertMessage, int ms = 1000)
        {
            // Get position of the cursor before and after the alert.
            Int2 cursorPosition = Int2Utils.GetConsoleCursor();

            Console.WriteLine();
            Int2 newLinePosition = Int2Utils.GetConsoleCursor();

            // Get the actual color of the console and switch with the red color.
            ConsoleColor actualColor = Console.ForegroundColor;

            Console.ForegroundColor = ConsoleColor.Red;

            // Write the alert message and reset the color.
            Console.Write(alertMessage);
            Console.ForegroundColor = actualColor;

            // Show the alert during a certain amount of time.
            Thread.Sleep(ms);

            // Remove the text alert.
            newLinePosition.SetConsoleCursor();
            for (int i = 0; i < alertMessage.Length; ++i)
            {
                Console.Write(" ");
            }
            cursorPosition.SetConsoleCursor();
        }
        public Int2 WriteLineAndResetColor(IGenericPair <int, int> position)
        {
            ConsoleColor currentColor = System.Console.ForegroundColor;

            WriteLine(position);
            System.Console.ForegroundColor = currentColor;
            return(Int2Utils.GetConsoleCursor());
        }
Esempio n. 3
0
        public Int2 WriteLineAndResetColor()
        {
            ConsoleColor currentColor = Console.ForegroundColor;

            Console.ForegroundColor = Color;
            Console.WriteLine(Char);
            Console.ForegroundColor = currentColor;
            return(Int2Utils.GetConsoleCursor());
        }
 public Int2 Write(IGenericPair <int, int> position)
 {
     System.Console.ForegroundColor = _Color;
     Clear();
     _Position = ((Int2)position).Max(0);
     _Position.SetConsoleCursor();
     System.Console.Write(Char);
     Writed = true;
     return(Int2Utils.GetConsoleCursor());
 }
 private Int2 WriteMethod(IGenericPair <int, int> position, Action <string> value)
 {
     System.Console.ForegroundColor = _Color;
     Clear();
     _Position = ((Int2)position).Max(0);
     _Position.SetConsoleCursor();
     value(Text);
     Writed = true;
     return(Int2Utils.GetConsoleCursor());
 }
        public static string ReadCancel()
        {
            Int2   cursorPosition = Int2Utils.GetConsoleCursor();
            string input          = Console.ReadLine();

            cursorPosition.SetConsoleCursor();
            if (input != null)
            {
                for (int i = 0; i < input.Length; ++i)
                {
                    Console.Write(" ");
                }
            }
            cursorPosition.SetConsoleCursor();
            return(input);
        }
 public virtual Int2 Write(IGenericPair <int, int> position)
 {
     Clear();
     _Position = ((Int2)position).Max(0);
     _Position.SetConsoleCursor();
     SetColor();
     for (int i = 0; i < Text.Count; ++i)
     {
         Int2 lastPosition = Text[i].ConsoleObjectGroup[0].Write();
         for (int j = 1; j < Text[i].ConsoleObjectGroup.Count; ++j)
         {
             lastPosition = Text[i].ConsoleObjectGroup[j].Write(lastPosition);
         }
         if (i < Text.Count - 1)
         {
             ConsoleUtils.SetCursorPosition(position.x, System.Console.CursorTop + 1);
         }
     }
     Writed = true;
     return(Int2Utils.GetConsoleCursor());
 }
        public static void Alert(ColoredText alertMessage, int ms = 1000)
        {
            // Get position of the cursor before and after the alert.
            Int2 cursorPosition = Int2Utils.GetConsoleCursor();

            Console.WriteLine();
            Int2 newLinePosition = Int2Utils.GetConsoleCursor();

            // Write the alert message.
            alertMessage.WriteAndResetColor();

            // Show the alert during a certain amount of time.
            Thread.Sleep(ms);

            // Remove the text alert.
            newLinePosition.SetConsoleCursor();
            for (int i = 0; i < alertMessage.Text.Length; ++i)
            {
                Console.Write(" ");
            }
            cursorPosition.SetConsoleCursor();
        }
Esempio n. 9
0
        public override void InsertValue(int x, int y, T value)
        {
            Container[x, y] = value;
            int size = LargerSizeInColumn(x);

            if (size > _ColumnSize[x])
            {
                _ColumnSize[x] = size;
                if (Writed)
                {
                    Write(Position);
                }
            }
            else
            {
                if (Writed)
                {
                    Int2 position = Int2Utils.GetConsoleCursor();
                    WriteContent(x, y);
                    position.SetConsoleCursor();
                }
            }
        }
Esempio n. 10
0
 public Int2 WriteLine()
 {
     Console.ForegroundColor = Color;
     Console.WriteLine(Char);
     return(Int2Utils.GetConsoleCursor());
 }
 public Int2 WriteLineAndResetColor()
 {
     return(WriteLineAndResetColor(Int2Utils.GetConsoleCursor()));
 }
 public Int2 WriteLine(IGenericPair <int, int> position)
 {
     Write(position);
     ConsoleUtils.SetCursorPosition(position.x, System.Console.CursorTop + 1);
     return(Int2Utils.GetConsoleCursor());
 }
 public Int2 WriteLine()
 {
     return(WriteLine(Int2Utils.GetConsoleCursor()));
 }