コード例 #1
0
        public static async Task MonitorStatus(RompExecutionEnvironment executer, CancellationToken cancel)
        {
            Console.CursorVisible = false;
            try
            {
                while (true)
                {
                    cancel.ThrowIfCancellationRequested();
                    var status = executer.GetStatus();
                    if (status != null)
                    {
                        WriteCurrentStatus(OperationStatus.GetOperationStatusText(status));
                    }

                    await Task.Delay(500, cancel).ConfigureAwait(false);
                }
            }
            finally
            {
                Console.WriteLine(new string(' ', Console.BufferWidth - 1));
                Console.Write(new string(' ', Console.BufferWidth - 1));
                Console.CursorLeft = 0;
                Console.CursorTop--;
                Console.CursorVisible = true;
            }
        }