mod_timestatus.cs

来自「一个农村管理系统的程序 数据库那部分可能不全 大家可以」· CS 代码 · 共 37 行

CS
37
字号
using System;
using System.Collections.Generic;
using System.Text;
using System.Timers;

namespace MsgSystem
{

    //this class is used to refresh the status of the time status of the main window,
    //it uses a easy timer, refresh the time every one second

    static class Mod_TimeStatus
    {
        static Timer timeRefresher = null;
        static DateTime timer;
        static string timeString = "";

        public static void ticker(object src, ElapsedEventArgs evt)
        {
            timer = DateTime.Now;
            timeString = timer.Year + " - " + timer.Month + " - " + timer.Day + "      " + timer.Hour + ":" + timer.Minute + ":" + timer.Second;
            Program.main_wnd.setTimeStatus(timeString);

        }

        public static void init()
        {
            timeRefresher = new Timer(100);
            ElapsedEventHandler eeh = new ElapsedEventHandler(ticker);
            timeRefresher.Elapsed += eeh;
            timeRefresher.Start();
        }


    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?