private DispatcherTimer _timer;

private void SetTimeElaspInStatusBar()

{

try

{

_timer = new DispatcherTimer();

_timer.Tick += (sender, e) =>

{

DateTime dtNow = DateTime.Now;

TimeSpan interval = dtNow - _enterSystemTime;

this.barElapsedTime.Content = null;

#region

TimeZoneInfo currentTimeZone = TimeZoneUtil.GetLocalTimeZone();

if (currentTimeZone != null)

{

string str = currentTimeZone.Id;

this.barElapsedTime.Content += "     Local Time(" + str + " )"

+ ": "

+ dtNow.ToString("MM/dd/yyyy HH:mm:ss");

//DateTimeUtil.ConvertToUniversalTimeString(this._enterSystemTime, "MM/dd/yyyy HH:mm:ss");

}

//this.barElapsedTime.Content += "     UTC Time : "

//    + DateTimeUtil.ConvertToUniversalTimeString(dtNow, "MM/dd/yyyy HH:mm:ss");

DateTime? dtUTC =TimeZoneUtil.ConvertTimeToUTC(dtNow);

if (dtUTC != null)

{

this.barElapsedTime.Content += "     UTC Time : "

+((DateTime)dtUTC).ToString("MM/dd/yyyy HH:mm:ss");

}

////Convert To "Central America Standard Time"

//DateTime? dtUSCenter = TimeZoneUtil.ConvertFromUTC((DateTime)dtUTC, "Central America Standard Time");

//if (dtUSCenter != null)

//{

//    this.barElapsedTime.Content += "     UTC Time to  Central America Standard Time: "

//                               + ((DateTime)dtUSCenter).ToString("MM/dd/yyyy HH:mm:ss");

//}

#endregion

this.barElapsedTime.Content += "        Elapsed Time: " + (interval.Days > 0 ? interval.Days + " day(s) " : "") +

new DateTime(1900, 1, 1, interval.Hours, interval.Minutes, interval.Seconds).ToString("HH:mm:ss");

//

if (EventBinder.SystemTimeOutCheck.IsCheckTimeOut)

{

EventBinder.SystemTimeOutCheck.Check();

}

// SystemThreadStarter.StartGetUrlThread();

};

_timer.Interval = TimeSpan.FromSeconds(1);

_timer.Start();

}

catch (Exception ex)

{

MessageBox.Show(ex.Message);

}

}

应用程序在状态栏展示时间(C#)的更多相关文章

  1. 在MFC[转载]在MFC状态栏显示时间 状态栏显示时间

    原文:在MFC状态栏显示时间,谢小哈皮儿 c/c++ vc 在mfc状态栏显示时间,在VC的控件中有个Status bar可以在窗体状态栏中添加日期和时间.其实通过简单的代码,你就能创建一个有时钟显示 ...

  2. 你的程序支持复杂的时间调度嘛?如约而来的 java 版本

    你的程序支持复杂的时间调度嘛? 这篇文章介绍了时间适配器的c#版本,是给客户端用的,服务器自然也要有一套对应的做法,java版本的 [年][月][日][星期][时间] [*][*][*][*][*] ...

  3. iOS开发:保持程序在后台长时间运行

    iOS开发:保持程序在后台长时间运行 2014 年 5 月 26 日 / NIVALXER / 0 COMMENTS iOS为了让设备尽量省电,减少不必要的开销,保持系统流畅,因而对后台机制采用墓碑式 ...

  4. 保持程序在后台长时间运行-b

    iOS为了让设备尽量省电,减少不必要的开销,保持系统流畅,因而对后台机制采用墓碑式的“假后台”.除了系统官方极少数程序可以真后台,一般开发者开发出来的应用程序后台受到以下限制:1.用户按Home之后, ...

  5. vs调试windows mobile程序时布署时间太长的解决办法

    vs调试windows mobile程序时布署时间太长的解决办法 1.VS平台上,选工具-选项-项目和解决方案-MS BUILD项目生成输出详细信息中选择“诊断”,目的是在调试窗口中看出哪个过程编译的 ...

  6. iOS开发:后台运行以及保持程序在后台长时间运行

    第一部分 1.先说说iOS 应用程序5个状态: 停止运行-应用程序已经终止,或者还未启动. 不活动-应用程序处于前台但不再接收事件(例如,用户在app处于活动时锁住了设备). 活动-app处于“使用中 ...

  7. 程序员的一生时间90%是用在编程上,而剩余的10%是活在世界上。刚进CSDN的博客看到这么句话

    程序员的一生时间90%是用在编程上,而剩余的10%是活在世界上. 而自己呢?是个程序员呢还是个业余玩家!

  8. 程序运行的cpu时间

    time.clock() 测量CPU时间,比较精准,通过比较程序运行前后的CPU时间差,得出程序运行的CPU时间.

  9. 关于在Qt里让程序休眠一段时间的方法总结

    出处:http://hanzhaoxin.cnblogs.com/ Qt 为何没有提供 Sleep 论坛上不时见到有人问: Qt 为什么没有提供跨平台的 sleep 函数? 使用平台相关的 Sleep ...

随机推荐

  1. leetcode 相交链表 python实现

    这道题 要想解决其实不难, 开两层循环进行遍历就能实现,但是会超时 如果想要O(n) 的时间复杂度, 我考虑用哈希表来存储遍历过的元素,如果发现当前遍历的元素在哈希表里,那说明交叉点就在这 这里利用了 ...

  2. 【平面图最小割】BZOJ1001- [BeiJing2006]狼抓兔子

    [题目大意]左上角点为(1,1),右下角点为(N,M)(上图中N=4,M=5).有以下三种类型的道路 1:(x,y)<==>(x+1,y) 2:(x,y)<==>(x,y+1) ...

  3. java集合之一(框架介绍)

    本文转载自:http://www.cnblogs.com/skywang12345/p/3308498.html Java集合主要可以划分为4个部分:List列表.Set集合.Map映射.工具类(It ...

  4. Vue-router浅识

    一.router-link及router-view :用来做导航,通过传入to属性来指定链接 :用来做路由出口,路由匹配到的组件都会渲染在这里 const router = new VueRouter ...

  5. Codeforces Round #288 (Div. 2) E. Arthur and Brackets 贪心

    E. Arthur and Brackets time limit per test 2 seconds memory limit per test 128 megabytes input stand ...

  6. js取float型小数点后x位数的方法

    js中取小数点后两位方法最常用的就是四舍五入函数了,前面我介绍过js中四舍五入一此常用函数,这里正好用上,下面我们一起来看取float型小数点后两位一些方法总结 以下我们将为大家介绍 JavaScri ...

  7. .NET面试宝典-基础

    经典.net面试题目 建议使用朗读女软件下载,边读边记. 1. 简述 private. protected. public. internal 修饰符的访问权限. 答 . private :   私有 ...

  8. SQL2008″Unable to read the list of previously registered servers on this system”

    打开SQL2008,弹出”Unable to read the list of previously registered servers on this system”错误, 微软官方的解决方法:h ...

  9. Accessing an element's parent with ElementTree(转)

    Today I ran across a situation where I needed to programmatically remove specific elements from a KM ...

  10. 【机器学习算法-python实现】决策树-Decision tree(2) 决策树的实现

    (转载请注明出处:http://blog.csdn.net/buptgshengod) 1.背景      接着上一节说,没看到请先看一下上一节关于数据集的划分数据集划分.如今我们得到了每一个特征值得 ...