Class RoutineBlocker0
Block the thread to the given delay from the previous block.
public class RoutineBlocker0 : IMakeXmlSource
- Inheritance
-
RoutineBlocker0
- Implements
- Inherited Members
- Extension Methods
Constructors
RoutineBlocker0()
Constructor
public RoutineBlocker0()
RoutineBlocker0(XElement)
Initializes a new instance of the RoutineBlocker0 class from an XML element.
public RoutineBlocker0(XElement src)
Parameters
src
XElementThe XML element containing the blocker configuration
Fields
XName
Gets the XML element name used for serialization.
public static string XName
Field Value
Properties
Enable
Enable the Block() function.
public bool Enable { get; set; }
Property Value
Period
Delay time between each previous Block().
public TimeSpan Period { get; set; }
Property Value
Methods
Block()
Delay the thread. The delay time is Period, counted from the previous Block() to the current Block(). The first function call does no delay. If the time between two Block() is over Period, the function call does no delay.
public void Block()
HasToBlock()
If calling Block() make thread delay, return true; otherwise, false.
public bool HasToBlock()
Returns
- bool
Has to block
MakeXmlSource(string, string)
Creates an XML representation of the object. This method may also generate additional resources such as related files.
public XElement MakeXmlSource(string baseDirectory, string relFile)
Parameters
baseDirectory
stringThe base directory for resolving relative paths
relFile
stringThe relative file path for the XML source
Returns
- XElement
An XML element representing the object's state
Remarks
For the demand of easy moving source folder (especially project folder) without configuration file path corruption, the relative file path is applied.
The baseDirectory
is typically the folder at the nearest configuration file folder.
Since the folder can be moving with the configuration file.