Beispiel #1
0
 private static void Value_OnContentUpdated()
 {
     CanDraw      = false;
     _consoleSize = null;
     CanDraw      = true;
     Draw();
 }
Beispiel #2
0
 private static void Regions_RemoveEvent(RegionDictionary <string, ConsoleRegion> .RemoveEventArgs pRemoveEventArgs)
 {
     CanDraw      = false;
     _consoleSize = null;
     CanDraw      = true;
     Draw();
 }
 private static void Regions_AddEvent(RegionDictionary<string, ConsoleRegion>.AddEventArgs pAddEventArgs) {
   CanDraw = false;
   pAddEventArgs.Value.OnContentUpdated += Value_OnContentUpdated;
   _consoleSize = null;
   CanDraw = true;
   Draw();
 }
Beispiel #4
0
 private static void Regions_AddEvent(RegionDictionary <string, ConsoleRegion> .AddEventArgs pAddEventArgs)
 {
     CanDraw = false;
     pAddEventArgs.Value.OnContentUpdated += Value_OnContentUpdated;
     _consoleSize = null;
     CanDraw      = true;
     Draw();
 }
    public ConsoleRegion(ConsolePoint origin, int height, int width, string title, bool visible) {
      Content = new List<string>();

      Origin = origin;
      Height = height;
      Width = width;
      Title = title;
      Visible = visible;
    }
Beispiel #6
0
        public ConsoleRegion(ConsolePoint origin, int height, int width, string title, bool visible)
        {
            Content = new List <string>();

            Origin  = origin;
            Height  = height;
            Width   = width;
            Title   = title;
            Visible = visible;
        }
Beispiel #7
0
        public static void Draw(bool clear = false)
        {
            if (CanDraw)
            {
                CanDraw = false;
                if (Console.WindowHeight != consoleSize.Y || Console.WindowWidth != consoleSize.X)
                {
                    Console.SetWindowSize(consoleSize.X, consoleSize.Y);
                    Console.BufferHeight = consoleSize.Y;
                    Console.BufferWidth  = consoleSize.X;
                }

                var origpos = new ConsolePoint(Console.CursorLeft, Console.CursorTop);
                if (clear)
                {
                    Console.BackgroundColor = BackgroundColor;
                    Console.Clear();
                }

                foreach (var consoleRegion in Regions.Where(p => p.Value.Visible))
                {
                    drawRegionBorder(consoleRegion.Value);
                    Console.SetCursorPosition(consoleRegion.Value.Origin.X + 1, consoleRegion.Value.Origin.Y + 1);
                    int h = 1;
                    foreach (string line in consoleRegion.Value.Content)
                    {
                        string l = (line.Length > consoleRegion.Value.Width - 2
                          ? line.Substring(0, consoleRegion.Value.Width - 2)
                          : line);
                        Console.WriteLine(l);
                        Console.SetCursorPosition(consoleRegion.Value.Origin.X + 1, consoleRegion.Value.Origin.Y + h);
                        h++;
                        if (h >= consoleRegion.Value.Height - 2)
                        {
                            break;
                        }
                    }
                }

                //Console.SetCursorPosition(Console.WindowWidth - 1, Console.WindowHeight - 1);
                Console.SetCursorPosition(origpos.X, origpos.Y);
                CanDraw = true;
            }
        }
    public static void Draw(bool clear = false) {
      if (CanDraw) {
        CanDraw = false;
        if (Console.WindowHeight != consoleSize.Y || Console.WindowWidth != consoleSize.X) {
          Console.SetWindowSize(consoleSize.X, consoleSize.Y);
          Console.BufferHeight = consoleSize.Y;
          Console.BufferWidth = consoleSize.X;
        }

        var origpos = new ConsolePoint(Console.CursorLeft, Console.CursorTop);
        if (clear) {
          Console.BackgroundColor = BackgroundColor;
          Console.Clear();
        }

        foreach (var consoleRegion in Regions.Where(p => p.Value.Visible)) {
          drawRegionBorder(consoleRegion.Value);
          Console.SetCursorPosition(consoleRegion.Value.Origin.X + 1, consoleRegion.Value.Origin.Y + 1);
          int h = 1;
          foreach (string line in consoleRegion.Value.Content) {
            string l = (line.Length > consoleRegion.Value.Width - 2
                          ? line.Substring(0, consoleRegion.Value.Width - 2)
                          : line);
            Console.WriteLine(l);
            Console.SetCursorPosition(consoleRegion.Value.Origin.X + 1, consoleRegion.Value.Origin.Y + h);
            h++;
            if (h >= consoleRegion.Value.Height - 2)
              break;
          }
        }

        //Console.SetCursorPosition(Console.WindowWidth - 1, Console.WindowHeight - 1);
        Console.SetCursorPosition(origpos.X, origpos.Y);
        CanDraw = true;
      }
    }
 private static void Value_OnContentUpdated() {
   CanDraw = false;
   _consoleSize = null;
   CanDraw = true;
   Draw();
 }
 private static void Regions_RemoveEvent(RegionDictionary<string, ConsoleRegion>.RemoveEventArgs pRemoveEventArgs) {
   CanDraw = false;
   _consoleSize = null;
   CanDraw = true;
   Draw();
 }