本文整理汇总了C#中TimerCallback类的典型用法代码示例。如果您正苦于以下问题:C# TimerCallback类的具体用法?C# TimerCallback怎么用?C# TimerCallback使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TimerCallback类属于命名空间,在下文中一共展示了TimerCallback类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: set
public void set(float interval, int repeat, TimerCallback callback, object param, bool useFrame)
{
this.interval = interval;
this.repeat = repeat;
this.callback = callback;
this.param = param;
}
示例2: Delayed
/// <summary>
/// 処理延滞
/// </summary>
/// <author>Takanori Shibuya</author>
public void Delayed()
{
this.Dispose();
TimerCallback timerDelegate = new TimerCallback(CallbackHandle);
this.timer = new Timer(timerDelegate, null, 0, this.delay);
}
示例3: Timer
public Timer (TimerCallback callback, object state, uint dueTime, uint period)
{
// convert all values to long - with a special case for -1 / 0xffffffff
long d = (dueTime == UInt32.MaxValue) ? Timeout.Infinite : (long) dueTime;
long p = (period == UInt32.MaxValue) ? Timeout.Infinite : (long) period;
Init (callback, state, d, p);
}
示例4: OnceTimer
/// <summary>
/// 一度だけ実行されるタイマを設定する
/// </summary>
/// <param name="callback">タイマコールバック関数</param>
/// <param name="startTime">開始する日時</param>
/// <returns>生成されたタイマインスタンス</returns>
public static Timer OnceTimer(TimerCallback callback, DateTime startTime)
{
TimeSpan ts = startTime - DateTime.Now;
Trace.WriteLine("[" + DateTime.Now.ToString() + "] LabMonitoring.TimerUtil#OnceTimer\r\n"
+ "New timer is set at " + startTime.ToString() + " at once.");
return OnceTimer(callback, (int)ts.TotalMilliseconds);
}
示例5: TimerWithStartTime
/// <summary>
/// 開始日時を指定したタイマを設定する
/// </summary>
/// <param name="callback">タイマコールバック関数</param>
/// <param name="startTime">実行開始日時</param>
/// <param name="period">繰り返し間隔</param>
/// <returns>生成されたタイマインスタンス</returns>
public static Timer TimerWithStartTime(TimerCallback callback, DateTime startTime, TimeSpan period)
{
TimeSpan ts = startTime - DateTime.Now;
Trace.WriteLine("[" + DateTime.Now.ToString() + "] LabMonitoring.TimerUtil#TimerWithStartTime\r\n"
+ "New timer is set at " + startTime.ToString() + " every " + period.Minutes + " minutes.");
return new Timer(callback, null, ts, period);
}
示例6: LoadView
private void LoadView ()
{
// Paste your license key here.
mNChartView.Chart.LicenseKey = "";
// Margin to ensure some free space for the iOS status bar.
mNChartView.Chart.CartesianSystem.Margin = new NChartTypes.Margin (10.0f, 10.0f, 10.0f, 20.0f);
// Create column series with colors from the array and add them to the chart.
NChartColumnSeries series = new NChartColumnSeries ();
// Set brush that will fill that series with color.
series.Brush = new NChartSolidColorBrush (Color.Argb (255, 100, 200, 225));
// Set data source for the series.
series.DataSource = this;
// Add series to the chart.
mNChartView.Chart.AddSeries (series);
// Activate streaming mode.
mNChartView.Chart.StreamingMode = true;
// Prevent minimum and maximum on the axes from "jumping" by activating incremental mode. So the minimum will remain
// the minimal value ever appeared in the data, and maximum will remain the maximal one.
mNChartView.Chart.IncrementalMinMaxMode = true;
// Update data in the chart.
mNChartView.Chart.UpdateData ();
TimerCallback timerCallback = new TimerCallback (Stream);
timer = new Timer (timerCallback, mNChartView.Chart.GetSeries () [mNChartView.Chart.GetSeries ().Length - 1], 100, 100);
}
示例7: Main
static void Main(string[] args)
{
TimerCallback callback = new TimerCallback(RequestService);
Timer stateTimer = new Timer(callback, null, 0, 3000);
for (; ; ) { }
}
示例8: SmartTimer
public SmartTimer(TimerCallback callback, object state, TimeSpan due, TimeSpan period)
{
this.period = period;
this.callback = callback;
this.next = DateTime.UtcNow + due;
this.timer = new Timer(new TimerCallback(this.HandleCallback), state, due, this.infinite);
}
示例9: RunTimer
public void RunTimer()
{
TimeObject TimeObj = new TimeObject();
TimeObj.enable = true;
TimeObj.count = 1;
TimerCallback TimerDelegate = new TimerCallback(TimerTask);
Timer TimerItem = new Timer(TimerDelegate, TimeObj, 2000, delay);
TimeObj.timer = TimerItem;
TimeSpan span1 = TimeSpan.FromMinutes(this.minutes);
if (!infi)
{
while (TimeObj.count < max_count)
{
Thread.Sleep(span1);
}
}
else
{
while (true)
{
Thread.Sleep(span1);
}
}
TimeObj.enable = false;
}
示例10: TSK_Timer
public TSK_Timer(UInt64 period, Boolean repeat, TimerCallback callback)
{
mPeriod = period;
mRepeat = repeat;
mTimer = new Timer(callback, this, Timeout.Infinite, Timeout.Infinite);
}
示例11: Timer
public Timer(TimerCallback callback, object state, int dueTime, int period)
{
this.callback = callback;
this.state = state;
Change(dueTime, period);
}
示例12: Cymbal
/// <summary>
/// Constructor
/// </summary>
/// <param name="percussion">Percussion enumeration</param>
/// <param name="sound">Cymbal sound</param>
/// <param name="boundaries">Bounding box</param>
/// <param name="touchAreas">List of rectangular touch areas</param>
/// <param name="image">Cymbal image</param>
public Cymbal(Percussion percussion, SoundEffect sound, Rectangle boundaries, List<Rectangle> touchAreas, Texture2D image)
: base(percussion, sound, boundaries, touchAreas, image)
{
MaxAngle = 0.26f; // Default for max angle (~15 degrees)
rotate = new TimerCallback(RotateCallback);
Played += new EventHandler(Cymbal_Played);
}
示例13: RecurringCall
public static Timer RecurringCall(double delay, TimerCallback callback)
{
Timer newTimer = null;
Timer returnTimer = null;
try
{
newTimer = new Timer(delay);
newTimer.AutoReset = true;
newTimer.Elapsed += new ElapsedEventHandler(delegate(object sender, ElapsedEventArgs args)
{
try
{
callback();
}
catch (Exception ex)
{
Logger.Fatal(Strings.UnhandledExceptionCaught, ex.ToString());
Environment.FailFast(Strings.UnhandledExceptionCaught2 + "\r\n" + ex.ToString());
}
});
newTimer.Enabled = true;
returnTimer = newTimer;
newTimer = null;
}
finally
{
if (newTimer != null)
{
newTimer.Close();
}
}
return returnTimer;
}
示例14: DefaultKeepAliveTracker
public DefaultKeepAliveTracker(TimeSpan keepAliveInterval, TimerCallback keepAliveCallback)
{
_keepAliveInterval = keepAliveInterval;
_keepAliveTimerElapsedCallback = keepAliveCallback;
_lastSendActivity = new Stopwatch();
_lastReceiveActivity = new Stopwatch();
}
示例15: CTaskManager_WuQi
private int timer_lock = 0; //定时器循环重复进入锁
#endregion Fields
#region Constructors
private CTaskManager_WuQi()
{
l_tasks = new List<CTask_WuQi>();
task_lock = new object();
timerDelegate = new TimerCallback(TimerMethod);
ticker = new Timer(timerDelegate,this,30000,peroid);
}