本文整理汇总了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));
}
}
示例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);
}
}
示例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);
}
}
示例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();
}
示例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);
}
示例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);
}
}
}
示例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);
}
示例8: timer_Elapsed
void timer_Elapsed(object sender, ElapsedEventArgs e)
{
this.Dispatcher.Invoke(new Action(() =>
{
this.mw.CloseGame();
}), null);
}
示例9: timer_Elapsed
private void timer_Elapsed(object sender, ElapsedEventArgs e)
{
foreach (var provider in instrumentationProviders)
{
provider.Instrument();
}
}
示例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();
}
示例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));
}
}
示例12: Callback
void Callback(object sender, ElapsedEventArgs e)
{
if (OnSynchronizationTrigger != null)
OnSynchronizationTrigger(this, new EventArgs());
_timer.Enabled = true;
}
示例13: pingTimer_Elapsed
private void pingTimer_Elapsed(object sender, ElapsedEventArgs e)
{
if (WcfServerHelper.LastPingToClient.AddSeconds(5) < DateTime.Now)
{
ClientHelper.PingClient();
}
}
示例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);
}
示例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.
}