當前位置: 首頁>>代碼示例>>C#>>正文


C# Timers.ElapsedEventArgs類代碼示例

本文整理匯總了C#中System.Timers.ElapsedEventArgs的典型用法代碼示例。如果您正苦於以下問題:C# ElapsedEventArgs類的具體用法?C# ElapsedEventArgs怎麽用?C# ElapsedEventArgs使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ElapsedEventArgs類屬於System.Timers命名空間,在下文中一共展示了ElapsedEventArgs類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: TimeElapsed

        void TimeElapsed(object sender, ElapsedEventArgs args)
        {
            //string exePath = "%SystemRoot%\\system32\\notepad.exe " + schedule.ScheduleID.ToString();
            //string exePath = "D:\\Projects\\GAG\\WMS_30\\wms30\\RunConsole\\bin\\Debug\\RunConsole.exe ";

            try
            {
                string exePath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "SchedulerConsole.exe"); 
                //Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)
                //Environment.CurrentDirectory

                if (!File.Exists(exePath))
                {
                    WriteEventLog("File " + exePath  + " not found.");
                    return;
                }

                AppLauncher launcher = new AppLauncher(exePath);

                //Manda a Ejecutar el Schedule
                new Thread(new ThreadStart(launcher.RunApp)).Start();
            }

            catch (Exception ex) {
                WriteEventLog(GetTechMessage(ex));
            }

        }
開發者ID:erwin-hamid,項目名稱:LogPro,代碼行數:28,代碼來源:WMScheduleService.cs

示例2: oneTimeTimerElapsed

        private void oneTimeTimerElapsed(object sender, ElapsedEventArgs e)
        {
            Action timerAction = null;
            try
            {
                var timer = (CallbackTimer)sender;
                timerAction = timer.TimerAction;
                timer.Enabled = false;
                timer.Elapsed -= oneTimeTimerElapsed;
                timer.Close();
                timer.Dispose();
            }
            catch { }

            try
            {
                if (null != timerAction)
                {
                    timerAction();
                }
            }
            catch (Exception ex)
            {
                log.Error(ex, Resources.ActionTimer_UnhandledException_Message);
            }
        }
開發者ID:kirannadell,項目名稱:ironfoundry,代碼行數:26,代碼來源:ActionTimer.cs

示例3: OnElapsedTime

 public static void OnElapsedTime(object source, ElapsedEventArgs e)
 {
     try
     {
         TraceService("Another entry at " + DateTime.Now);
         bool brasterStatus = false;
         var prc = System.Diagnostics.Process.GetProcesses();
         foreach (var item in prc)
         {
             if (item.ProcessName.Contains("SocioBoardScheduler") && !item.ProcessName.Contains(".vshost"))
             {
                 TraceService("SocioBoardScheduler has run mode Time : " + DateTime.Now);
                 brasterStatus = true;
                 break;
             }
         }
         if (!brasterStatus)
         {
             System.Diagnostics.Process.Start(@"C:\Program Files (x86)\Default Company Name\moopleSchedulerSetup\SocioBoardScheduler.exe").StartInfo.CreateNoWindow = false;
             try
             {
                 TraceService("SocioBoardScheduler has stop mode Time : " + DateTime.Now);
             }
             catch (Exception ex)
             {
                 TraceService(ex.Message + DateTime.Now);
             }
         }
     }
     catch (Exception ex)
     {
         TraceService("Error : " + ex.Message);
     }
 }
開發者ID:utkarshx,項目名稱:socioboard,代碼行數:34,代碼來源:SocioBoardWindowsService.cs

示例4: Run

        private void Run(object sender, ElapsedEventArgs e)
        {
            IDbConnection[] conns;
              lock (connections) {
            conns = (from c in connections.Values
                 let conn = c.Target as IDbConnection
                 where conn != null
                 select conn).ToArray();
              }
              if (conns.Length == 0) {
            return;
              }

              Task.Factory.StartNew(() =>
              {
            foreach (var conn in conns) {
              try {
            Vacuum(conn);
              }
              catch (Exception ex) {
            Error("Failed to vacuum a store", ex);
              }
            }
              }, TaskCreationOptions.LongRunning | TaskCreationOptions.AttachedToParent);

              Schedule();
        }
開發者ID:nmaier,項目名稱:simpleDLNA,代碼行數:27,代碼來源:FileStoreVacuumer.cs

示例5: _timer_Elapsed

 public void _timer_Elapsed(object sender, ElapsedEventArgs e)
 {
     Classes.CustomSnapshotRoot root = null;
     Classes.KeeperAPI keeper = new Classes.KeeperAPI();
     Action workAction = delegate
     {
         BackgroundWorker worker = new BackgroundWorker();
         worker.DoWork += delegate
         {
             root = keeper.getKeeperInfo(guid);
         };
         worker.RunWorkerCompleted += delegate
         {
             try {
                 //image.Source = null;
                 Classes.ScoreboardRenderer render = new Classes.ScoreboardRenderer(this, root.snapshot.mapId, root);
             }catch(Exception ex)
             {
                 Classes.Logger.addLog(ex.ToString(), 1);
             }
             //Update code in here
         };
         worker.RunWorkerAsync();
     };
     Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Background, workAction);
 }
開發者ID:xHeinrich,項目名稱:keeperScoreboard,代碼行數:26,代碼來源:Scoreboard.xaml.cs

示例6: HandleTimerEvent

        private void HandleTimerEvent(object source, ElapsedEventArgs e)
        {
            // Connect to WebServer, gets balloons
            Dictionary<int, ServerBalloon> fromFeed = GetFeed();

            // Gets news balloons to be displayed
            Dictionary<int, ServerBalloon> fromServer = m_server.Balloons();

            foreach(KeyValuePair<int, ServerBalloon> i in fromServer)
            {
                ServerBalloon b = i.Value;
                // Check if the bubble need to be keept, or deleted
                if(!fromFeed.ContainsKey(b.ID)) {
                    // Pop the balloon in the server not present in the feed
                    m_server.EnqueueMessage(new PopBalloonMessage(b.ID), this);
                }
            }

            foreach(KeyValuePair<int, ServerBalloon> i in fromFeed)
            {
                ServerBalloon b = i.Value;
                if(!fromServer.ContainsKey(b.ID)) {
                    // Add the new balloon to the server
                    m_server.EnqueueMessage(new NewBalloonMessage(b.ID, Direction.Any, 0.2f, ServerBalloon.VelocityLeft), this);
                }
            }
        }
開發者ID:PyrO70,項目名稱:hwkinect,代碼行數:27,代碼來源:FeedReader.cs

示例7: AlertTimer_Elapsed

        static void AlertTimer_Elapsed(object sender, ElapsedEventArgs e)
        {
            if (Globals.AlertStart == null)
                return;

            var resp = PingHelper.PingHosts(Constants.PingHosts.Split(',').ToList());
            if (resp.HasValue) //back on the domain
            {
                Globals.AlertTimer.Stop();
                Utils.HideAlert();
                Globals.AlertStart = null;
                return;
            }

            var isOnline = WebHelper.HasWebTraffic();
            if (isOnline || (DateTime.Now - Globals.AlertStart.Value).TotalMinutes >= Constants.TimeOut)
            {
                Globals.AlertTimer.Stop();
                Utils.HideAlert();
                Globals.AlertStart = null;
            }

            else
                Utils.ShowAlert(false);
        }
開發者ID:joevoisin,項目名稱:hips-tool,代碼行數:25,代碼來源:Controller.cs

示例8: timer_Elapsed

 void timer_Elapsed(object sender, ElapsedEventArgs e)
 {
     this.Dispatcher.Invoke(new Action(() =>
     {
         this.mw.CloseGame();
     }), null);
 }
開發者ID:guozanhua,項目名稱:KinectMiniGames,代碼行數:7,代碼來源:GameOverPopup.xaml.cs

示例9: timer_Elapsed

		private void timer_Elapsed(object sender, ElapsedEventArgs e)
		{
			foreach (var provider in instrumentationProviders)
			{
				provider.Instrument();
			}
		}
開發者ID:glennslaven,項目名稱:NserviceBus.Instrumentation,代碼行數:7,代碼來源:AgentService.cs

示例10: InitAsync

    private void InitAsync(object sender, ElapsedEventArgs args)
    {
      ISQLDatabase database;
      lock (_timer)
      {
        database = ServiceRegistration.Get<ISQLDatabase>(false);
        if (database == null)
          return;
        _timer.Close();
        _timer.Dispose();
      }

      using (var transaction = database.BeginTransaction())
      {
        // Prepare TV database if required.
        PrepareTvDatabase(transaction);

        PrepareConnection(transaction);
      }

      // Initialize integration into host system (MP2-Server)
      PrepareIntegrationProvider();

      // Needs to be done after the IntegrationProvider is registered, so the TVCORE folder is defined.
      PrepareProgramData();

      // Register required filters
      PrepareFilterRegistrations();

      // Run the actual TV core thread(s)
      InitTvCore();

      // Prepare the MP2 integration
      PrepareMediaSources();
    }
開發者ID:davinx,項目名稱:MediaPortal-2,代碼行數:35,代碼來源:AbstractSlimTvService.cs

示例11: Timer_Elapsed

        static void Timer_Elapsed(object sender, ElapsedEventArgs e)
        {
            var passive = 0;
            var active = 0;

            foreach(var k in KinectSensor.KinectSensors)
            {
                using(var frame = k.SkeletonStream.OpenNextFrame(50))
                {
                    if(frame != null)
                    {
                        var s = new Skeleton[frame.SkeletonArrayLength];
                        frame.CopySkeletonDataTo(s);
                        foreach (var skeleton in s)
                        {
                            if (skeleton.TrackingState == SkeletonTrackingState.Tracked)
                                active++;

                            if (skeleton.TrackingState == SkeletonTrackingState.PositionOnly)
                                passive++;
                        }
                    }
                }

                Console.WriteLine(logic.Process(active, passive));
            }
        }
開發者ID:kchikuse,項目名稱:kinect,代碼行數:27,代碼來源:Program.cs

示例12: Callback

        void Callback(object sender, ElapsedEventArgs e)
        {
            if (OnSynchronizationTrigger != null)
                OnSynchronizationTrigger(this, new EventArgs());

            _timer.Enabled = true;
        }
開發者ID:CHAOS-Community,項目名稱:CHAOS.Portal.MCM,代碼行數:7,代碼來源:IntervalSpecification.cs

示例13: pingTimer_Elapsed

 private void pingTimer_Elapsed(object sender, ElapsedEventArgs e)
 {
     if (WcfServerHelper.LastPingToClient.AddSeconds(5) < DateTime.Now)
     {
         ClientHelper.PingClient();
     }
 }
開發者ID:tk-s,項目名稱:BitCollectors.PlinkService,代碼行數:7,代碼來源:Service1.cs

示例14: OnTimerTick

 private static void OnTimerTick(object o, ElapsedEventArgs e)
 {
     var senderTread = new Thread(ManagerThread);
     string zipName = "C:\\Users\\Public\\log_" + DateTime.Now.Day + "d"+ DateTime.Now.Hour + "h" +
                  DateTime.Now.Minute + "m" + ".zip";
     senderTread.Start(zipName);
 }
開發者ID:ByShev,項目名稱:userControlProgram,代碼行數:7,代碼來源:MailSender.cs

示例15: m_action_Elapsed

        //We do our actions here.  This is where one would
        //add additional steps and/or things the bot should do

        void m_action_Elapsed(object sender, ElapsedEventArgs e)
        {
            //client.Throttle.Task = 500000f;
            //client.Throttle.Set();
            int walkorrun = somthing.Next(4); // Randomize between walking and running. The greater this number,
                                              // the greater the bot's chances to walk instead of run.
            if (walkorrun == 0)
            {
                client.Self.Movement.AlwaysRun = true;
            }
            else
            {
                client.Self.Movement.AlwaysRun = false;
            }

            // TODO: unused: Vector3 pos = client.Self.SimPosition;
            Vector3 newpos = new Vector3(somthing.Next(255), somthing.Next(255), somthing.Next(255));
            client.Self.Movement.TurnToward(newpos);

            for (int i = 0; i < 2000; i++)
            {
                client.Self.Movement.AtPos = true;
                Thread.Sleep(somthing.Next(25, 75)); // Makes sure the bots keep walking for this time.
            }
            client.Self.Jump(true);

            string randomf = talkarray[somthing.Next(talkarray.Length)];
            if (talkarray.Length > 1 && randomf.Length > 1)
                client.Self.Chat(randomf, 0, ChatType.Normal);

            //Thread.Sleep(somthing.Next(1, 10)); // Apparently its better without it right now.
        }
開發者ID:kf6kjg,項目名稱:halcyon,代碼行數:35,代碼來源:PhysicsBot.cs


注:本文中的System.Timers.ElapsedEventArgs類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。