本文整理汇总了C#中System.Timers.Timer.SetIntervalInSeconds方法的典型用法代码示例。如果您正苦于以下问题:C# Timer.SetIntervalInSeconds方法的具体用法?C# Timer.SetIntervalInSeconds怎么用?C# Timer.SetIntervalInSeconds使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Timers.Timer
的用法示例。
在下文中一共展示了Timer.SetIntervalInSeconds方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: StartTimers
public void StartTimers()
{
using (DataClassesDataContext context = m_config.GetNewContext())
{
foreach (var u in (context.Urls.Select(x => x)))
{
UrlTester tester = new UrlTester(u, m_config);
Timer t = new Timer();
t.SetIntervalInSeconds(u.Setting.Periode);
t.Elapsed += new ElapsedEventHandler(tester.Test);
t.Start();
m_urlTimers.Add(u.ID, new UrlTimer { Timer = t, Tester = tester });
LogDebug(string.Format("Timer aangemaakt voor {0}", u));
}
}
// extra timer om de instellingen bij te werken.
m_settingsTimer = new Timer();
m_settingsTimer.SetIntervalInSeconds(10);
m_settingsTimer.Elapsed += new ElapsedEventHandler(RefreshUrlCollection);
m_settingsTimer.Start();
}
示例2: AddNewUrlTester
private void AddNewUrlTester(Dictionary<int, UrlTimer> touchedTimers, Url u)
{
UrlTester tester = new UrlTester(u, m_config);
Timer t = new Timer();
t.SetIntervalInSeconds(u.Setting.Periode);
t.Elapsed += new ElapsedEventHandler(tester.Test);
t.Start();
touchedTimers.Add(u.ID, new UrlTimer { Timer = t, Tester = tester });
LogDebug(string.Format("Timer aangemaakt voor {0}", u));
}
示例3: ChangeTime
private void ChangeTime(Timer timer, Url url, DataClassesDataContext context, int interval)
{
Debug.WriteLine(string.Format("{0} veranderd naar {1}", this, interval));
timer.SetIntervalInSeconds(interval);
url.CurrentPeriode = interval;
context.SubmitChanges();
}