zoukankan      html  css  js  c++  java
  • myTimer

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Runtime.Remoting.Messaging;
    using System.Timers;
    using Logger;
    
    namespace Untitly
    {
       public   class myTimer
        {
        
           public static  System.Timers.Timer timers;
           public   myTimer()
           {
               
           }
           public void time() {
               timers = new System.Timers.Timer(10000);
               timers.Elapsed += new ElapsedEventHandler(myTimer_Elapsed);
               timers.Enabled = true;
               timers.AutoReset = true;
           }
           public delegate string GetLogDelegate();
           private static string GetLogs()
           {
    
               return DateTime.Now.ToString();
           }
           private static  void LogTableCallBack(IAsyncResult tag)
           {
               AsyncResult result = (AsyncResult)tag;
               GetLogDelegate del = (GetLogDelegate)result.AsyncDelegate;
               Test.Write(del.EndInvoke(tag));
    
           }
    
          static  void myTimer_Elapsed(object source, ElapsedEventArgs e)
           {
               try
               {
                   GetLogDelegate getLogDel = new GetLogDelegate(GetLogs);
    
                   getLogDel.BeginInvoke(new AsyncCallback(LogTableCallBack), null);
               }
               catch (Exception ex)
               {
                   Log.WriteErrorLog(ex);
               }
           }
        }
    }
    

      

  • 相关阅读:
    Pull Request
    选择器
    常见HTTP状态码
    286. Walls and Gates
    200. Number of Islands
    1. Two Sum
    名片管理系统(python实现)
    k近邻算法(简单版)
    基数排序
    递归算法的调试
  • 原文地址:https://www.cnblogs.com/jiebian/p/2628133.html
Copyright © 2011-2022 走看看