ClearInteractive() static private method

static private ClearInteractive ( ) : void
return void
コード例 #1
0
ファイル: Printer.cs プロジェクト: eatplayhate/versionr
 internal override void Start(string title)
 {
     Header = title + ": ";
     lock (Printer.SyncObject)
     {
         Printer.ClearInteractive();
         Printer.Write(MessageType.Interactive, Header);
         Printer.LastPrinter = this;
         ConsoleLeft         = System.Console.CursorLeft;
     }
     Last = string.Empty;
 }
コード例 #2
0
ファイル: Printer.cs プロジェクト: eatplayhate/versionr
 public override void End(object obj)
 {
     lock (Printer.SyncObject)
     {
         if (Printer.LastPrinter != this)
         {
             Printer.ClearInteractive();
             Printer.LastPrinter = this;
             ConsoleLeft         = 0;
         }
         string lastValue = Final == null ? string.Empty : Final;
         string bar       = new string(' ', lastValue.Length);
         System.Console.CursorLeft = 0;
         Printer.Write(MessageType.Interactive, bar);
         System.Console.CursorLeft = 0;
         Printer.LastPrinter       = null;
     }
 }
コード例 #3
0
ファイル: Printer.cs プロジェクト: eatplayhate/versionr
 public override void Update(object amount)
 {
     lock (Printer.SyncObject)
     {
         if (Printer.LastPrinter != this)
         {
             Printer.ClearInteractive();
             Printer.Write(MessageType.Interactive, Header);
             Printer.LastPrinter = this;
             ConsoleLeft         = System.Console.CursorLeft;
         }
         string last = Last;
         Last = Formatter(amount);
         System.Console.CursorLeft = ConsoleLeft;
         string output = Last;
         while (output.Length < last.Length)
         {
             output += ' ';
         }
         System.Console.CursorLeft = ConsoleLeft;
         Write(MessageType.Interactive, output);
     }
 }
コード例 #4
0
ファイル: Printer.cs プロジェクト: eatplayhate/versionr
            public override void Update(object amount)
            {
                string fmt = Formatter(amount);

                lock (Printer.SyncObject)
                {
                    if (Printer.LastPrinter != this)
                    {
                        Printer.ClearInteractive();
                        Printer.LastPrinter = this;
                        ConsoleLeft         = 0;
                    }
                    string bar;
                    int    extra = 0;
                    if (!string.IsNullOrEmpty(Before))
                    {
                        extra += Before.Length + 2;
                        bar    = Before + " [";
                    }
                    else
                    {
                        bar = "[";
                    }
                    StringBuilder sb = new StringBuilder();
                    int           x  = Index;
                    for (int i = 0; i < Width - 2; i++)
                    {
                        switch (x)
                        {
                        case 0:
                            sb.Append("#q#=");
                            break;

                        case 1:
                            sb.Append("##=");
                            break;

                        case 2:
                            sb.Append("#b#=");
                            break;

                        case 3:
                            sb.Append("##=");
                            break;
                        }
                        x++;
                        if (x == 4)
                        {
                            x = 0;
                        }
                    }
                    Index = (Index + 1) % 4;
                    System.Console.CursorLeft = 0;
                    bar += sb.ToString() + "##] " + fmt;
                    string lastValue = Final == null ? string.Empty : Final;
                    Final = bar;
                    while (lastValue.Length > bar.Length)
                    {
                        bar += " ";
                    }
                    Write(MessageType.Interactive, bar);
                }
            }