下面是如何最大化console和改变其显示的字体颜色的代码,顺便包含了计时代码(帮助做性能分析):

    class Program
{
[DllImport("kernel32.dll", ExactSpelling = true)]
private static extern IntPtr GetConsoleWindow();
private static IntPtr ThisConsole = GetConsoleWindow(); [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
private static extern bool ShowWindow(IntPtr hWnd, int nCmdShow); private const int HIDE = ;
private const int MAXIMIZE = ;
private const int MINIMIZE = ;
private const int RESTORE = ; private const int OldestPhaseNo = ; static void Main(string[] args)
{
// Set maximum console windows size
Console.SetWindowSize(Console.LargestWindowWidth, Console.LargestWindowHeight);
ShowWindow(ThisConsole, MAXIMIZE); // Start the time watch
Stopwatch watch = new Stopwatch();
watch.Start(); // Stop the time wattch
Dictionary<string, string> ssqRecords = GetSsQiuRecords().Result;
watch.Stop(); // Change/Set the console's foregound clodr as green
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine(watch.Elapsed.TotalSeconds); // Restart the time calculation to 0
watch.Restart();
SaveLotteryDataToLocalConfig(ssqRecords);
watch.Stop(); Console.WriteLine(watch.Elapsed.TotalSeconds);
// Revert back to the default color
Console.ForegroundColor = ConsoleColor.Gray; // Set the display buffer for console window
Console.SetBufferSize(, );
}
}

How to customize the console applicaton的更多相关文章

  1. Spring Boot ConfigurationProperties validate

    使用@Query可以在自定义的查询方法上使用@Query来指定该方法要执行的查询语句,比如:@Query("select o from UserModel o where o.uuid=?1 ...

  2. Spring Boot Reference Guide

    Spring Boot Reference Guide Authors Phillip Webb, Dave Syer, Josh Long, Stéphane Nicoll, Rob Winch,  ...

  3. bin&sbin 命令作用

    最近需要了解sbin与bin的功能,需要整理一下.一下全部为Ubuntu14里面默认安装的.在这里收集一下,转载请注明出处! bin bash shell bunzip2 .bz2文件的解压缩程序. ...

  4. groovyConsole — the Groovy Swing console

    1. Groovy : Groovy Console The Groovy Swing Console allows a user to enter and run Groovy scripts. T ...

  5. JBPM WEB CONSOLE安装实录

    http://www.blogjava.net/paulwong/archive/2009/03/13/259551.html JBPM WEB CONSOLE是一个B/S端的,能管理JBPM的流程和 ...

  6. C# 控制台程序(Console Application )启动后隐藏

    背景 前段时间给项目编写了数据适配器,读取其他系统的数据后推送到MQ上,我们的系统通过订阅MQ的方式来获取.由于其他系统支持C#编程,且为了一时方便,选择了C#的控制台程序. 最近用户在使用中,总是不 ...

  7. Configuring Your EMS Server or EMS Console Server on Windows/Linux

    EMS Configuration Files RAD Studio provides the scripts to render the web-browser console, the EMS s ...

  8. console.log & front-end jobs

    console.log & front-end jobs bind & function let log = console.log; let obj = {}; log(obj); ...

  9. console的高级使用

    1.console.table()用来表格化展示数据. var people = { zqz: { name: 'zhaoqize', age: 'guess?' }, wdx: { name: 'w ...

随机推荐

  1. 使用Web页面配置ESP8266的参数

    前言 使用Web页面配置ESP8266的参数相对于使用串口AT指令配置更加直观和简单.与配置路由器方式类似. 基本思路 基本思路是ESP8266工作AP模式下,作为TCP Server监听TCP Cl ...

  2. 关于非阻塞connnect的看法

    关于非阻塞connnect的总结 在面试题中,看到有关于阻塞connect和非阻塞connect的区别: 显然,我们可以从阻塞和非阻塞的意思来回答,既然是阻塞,那么执行connect的操作会一直阻塞到 ...

  3. Unreal Engine 4 Radiant UI 插件入门(三)——从蓝图中调用JS

    不知道大家有没有混淆.这篇教程说的是从蓝图中调用JS的功能(以改变H5内的内容). 在安装了UE4和RadiantUI的前提下学习这篇教程.本篇教程接着上一篇教程,建议请先看上一篇. 第一步:在网页中 ...

  4. SQL Server Alwayson配置两个节点加共享文件夹仲裁见证

    标签:MSSQL/节点和共享文件夹多数 概述 之前讲过多数节点的仲裁配置,多数节点一般3个节点以上的奇数个节点:常见的是使用3个节点节点多了也是浪费因为Alwayson的只读路由只能利用到一个只读副本 ...

  5. PHP实现跨域解决方法

    如果要实现跨域通过设置Access-Control-Allow-Origin来实现跨域. 例如:客户端的域名是client.runoob.com,而请求的域名是server.runoob.com. 如 ...

  6. [NOIP2013/Codevs3287]货车运输-最小[大]生成树-树上倍增

    Problem 树上倍增 题目大意 给出一个图,给出若干个点对u,v,求u,v的一条路径,该路径上最小的边权值最大. Solution 看到这个题第一反应是图论.. 然而,任意路径最小的边权值最大,如 ...

  7. 次小生成树学习+例题 poj 1679 The Unique MST

    次小生成树学习: 顾名思义,次小生成树,就是将图的所有生成树排序后,权值第二小的生成树. 次小生成树的朴素求法是很好想的,即首先求出最小生成树,之后枚举最小生成树中的所有边,将当前枚举的边" ...

  8. android6.0动态权限处理<一>

    android 6.0以上为了保护用户的隐私,和以往被人诟病的权限机制,确立了新的权限机制.从 Android 6.0(API 级别 23)开始,用户开始在应用运行时向其授予权限,而不是在应用安装时授 ...

  9. 前端框架之bootstrap

    一.bootstrap按钮 1.按钮 <button class="btn btn-default">按钮</button><button class ...

  10. selenium3.x 踏坑记

    Selenium 3.x 出来也有段时间了,有哪些坑呢? 有好长一段时间没有用selenium了.最近想用来做个web自动化的小工具.根据以往经验,firefox是不需要下载driver的.启动fir ...