本文整理汇总了C#中System.Timers.ElapsedEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# ElapsedEventArgs类的具体用法?C# ElapsedEventArgs怎么用?C# ElapsedEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ElapsedEventArgs类属于System.Timers命名空间,在下文中一共展示了ElapsedEventArgs类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: PingTimerOnElapsed
private void PingTimerOnElapsed(object sender, ElapsedEventArgs elapsedEventArgs)
{
if (Client.Connected)
{
Client.WriteLine("PING");
}
}
开发者ID:elliotharris,项目名称:BashBot,代码行数:7,代码来源:Bot.cs
示例17: MoveToNextRow
public static void MoveToNextRow(object source, ElapsedEventArgs e)
{
if (!Moves.canBeMoved("down", FigureHolder.myFigure, Field.field, Indexes.currX, Indexes.currY))
{
if (Indexes.currX == 0)
{
Console.WriteLine("GameOver");
ImportantGameVariables.gameOver = true;
return;
}
else
{
FieldSaver.saveField(FigureHolder.myFigure, Field.field, Indexes.currX, Indexes.currY);
LaneRemover.RemoveLane(Field.field, Indexes.currX, Indexes.currY);
FigureHolder.myFigure = GenerateFigure.Generate();
Indexes.currX = 0;
Indexes.currY = 0;
if (!Validator.IsInRange(FigureHolder.myFigure, Field.field, Indexes.currX, Indexes.currY))
{
ImportantGameVariables.gameOver = true;
return;
}
}
}
else
{
Indexes.currX++;
}
Printer.Print(FigureHolder.myFigure, Field.field, Indexes.currX, Indexes.currY);
}
开发者ID:jblak2,项目名称:Tetris,代码行数:30,代码来源:MyTimer.cs
示例18: RefreshTimerOnElapsed
private void RefreshTimerOnElapsed(object sender, ElapsedEventArgs evilDevilMan)
{
try
{
var query = "http://www.challengeboards.net/boards/Search";
var client = (HttpWebRequest)HttpWebRequest.Create(query);
//User-Agent: OCTGN
//Host: www.challengeboards.net
//Accept: application/json, text/javascript, */*; q=0.01
//X-Requested-With: XMLHttpRequest
client.UserAgent = "OCTGN";
client.Accept = "application/json, text/javascript, */*; q=0.01";
client.Headers.Set("X-Requested-With", "XMLHttpRequest");
client.Method = "GET";
var resp = client.GetResponse();
var str = resp.GetResponseStream().ReadToEnd();
var obj = JsonConvert.DeserializeObject <SearchBoardsResponse>(str);
Dispatcher.Invoke(new Action(() => Boards.Clear()));
foreach (var i in obj.Boards.OrderBy(x=>x.Name))
{
Dispatcher.Invoke(new Action(() => Boards.Add(i)));
}
//Requires the following pull request to be merged
//https://github.com/jrmitch120/ChallengeBoard/pull/10
}
catch (Exception e)
{
Log.Warn("RefreshTimerOnElapsed Error", e);
}
}
开发者ID:rexperalta,项目名称:OCTGN,代码行数:35,代码来源:ChallengeBoards.xaml.cs
示例19: OnTimer
private void OnTimer(object sender, ElapsedEventArgs ea)
{
if (!Monitor.TryEnter(m_timerLock))
return;
try
{
List<KeyframeMotion> motions;
lock (m_lockObject)
{
motions = new List<KeyframeMotion>(m_motions.Keys);
}
foreach (KeyframeMotion m in motions)
{
try
{
m.OnTimer(TickDuration);
}
catch (Exception)
{
// Don't stop processing
}
}
}
catch (Exception)
{
// Keep running no matter what
}
finally
{
Monitor.Exit(m_timerLock);
}
}
开发者ID:AkiraSonoda,项目名称:akisim,代码行数:35,代码来源:KeyframeMotion.cs
示例20: MoveFood
private void MoveFood(object sender, ElapsedEventArgs e)
{
this.Position = this.Position + this._direction * (40 - this._salts);
List<Virus> clients = new List<Client>(this.Realm.Clients).OfType<Virus>().ToList();
// Verifica se algum virus vai comer
Virus virus = clients.AsParallel().FirstOrDefault(v => v.InsideClient(this.Position));
if (virus != null)
{
virus.Score += this.Score;
this.StopMove();
this.Realm.RemoveFood(this);
if (virus.Score > 200)
virus.Split(this._direction);
if (this._time != null)
this._time.Stop();
}
else
{
if (this._salts++ > 10)
this._time.Stop();
}
}
开发者ID:jjkl,项目名称:AgarioServer,代码行数:26,代码来源:Food.cs
注:本文中的System.Timers.ElapsedEventArgs类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论