觸發啟動區塊

  • 1173
  • 0
  • 2010-12-15

摘要:觸發啟動程式碼

 

觸發啟動程式碼


#region >>DTimer<<
        private System.Timers.Timer DTimer;

        private void initDTimer()
        {
            DTimer = new System.Timers.Timer(500);
            DTimer.Elapsed += new System.Timers.ElapsedEventHandler(DTimer_Elapsed);
        }

        private System.Threading.Thread RunThread;
        private volatile bool _isRun = false;
        private void DTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            #region DTimer_Elapsed
            if (_isRun) { return; } else { _isRun = true; }
            if (Data.Count > 0)
            {
                if (isMutiMode)
                {
                    try
                    {
                        if (RunThread != null && RunThread.IsAlive) { RunThread.Abort(); RunThread.Join(1000); }
                        RunThread = null;
                        RunThread = new Thread(new ThreadStart(SPRuner));
                        RunThread.Start();
                    }
                    catch (Exception ex)
                    {
                        ConsoleSay(_className, "DTimer_Elapsed", ex);
                        _isRun = false;
                    }
                }
                else
                    DTRunner();
            }
            else
                _isRun = false;

            #endregion
        }

        private void DTRunner()
        {
            #region >><<
            try
            {
            }
            catch (Exception ex) { ConsoleSay(_className, "DTRunner", ex); }
            #endregion
            _isRun = false;
        }
        #endregion

 


string _name;
string Name
{
    get{return _name;}
    set{_name = value;}
}


Name = "123";  =>會觸動 set
Name.ToString()    =>只會觸動 get

===================

搞了C#

現在來學學維修筆電