1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421
|
<Type Name="Timer" FullName="System.Timers.Timer">
<TypeSignature Language="C#" Maintainer="auto" Value="public class Timer : System.ComponentModel.Component, System.ComponentModel.ISupportInitialize" />
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyPublicKey>[00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00]</AssemblyPublicKey>
<AssemblyVersion>1.0.3300.0</AssemblyVersion>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ThreadSafetyStatement>Gtk# is thread aware, but not thread safe; See the <link location="node:gtk-sharp/programming/threads">Gtk# Thread Programming</link> for details.</ThreadSafetyStatement>
<Base>
<BaseTypeName>System.ComponentModel.Component</BaseTypeName>
</Base>
<Interfaces>
<Interface>
<InterfaceName>System.ComponentModel.ISupportInitialize</InterfaceName>
</Interface>
</Interfaces>
<Attributes>
<Attribute>
<AttributeName>System.ComponentModel.DefaultProperty("Interval")</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.ComponentModel.DefaultEvent("Elapsed")</AttributeName>
</Attribute>
</Attributes>
<Docs>
<summary>Provides a mechanism to trigger events at a preset interval.</summary>
<remarks>
<para>The Timer component raises the <see cref="E:System.Timers.Timer.Elapsed" /> event at recurring intervals, set by the <see cref="P:System.Timers.Timer.Interval" /> property.</para>
<para>By default this timer executes the Elapsed event handlers on a thread from the <see cref="T:System.Threading.ThreadPool" />, however this behaviour can be changed by providing an instance of <see cref="T:System.ComponentModel.ISynchronizeInvoke" /> to the <see cref="P:System.Timers.Timer.SynchronizingObject" /> property.</para>
<para>By default, the <see cref="P:System.Timers.Timer.AutoReset" /> property is true and the timer will raise the <see cref="E:System.Timers.Timer.Elapsed" /> event multiple times. To cause the Timer to raise this event once only, set <see cref="P:System.Timers.Timer.AutoReset" /> to false.</para>
<block subset="none" type="note">
<para>
As mentioned previously, event handlers are raised on a thread from the <see cref="T:System.Threading.ThreadPool" />. It is possible that the timer Interval will pass before processing of the previous event handler is complete and cause two threads to execute the event handler simultaneously. As such, you should ensure that your <see cref="E:System.Timers.Timer.Elapsed" /> event handlers are reentrant.
</para>
</block>
<block subset="none" type="note">
<para>
As the Elapsed event handlers are raised on a ThreadPool thread, a race condition exists where the event handler may be executed after <see cref="M:System.Timers.Timer.Stop" /> has been called on a separate thread. If it is cruical that the Stop thread not continue until the event handler completes, use a stronger synchronization mechanism such as the <see cref="T:System.Threading.Monitor" /> class.
</para>
</block>
<example>
<code lang="C#">
using System;
using System.Timers;
public class TimerExample
{
private static System.Timers.Timer ourTimer;
public static void Main()
{
ourTimer = new System.Timers.Timer();
// attach to the Elapsed event.
ourTimer.Elapsed += new ElapsedEventHandler(OnTimerElapsed);
// make our timer interval 1 second
ourTimer.Interval = 1000;
// don't forget to enable the timer!
// we could also call ourTimer.Start() here; they both have the same effect
// (starting the timer).
ourTimer.Enabled = true;
Console.WriteLine("Waiting 10 seconds before exit...");
System.Threading.Thread.Sleep(10000);
}
private static void OnTimerElapsed(object sender, ElapsedEventArgs e)
{
Console.WriteLine("Timer elapsed at: " + e.SignalTime.ToLongTimeString());
}
}
</code>
</example>
</remarks>
</Docs>
<Members>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public Timer ();" />
<MemberType>Constructor</MemberType>
<ReturnValue />
<Parameters />
<Docs>
<summary>Constructs and initializes a new instance of the <see cref="T:System.Timers.Timer" /> class with properties set to default values.</summary>
<remarks>
<para>Below are the default values applied when using this constructor:</para>
<list type="table">
<listheader>
<term>Property</term>
<description>Initial Value</description>
</listheader>
<item>
<term>AutoReset</term>
<description>true</description>
</item>
<item>
<term>Interval</term>
<description>100</description>
</item>
<item>
<term>Enabled</term>
<description>false</description>
</item>
</list>
</remarks>
</Docs>
<AssemblyInfo>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
</AssemblyInfo>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public Timer (double interval);" />
<MemberType>Constructor</MemberType>
<ReturnValue />
<Parameters>
<Parameter Name="interval" Type="System.Double" />
</Parameters>
<Docs>
<param name="interval">The Interval duration, in milliseconds.</param>
<summary>Constructs and initializes a new instance of the <see cref="T:System.Timers.Timer" /> class with the specified <see cref="P:System.Timers.Timer.Interval" />.</summary>
<remarks>
<para>Constructs a new <see cref="T:System.Timers.Timer" /> instance with the specified interval. All other properties retain their default values.</para>
<para>For a list of default values, see <see cref="M:System.Timers.Timer.Timer()" /></para>
</remarks>
</Docs>
<AssemblyInfo>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
</AssemblyInfo>
</Member>
<Member MemberName="AutoReset">
<MemberSignature Language="C#" Value="public bool AutoReset { set; get; }" />
<MemberType>Property</MemberType>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Parameters>
</Parameters>
<Docs>
<param name="value">If true, the <see cref="E:System.Timers.Timer.Elapsed" /> event is raised multiple times. If false, it is raised only once. Default true.</param>
<summary>Get or set a value which determines whether the <see cref="E:System.Timers.Timer.Elapsed" /> event is raised multiple times (once for each time <see cref="P:System.Timers.Timer.Interval" /> passes), or just once.</summary>
<value>true if the timer will raise the Elapsed event multiple times when Interval passes, false if it will raise it just once.</value>
<remarks>A value which determines whether the <see cref="E:System.Timers.Timer.Elapsed" /> event is raised multiple times (once for each time <see cref="P:System.Timers.Timer.Interval" /> passes), or just once.</remarks>
</Docs>
<AssemblyInfo>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>System.Timers.TimersDescription("Indicates whether the timer will be restarted when it is enabled.")</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.ComponentModel.DefaultValue(true)</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.ComponentModel.Category("Behavior")</AttributeName>
</Attribute>
</Attributes>
</Member>
<Member MemberName="BeginInit">
<MemberSignature Language="C#" Value="public void BeginInit ();" />
<MemberType>Method</MemberType>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>This method currently does nothing.</summary>
<remarks>This method exists to satisfy interface requirements but has no purpose.</remarks>
</Docs>
<AssemblyInfo>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
</AssemblyInfo>
</Member>
<Member MemberName="Close">
<MemberSignature Language="C#" Value="public void Close ();" />
<MemberType>Method</MemberType>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Disables the timer.</summary>
<remarks>This has the same effect as calling <see cref="M:System.Timers.Timer.Stop()" />, or setting <see cref="P:System.Timers.Timer.Enabled" /> to false.</remarks>
</Docs>
<AssemblyInfo>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
</AssemblyInfo>
</Member>
<Member MemberName="Dispose">
<MemberSignature Language="C#" Value="protected override void Dispose (bool disposing);" />
<MemberType>Method</MemberType>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="disposing" Type="System.Boolean" />
</Parameters>
<Docs>
<param name="disposing">true if the object is being disposed, false otherwise.</param>
<summary>Disables and disposes of the timer component.</summary>
<remarks>Disables and disposes of the timer component.</remarks>
</Docs>
<AssemblyInfo>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
</AssemblyInfo>
</Member>
<Member MemberName="Elapsed">
<MemberSignature Language="C#" Value="public event System.Timers.ElapsedEventHandler Elapsed;" />
<MemberType>Event</MemberType>
<ReturnValue>
<ReturnType>System.Timers.ElapsedEventHandler</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>This event is raised when the specified <see cref="P:System.Timers.Timer.Interval" /> elapses.</summary>
<remarks>
<para>If <see cref="P:System.Timers.Timer.AutoReset" /> is true, this event will be raised only once. Otherwise, this event will be raised once for each time <see cref="P:System.Timers.Timer.Interval" /> elapses.</para>
<para>To see an example of how to use this event, see the <see cref="T:System.Timers.Timer" /> class documentation.</para>
</remarks>
</Docs>
<AssemblyInfo>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>System.Timers.TimersDescription("Occurs when the Interval has elapsed.")</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.ComponentModel.Category("Behavior")</AttributeName>
</Attribute>
</Attributes>
</Member>
<Member MemberName="Enabled">
<MemberSignature Language="C#" Value="public bool Enabled { set; get; }" />
<MemberType>Property</MemberType>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Parameters>
</Parameters>
<Docs>
<param name="value">True to enable this timer, false to disable it.</param>
<summary>Get or set a value indicating whether this timer is enabled or disabled.</summary>
<value>Boolean true if this timer is enabled, or boolean false if this timer is disabled.</value>
<remarks>
<para>Using this property is equivalent to calling <see cref="M:System.Timers.Timer.Start" /> or <see cref="M:System.Timers.Timer.Stop" />.</para>
<block subset="none" type="note">
<para>
Disabling a timer that has been enabled, but whose <see cref="P:System.Timers.Timer.Interval" /> has not elapsed will cause that timer not to raise its <see cref="E:System.Timers.Timer.Elapsed" /> event.
</para>
</block>
</remarks>
</Docs>
<AssemblyInfo>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>System.Timers.TimersDescription("Indicates whether the timer is enabled to fire events at a defined interval.")</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.ComponentModel.DefaultValue(false)</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.ComponentModel.Category("Behavior")</AttributeName>
</Attribute>
</Attributes>
</Member>
<Member MemberName="EndInit">
<MemberSignature Language="C#" Value="public void EndInit ();" />
<MemberType>Method</MemberType>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>This method currently does nothing.</summary>
<remarks>This method exists to satisfy interface requirements but has no purpose.</remarks>
</Docs>
<AssemblyInfo>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
</AssemblyInfo>
</Member>
<Member MemberName="Interval">
<MemberSignature Language="C#" Value="public double Interval { set; get; }" />
<MemberType>Property</MemberType>
<ReturnValue>
<ReturnType>System.Double</ReturnType>
</ReturnValue>
<Parameters>
</Parameters>
<Docs>
<param name="value">Double value representing the number of milliseconds for the interval.</param>
<summary>To be added</summary>
<value>Double value representing the number of milliseconds for the interval.</value>
<remarks>
<para>Changing this property after starting the timer will have no effect. For example, if I set Interval to 5 seconds, enable the timer and once 3 seconds pass I set Interval to 10 seconds, the <see cref="E:System.Timers.Timer.Elapsed" /> event will still be raised after the original 5 seconds, not 13 seconds as could be assumed.</para>
</remarks>
</Docs>
<AssemblyInfo>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>System.Timers.TimersDescription("The number of milliseconds between timer events.")</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.ComponentModel.RecommendedAsConfigurable(true)</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.ComponentModel.DefaultValue(100)</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.ComponentModel.Category("Behavior")</AttributeName>
</Attribute>
</Attributes>
</Member>
<Member MemberName="Site">
<MemberSignature Language="C#" Value="public override System.ComponentModel.ISite Site { set; get; }" />
<MemberType>Property</MemberType>
<ReturnValue>
<ReturnType>System.ComponentModel.ISite</ReturnType>
</ReturnValue>
<Parameters>
</Parameters>
<Docs>
<summary>To be added</summary>
<value>To be added: an object of type 'ComponentModel.ISite'</value>
<remarks>To be added</remarks>
</Docs>
<AssemblyInfo>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
</AssemblyInfo>
</Member>
<Member MemberName="Start">
<MemberSignature Language="C#" Value="public void Start ();" />
<MemberType>Method</MemberType>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Causes the timer to begin raising <see cref="E:System.Timers.Timer.Elapsed" /> events.</summary>
<remarks>
<para>Calling this method has the same effect as setting <see cref="P:System.Timers.Timer.Enabled" /> to true.</para>
<para>For an example covering the use of the Timer class, see the <see cref="T:System.Timers.Timer" /> class documentation.</para>
</remarks>
</Docs>
<AssemblyInfo>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
</AssemblyInfo>
</Member>
<Member MemberName="Stop">
<MemberSignature Language="C#" Value="public void Stop ();" />
<MemberType>Method</MemberType>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Causes the timer to stop raising <see cref="E:System.Timers.Timer.Elapsed" /> events.</summary>
<remarks>
<para>Calling this property has the same effect as setting <see cref="P:System.Timers.Timer.Enabled" /> to false.</para>
<block subset="none" type="note">
<para>
A race condition exists where an <see cref="E:System.Timers.Timer.Elapsed" /> event handler may be executed after a call to Stop has been made. See the main <see cref="T:System.Timers.Timer" /> class documentation for more information.
</para>
</block>
</remarks>
</Docs>
<AssemblyInfo>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
</AssemblyInfo>
</Member>
<Member MemberName="SynchronizingObject">
<MemberSignature Language="C#" Value="public System.ComponentModel.ISynchronizeInvoke SynchronizingObject { set; get; }" />
<MemberType>Property</MemberType>
<ReturnValue>
<ReturnType>System.ComponentModel.ISynchronizeInvoke</ReturnType>
</ReturnValue>
<Parameters>
</Parameters>
<Docs>
<summary>To be added</summary>
<value>To be added: an object of type 'ComponentModel.ISynchronizeInvoke'</value>
<remarks>To be added</remarks>
</Docs>
<AssemblyInfo>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>System.ComponentModel.Browsable(false)</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.Timers.TimersDescription("The object used to marshal the event handler calls issued when an interval has elapsed.")</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.ComponentModel.DefaultValue(null)</AttributeName>
</Attribute>
</Attributes>
</Member>
</Members>
</Type>
|