Event Module
Contains operations for working with values of type IEvent.
Functions and values
Function or value |
Description
|
|
Runs the given function each time the given event is triggered.
Example
namespace System
val createTimer: interval: 'a -> IEvent<Timers.ElapsedEventHandler,Timers.ElapsedEventArgs>
val interval: 'a
val timer: Timers.Timer
namespace System.Timers
Multiple items
type Timer = inherit Component interface ISupportInitialize new: unit -> unit + 2 overloads member BeginInit: unit -> unit member Close: unit -> unit member EndInit: unit -> unit member Start: unit -> unit member Stop: unit -> unit member AutoReset: bool member Enabled: bool ... <summary>Generates an event after a set interval, with an option to generate recurring events.</summary> -------------------- Timers.Timer() : Timers.Timer Timers.Timer(interval: float) : Timers.Timer Timers.Timer(interval: TimeSpan) : Timers.Timer property Timers.Timer.AutoReset: bool with get, set
<summary>Gets or sets a Boolean indicating whether the <see cref="T:System.Timers.Timer" /> should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event only once (<see langword="false" />) or repeatedly (<see langword="true" />).</summary> <returns><see langword="true" /> if the <see cref="T:System.Timers.Timer" /> should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event each time the interval elapses; <see langword="false" /> if it should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event only once, after the first time the interval elapses. The default is <see langword="true" />.</returns> property Timers.Timer.Enabled: bool with get, set
<summary>Gets or sets a value indicating whether the <see cref="T:System.Timers.Timer" /> should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event.</summary> <exception cref="T:System.ObjectDisposedException">This property cannot be set because the timer has been disposed.</exception> <exception cref="T:System.ArgumentException">The <see cref="P:System.Timers.Timer.Interval" /> property was set to a value greater than <see cref="F:System.Int32.MaxValue">Int32.MaxValue</see> before the timer was enabled.</exception> <returns><see langword="true" /> if the <see cref="T:System.Timers.Timer" /> should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event; otherwise, <see langword="false" />. The default is <see langword="false" />.</returns> event Timers.Timer.Elapsed: IEvent<Timers.ElapsedEventHandler,Timers.ElapsedEventArgs>
val timer: IEvent<Timers.ElapsedEventHandler,Timers.ElapsedEventArgs>
Multiple items
module Event from Microsoft.FSharp.Control -------------------- type Event<'T> = new: unit -> Event<'T> member Trigger: arg: 'T -> unit member Publish: IEvent<'T> -------------------- type Event<'Delegate,'Args (requires delegate and 'Delegate :> Delegate and reference type)> = new: unit -> Event<'Delegate,'Args> member Trigger: sender: obj * args: 'Args -> unit member Publish: IEvent<'Delegate,'Args> -------------------- new: unit -> Event<'T> -------------------- new: unit -> Event<'Delegate,'Args> val add: callback: ('T -> unit) -> sourceEvent: IEvent<'Del,'T> -> unit (requires delegate and 'Del :> Delegate)
val event: Timers.ElapsedEventArgs
Multiple items
type ElapsedEventArgs = inherit EventArgs new: signalTime: DateTime -> unit member SignalTime: DateTime <summary>Provides data for the <see cref="E:System.Timers.Timer.Elapsed" /> event.</summary> -------------------- Timers.ElapsedEventArgs(signalTime: DateTime) : Timers.ElapsedEventArgs val printfn: format: Printf.TextWriterFormat<'T> -> 'T
property Timers.ElapsedEventArgs.SignalTime: DateTime with get
<summary>Gets the date/time when the <see cref="E:System.Timers.Timer.Elapsed" /> event was raised.</summary> <returns>The time the <see cref="E:System.Timers.Timer.Elapsed" /> event was raised.</returns> type Console =
static member Beep: unit -> unit + 1 overload
static member Clear: unit -> unit
static member GetCursorPosition: unit -> struct (int * int)
static member MoveBufferArea: sourceLeft: int * sourceTop: int * sourceWidth: int * sourceHeight: int * targetLeft: int * targetTop: int -> unit + 1 overload
static member OpenStandardError: unit -> Stream + 1 overload
static member OpenStandardInput: unit -> Stream + 1 overload
static member OpenStandardOutput: unit -> Stream + 1 overload
static member Read: unit -> int
static member ReadKey: unit -> ConsoleKeyInfo + 1 overload
static member ReadLine: unit -> string
...
<summary>Represents the standard input, output, and error streams for console applications. This class cannot be inherited.</summary> Console.ReadLine() : string
val ignore: value: 'T -> unit
The sample will output the timer event every second:
2/14/2022 11:52:05 PM
2/14/2022 11:52:06 PM
2/14/2022 11:52:07 PM
2/14/2022 11:52:08 PM
|
|
Returns a new event which fires on a selection of messages from the original event. The selection function takes an original message to an optional new message.
Example
namespace System
val createTimer: interval: 'a -> IEvent<Timers.ElapsedEventHandler,Timers.ElapsedEventArgs>
val interval: 'a
val timer: Timers.Timer
namespace System.Timers
Multiple items
type Timer = inherit Component interface ISupportInitialize new: unit -> unit + 2 overloads member BeginInit: unit -> unit member Close: unit -> unit member EndInit: unit -> unit member Start: unit -> unit member Stop: unit -> unit member AutoReset: bool member Enabled: bool ... <summary>Generates an event after a set interval, with an option to generate recurring events.</summary> -------------------- Timers.Timer() : Timers.Timer Timers.Timer(interval: float) : Timers.Timer Timers.Timer(interval: TimeSpan) : Timers.Timer property Timers.Timer.AutoReset: bool with get, set
<summary>Gets or sets a Boolean indicating whether the <see cref="T:System.Timers.Timer" /> should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event only once (<see langword="false" />) or repeatedly (<see langword="true" />).</summary> <returns><see langword="true" /> if the <see cref="T:System.Timers.Timer" /> should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event each time the interval elapses; <see langword="false" /> if it should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event only once, after the first time the interval elapses. The default is <see langword="true" />.</returns> property Timers.Timer.Enabled: bool with get, set
<summary>Gets or sets a value indicating whether the <see cref="T:System.Timers.Timer" /> should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event.</summary> <exception cref="T:System.ObjectDisposedException">This property cannot be set because the timer has been disposed.</exception> <exception cref="T:System.ArgumentException">The <see cref="P:System.Timers.Timer.Interval" /> property was set to a value greater than <see cref="F:System.Int32.MaxValue">Int32.MaxValue</see> before the timer was enabled.</exception> <returns><see langword="true" /> if the <see cref="T:System.Timers.Timer" /> should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event; otherwise, <see langword="false" />. The default is <see langword="false" />.</returns> event Timers.Timer.Elapsed: IEvent<Timers.ElapsedEventHandler,Timers.ElapsedEventArgs>
val timer: IEvent<Timers.ElapsedEventHandler,Timers.ElapsedEventArgs>
val getEvenSeconds: number: Timers.ElapsedEventArgs -> DateTime option
val number: Timers.ElapsedEventArgs
Multiple items
type ElapsedEventArgs = inherit EventArgs new: signalTime: DateTime -> unit member SignalTime: DateTime <summary>Provides data for the <see cref="E:System.Timers.Timer.Elapsed" /> event.</summary> -------------------- Timers.ElapsedEventArgs(signalTime: DateTime) : Timers.ElapsedEventArgs property Timers.ElapsedEventArgs.SignalTime: DateTime with get
<summary>Gets the date/time when the <see cref="E:System.Timers.Timer.Elapsed" /> event was raised.</summary> <returns>The time the <see cref="E:System.Timers.Timer.Elapsed" /> event was raised.</returns> property DateTime.Second: int with get
<summary>Gets the seconds component of the date represented by this instance.</summary> <returns>The seconds component, expressed as a value between 0 and 59.</returns> union case Option.Some: Value: 'T -> Option<'T>
union case Option.None: Option<'T>
val evenSecondsEvent: IEvent<DateTime>
Multiple items
module Event from Microsoft.FSharp.Control -------------------- type Event<'T> = new: unit -> Event<'T> member Trigger: arg: 'T -> unit member Publish: IEvent<'T> -------------------- type Event<'Delegate,'Args (requires delegate and 'Delegate :> Delegate and reference type)> = new: unit -> Event<'Delegate,'Args> member Trigger: sender: obj * args: 'Args -> unit member Publish: IEvent<'Delegate,'Args> -------------------- new: unit -> Event<'T> -------------------- new: unit -> Event<'Delegate,'Args> val choose: chooser: ('T -> 'U option) -> sourceEvent: IEvent<'Del,'T> -> IEvent<'U> (requires delegate and 'Del :> Delegate)
member IObservable.Subscribe: callback: ('T -> unit) -> IDisposable
IObservable.Subscribe(observer: IObserver<DateTime>) : IDisposable val x: DateTime
val printfn: format: Printf.TextWriterFormat<'T> -> 'T
val ignore: value: 'T -> unit
type Console =
static member Beep: unit -> unit + 1 overload
static member Clear: unit -> unit
static member GetCursorPosition: unit -> struct (int * int)
static member MoveBufferArea: sourceLeft: int * sourceTop: int * sourceWidth: int * sourceHeight: int * targetLeft: int * targetTop: int -> unit + 1 overload
static member OpenStandardError: unit -> Stream + 1 overload
static member OpenStandardInput: unit -> Stream + 1 overload
static member OpenStandardOutput: unit -> Stream + 1 overload
static member Read: unit -> int
static member ReadKey: unit -> ConsoleKeyInfo + 1 overload
static member ReadLine: unit -> string
...
<summary>Represents the standard input, output, and error streams for console applications. This class cannot be inherited.</summary> Console.ReadLine() : string
The sample will output: 2/15/2022 12:04:04 AM
2/15/2022 12:04:06 AM
2/15/2022 12:04:08 AM
|
|
Returns a new event that listens to the original event and triggers the resulting event only when the argument to the event passes the given function.
Example
namespace System
val createTimer: interval: 'a -> IEvent<Timers.ElapsedEventHandler,Timers.ElapsedEventArgs>
val interval: 'a
val timer: Timers.Timer
namespace System.Timers
Multiple items
type Timer = inherit Component interface ISupportInitialize new: unit -> unit + 2 overloads member BeginInit: unit -> unit member Close: unit -> unit member EndInit: unit -> unit member Start: unit -> unit member Stop: unit -> unit member AutoReset: bool member Enabled: bool ... <summary>Generates an event after a set interval, with an option to generate recurring events.</summary> -------------------- Timers.Timer() : Timers.Timer Timers.Timer(interval: float) : Timers.Timer Timers.Timer(interval: TimeSpan) : Timers.Timer property Timers.Timer.AutoReset: bool with get, set
<summary>Gets or sets a Boolean indicating whether the <see cref="T:System.Timers.Timer" /> should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event only once (<see langword="false" />) or repeatedly (<see langword="true" />).</summary> <returns><see langword="true" /> if the <see cref="T:System.Timers.Timer" /> should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event each time the interval elapses; <see langword="false" /> if it should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event only once, after the first time the interval elapses. The default is <see langword="true" />.</returns> property Timers.Timer.Enabled: bool with get, set
<summary>Gets or sets a value indicating whether the <see cref="T:System.Timers.Timer" /> should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event.</summary> <exception cref="T:System.ObjectDisposedException">This property cannot be set because the timer has been disposed.</exception> <exception cref="T:System.ArgumentException">The <see cref="P:System.Timers.Timer.Interval" /> property was set to a value greater than <see cref="F:System.Int32.MaxValue">Int32.MaxValue</see> before the timer was enabled.</exception> <returns><see langword="true" /> if the <see cref="T:System.Timers.Timer" /> should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event; otherwise, <see langword="false" />. The default is <see langword="false" />.</returns> event Timers.Timer.Elapsed: IEvent<Timers.ElapsedEventHandler,Timers.ElapsedEventArgs>
val timer: IEvent<Timers.ElapsedEventHandler,Timers.ElapsedEventArgs>
val getEvenSeconds: number: Timers.ElapsedEventArgs -> bool
val number: Timers.ElapsedEventArgs
Multiple items
type ElapsedEventArgs = inherit EventArgs new: signalTime: DateTime -> unit member SignalTime: DateTime <summary>Provides data for the <see cref="E:System.Timers.Timer.Elapsed" /> event.</summary> -------------------- Timers.ElapsedEventArgs(signalTime: DateTime) : Timers.ElapsedEventArgs property Timers.ElapsedEventArgs.SignalTime: DateTime with get
<summary>Gets the date/time when the <see cref="E:System.Timers.Timer.Elapsed" /> event was raised.</summary> <returns>The time the <see cref="E:System.Timers.Timer.Elapsed" /> event was raised.</returns> property DateTime.Second: int with get
<summary>Gets the seconds component of the date represented by this instance.</summary> <returns>The seconds component, expressed as a value between 0 and 59.</returns> val evenSecondsEvent: IEvent<Timers.ElapsedEventArgs>
Multiple items
module Event from Microsoft.FSharp.Control -------------------- type Event<'T> = new: unit -> Event<'T> member Trigger: arg: 'T -> unit member Publish: IEvent<'T> -------------------- type Event<'Delegate,'Args (requires delegate and 'Delegate :> Delegate and reference type)> = new: unit -> Event<'Delegate,'Args> member Trigger: sender: obj * args: 'Args -> unit member Publish: IEvent<'Delegate,'Args> -------------------- new: unit -> Event<'T> -------------------- new: unit -> Event<'Delegate,'Args> val filter: predicate: ('T -> bool) -> sourceEvent: IEvent<'Del,'T> -> IEvent<'T> (requires delegate and 'Del :> Delegate)
member IObservable.Subscribe: callback: ('T -> unit) -> IDisposable
IObservable.Subscribe(observer: IObserver<Timers.ElapsedEventArgs>) : IDisposable val x: Timers.ElapsedEventArgs
val printfn: format: Printf.TextWriterFormat<'T> -> 'T
val ignore: value: 'T -> unit
type Console =
static member Beep: unit -> unit + 1 overload
static member Clear: unit -> unit
static member GetCursorPosition: unit -> struct (int * int)
static member MoveBufferArea: sourceLeft: int * sourceTop: int * sourceWidth: int * sourceHeight: int * targetLeft: int * targetTop: int -> unit + 1 overload
static member OpenStandardError: unit -> Stream + 1 overload
static member OpenStandardInput: unit -> Stream + 1 overload
static member OpenStandardOutput: unit -> Stream + 1 overload
static member Read: unit -> int
static member ReadKey: unit -> ConsoleKeyInfo + 1 overload
static member ReadLine: unit -> string
...
<summary>Represents the standard input, output, and error streams for console applications. This class cannot be inherited.</summary> Console.ReadLine() : string
The sample will only output even seconds: 2/15/2022 12:03:08 AM
2/15/2022 12:03:10 AM
2/15/2022 12:03:12 AM
2/15/2022 12:03:14 AM
|
|
Returns a new event that passes values transformed by the given function.
Example
namespace System
val createTimer: interval: 'a -> IEvent<Timers.ElapsedEventHandler,Timers.ElapsedEventArgs>
val interval: 'a
val timer: Timers.Timer
namespace System.Timers
Multiple items
type Timer = inherit Component interface ISupportInitialize new: unit -> unit + 2 overloads member BeginInit: unit -> unit member Close: unit -> unit member EndInit: unit -> unit member Start: unit -> unit member Stop: unit -> unit member AutoReset: bool member Enabled: bool ... <summary>Generates an event after a set interval, with an option to generate recurring events.</summary> -------------------- Timers.Timer() : Timers.Timer Timers.Timer(interval: float) : Timers.Timer Timers.Timer(interval: TimeSpan) : Timers.Timer property Timers.Timer.AutoReset: bool with get, set
<summary>Gets or sets a Boolean indicating whether the <see cref="T:System.Timers.Timer" /> should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event only once (<see langword="false" />) or repeatedly (<see langword="true" />).</summary> <returns><see langword="true" /> if the <see cref="T:System.Timers.Timer" /> should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event each time the interval elapses; <see langword="false" /> if it should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event only once, after the first time the interval elapses. The default is <see langword="true" />.</returns> property Timers.Timer.Enabled: bool with get, set
<summary>Gets or sets a value indicating whether the <see cref="T:System.Timers.Timer" /> should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event.</summary> <exception cref="T:System.ObjectDisposedException">This property cannot be set because the timer has been disposed.</exception> <exception cref="T:System.ArgumentException">The <see cref="P:System.Timers.Timer.Interval" /> property was set to a value greater than <see cref="F:System.Int32.MaxValue">Int32.MaxValue</see> before the timer was enabled.</exception> <returns><see langword="true" /> if the <see cref="T:System.Timers.Timer" /> should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event; otherwise, <see langword="false" />. The default is <see langword="false" />.</returns> event Timers.Timer.Elapsed: IEvent<Timers.ElapsedEventHandler,Timers.ElapsedEventArgs>
val timer: IEvent<Timers.ElapsedEventHandler,Timers.ElapsedEventArgs>
val transformSeconds: number: Timers.ElapsedEventArgs -> int
val number: Timers.ElapsedEventArgs
Multiple items
type ElapsedEventArgs = inherit EventArgs new: signalTime: DateTime -> unit member SignalTime: DateTime <summary>Provides data for the <see cref="E:System.Timers.Timer.Elapsed" /> event.</summary> -------------------- Timers.ElapsedEventArgs(signalTime: DateTime) : Timers.ElapsedEventArgs property Timers.ElapsedEventArgs.SignalTime: DateTime with get
<summary>Gets the date/time when the <see cref="E:System.Timers.Timer.Elapsed" /> event was raised.</summary> <returns>The time the <see cref="E:System.Timers.Timer.Elapsed" /> event was raised.</returns> property DateTime.Second: int with get
<summary>Gets the seconds component of the date represented by this instance.</summary> <returns>The seconds component, expressed as a value between 0 and 59.</returns> val evenSecondsEvent: IEvent<int>
Multiple items
module Event from Microsoft.FSharp.Control -------------------- type Event<'T> = new: unit -> Event<'T> member Trigger: arg: 'T -> unit member Publish: IEvent<'T> -------------------- type Event<'Delegate,'Args (requires delegate and 'Delegate :> Delegate and reference type)> = new: unit -> Event<'Delegate,'Args> member Trigger: sender: obj * args: 'Args -> unit member Publish: IEvent<'Delegate,'Args> -------------------- new: unit -> Event<'T> -------------------- new: unit -> Event<'Delegate,'Args> val map: mapping: ('T -> 'U) -> sourceEvent: IEvent<'Del,'T> -> IEvent<'U> (requires delegate and 'Del :> Delegate)
member IObservable.Subscribe: callback: ('T -> unit) -> IDisposable
IObservable.Subscribe(observer: IObserver<int>) : IDisposable val x: int
val printf: format: Printf.TextWriterFormat<'T> -> 'T
val ignore: value: 'T -> unit
type Console =
static member Beep: unit -> unit + 1 overload
static member Clear: unit -> unit
static member GetCursorPosition: unit -> struct (int * int)
static member MoveBufferArea: sourceLeft: int * sourceTop: int * sourceWidth: int * sourceHeight: int * targetLeft: int * targetTop: int -> unit + 1 overload
static member OpenStandardError: unit -> Stream + 1 overload
static member OpenStandardInput: unit -> Stream + 1 overload
static member OpenStandardOutput: unit -> Stream + 1 overload
static member Read: unit -> int
static member ReadKey: unit -> ConsoleKeyInfo + 1 overload
static member ReadLine: unit -> string
...
<summary>Represents the standard input, output, and error streams for console applications. This class cannot be inherited.</summary> Console.ReadLine() : string
The sample will transform the seconds if it's even or odd number and the output is: -500 100 -500 100 -500 100
|
|
Fires the output event when either of the input events fire.
Example
namespace System
val createTimer: interval: 'a -> IEvent<Timers.ElapsedEventHandler,Timers.ElapsedEventArgs>
val interval: 'a
val timer: Timers.Timer
namespace System.Timers
Multiple items
type Timer = inherit Component interface ISupportInitialize new: unit -> unit + 2 overloads member BeginInit: unit -> unit member Close: unit -> unit member EndInit: unit -> unit member Start: unit -> unit member Stop: unit -> unit member AutoReset: bool member Enabled: bool ... <summary>Generates an event after a set interval, with an option to generate recurring events.</summary> -------------------- Timers.Timer() : Timers.Timer Timers.Timer(interval: float) : Timers.Timer Timers.Timer(interval: TimeSpan) : Timers.Timer property Timers.Timer.AutoReset: bool with get, set
<summary>Gets or sets a Boolean indicating whether the <see cref="T:System.Timers.Timer" /> should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event only once (<see langword="false" />) or repeatedly (<see langword="true" />).</summary> <returns><see langword="true" /> if the <see cref="T:System.Timers.Timer" /> should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event each time the interval elapses; <see langword="false" /> if it should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event only once, after the first time the interval elapses. The default is <see langword="true" />.</returns> property Timers.Timer.Enabled: bool with get, set
<summary>Gets or sets a value indicating whether the <see cref="T:System.Timers.Timer" /> should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event.</summary> <exception cref="T:System.ObjectDisposedException">This property cannot be set because the timer has been disposed.</exception> <exception cref="T:System.ArgumentException">The <see cref="P:System.Timers.Timer.Interval" /> property was set to a value greater than <see cref="F:System.Int32.MaxValue">Int32.MaxValue</see> before the timer was enabled.</exception> <returns><see langword="true" /> if the <see cref="T:System.Timers.Timer" /> should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event; otherwise, <see langword="false" />. The default is <see langword="false" />.</returns> event Timers.Timer.Elapsed: IEvent<Timers.ElapsedEventHandler,Timers.ElapsedEventArgs>
val oneSecondTimer: IEvent<Timers.ElapsedEventHandler,Timers.ElapsedEventArgs>
val fiveSecondsTimer: IEvent<Timers.ElapsedEventHandler,Timers.ElapsedEventArgs>
val result: IEvent<Timers.ElapsedEventArgs>
Multiple items
module Event from Microsoft.FSharp.Control -------------------- type Event<'T> = new: unit -> Event<'T> member Trigger: arg: 'T -> unit member Publish: IEvent<'T> -------------------- type Event<'Delegate,'Args (requires delegate and 'Delegate :> Delegate and reference type)> = new: unit -> Event<'Delegate,'Args> member Trigger: sender: obj * args: 'Args -> unit member Publish: IEvent<'Delegate,'Args> -------------------- new: unit -> Event<'T> -------------------- new: unit -> Event<'Delegate,'Args> val merge: event1: IEvent<'Del1,'T> -> event2: IEvent<'Del2,'T> -> IEvent<'T> (requires delegate and 'Del1 :> Delegate and delegate and 'Del2 :> Delegate)
member IObservable.Subscribe: callback: ('T -> unit) -> IDisposable
IObservable.Subscribe(observer: IObserver<Timers.ElapsedEventArgs>) : IDisposable val output: Timers.ElapsedEventArgs
val printfn: format: Printf.TextWriterFormat<'T> -> 'T
property Timers.ElapsedEventArgs.SignalTime: DateTime with get
<summary>Gets the date/time when the <see cref="E:System.Timers.Timer.Elapsed" /> event was raised.</summary> <returns>The time the <see cref="E:System.Timers.Timer.Elapsed" /> event was raised.</returns> val ignore: value: 'T -> unit
type Console =
static member Beep: unit -> unit + 1 overload
static member Clear: unit -> unit
static member GetCursorPosition: unit -> struct (int * int)
static member MoveBufferArea: sourceLeft: int * sourceTop: int * sourceWidth: int * sourceHeight: int * targetLeft: int * targetTop: int -> unit + 1 overload
static member OpenStandardError: unit -> Stream + 1 overload
static member OpenStandardInput: unit -> Stream + 1 overload
static member OpenStandardOutput: unit -> Stream + 1 overload
static member Read: unit -> int
static member ReadKey: unit -> ConsoleKeyInfo + 1 overload
static member ReadLine: unit -> string
...
<summary>Represents the standard input, output, and error streams for console applications. This class cannot be inherited.</summary> Console.ReadLine() : string
The sample will output: Output - 2/15/2022 12:10:40 AM
Output - 2/15/2022 12:10:41 AM
Output - 2/15/2022 12:10:41 AM
Output - 2/15/2022 12:10:42 AM
Output - 2/15/2022 12:10:43 AM
|
|
Returns a new event that triggers on the second and subsequent triggerings of the input event. The Nth triggering of the input event passes the arguments from the N-1th and Nth triggering as a pair. The argument passed to the N-1th triggering is held in hidden internal state until the Nth triggering occurs.
Example
namespace System
val createTimer: interval: 'a -> IEvent<Timers.ElapsedEventHandler,Timers.ElapsedEventArgs>
val interval: 'a
val timer: Timers.Timer
namespace System.Timers
Multiple items
type Timer = inherit Component interface ISupportInitialize new: unit -> unit + 2 overloads member BeginInit: unit -> unit member Close: unit -> unit member EndInit: unit -> unit member Start: unit -> unit member Stop: unit -> unit member AutoReset: bool member Enabled: bool ... <summary>Generates an event after a set interval, with an option to generate recurring events.</summary> -------------------- Timers.Timer() : Timers.Timer Timers.Timer(interval: float) : Timers.Timer Timers.Timer(interval: TimeSpan) : Timers.Timer property Timers.Timer.AutoReset: bool with get, set
<summary>Gets or sets a Boolean indicating whether the <see cref="T:System.Timers.Timer" /> should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event only once (<see langword="false" />) or repeatedly (<see langword="true" />).</summary> <returns><see langword="true" /> if the <see cref="T:System.Timers.Timer" /> should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event each time the interval elapses; <see langword="false" /> if it should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event only once, after the first time the interval elapses. The default is <see langword="true" />.</returns> property Timers.Timer.Enabled: bool with get, set
<summary>Gets or sets a value indicating whether the <see cref="T:System.Timers.Timer" /> should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event.</summary> <exception cref="T:System.ObjectDisposedException">This property cannot be set because the timer has been disposed.</exception> <exception cref="T:System.ArgumentException">The <see cref="P:System.Timers.Timer.Interval" /> property was set to a value greater than <see cref="F:System.Int32.MaxValue">Int32.MaxValue</see> before the timer was enabled.</exception> <returns><see langword="true" /> if the <see cref="T:System.Timers.Timer" /> should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event; otherwise, <see langword="false" />. The default is <see langword="false" />.</returns> event Timers.Timer.Elapsed: IEvent<Timers.ElapsedEventHandler,Timers.ElapsedEventArgs>
val timer: IEvent<Timers.ElapsedEventHandler,Timers.ElapsedEventArgs>
val pairWise: IEvent<Timers.ElapsedEventArgs * Timers.ElapsedEventArgs>
Multiple items
module Event from Microsoft.FSharp.Control -------------------- type Event<'T> = new: unit -> Event<'T> member Trigger: arg: 'T -> unit member Publish: IEvent<'T> -------------------- type Event<'Delegate,'Args (requires delegate and 'Delegate :> Delegate and reference type)> = new: unit -> Event<'Delegate,'Args> member Trigger: sender: obj * args: 'Args -> unit member Publish: IEvent<'Delegate,'Args> -------------------- new: unit -> Event<'T> -------------------- new: unit -> Event<'Delegate,'Args> val pairwise: sourceEvent: IEvent<'Del,'T> -> IEvent<'T * 'T> (requires delegate and 'Del :> Delegate)
val extractPair: Timers.ElapsedEventArgs * Timers.ElapsedEventArgs -> unit
val pair: Timers.ElapsedEventArgs * Timers.ElapsedEventArgs
Multiple items
type ElapsedEventArgs = inherit EventArgs new: signalTime: DateTime -> unit member SignalTime: DateTime <summary>Provides data for the <see cref="E:System.Timers.Timer.Elapsed" /> event.</summary> -------------------- Timers.ElapsedEventArgs(signalTime: DateTime) : Timers.ElapsedEventArgs val leftPair: Timers.ElapsedEventArgs
val rightPair: Timers.ElapsedEventArgs
val printfn: format: Printf.TextWriterFormat<'T> -> 'T
property Timers.ElapsedEventArgs.SignalTime: DateTime with get
<summary>Gets the date/time when the <see cref="E:System.Timers.Timer.Elapsed" /> event was raised.</summary> <returns>The time the <see cref="E:System.Timers.Timer.Elapsed" /> event was raised.</returns> member IObservable.Subscribe: callback: ('T -> unit) -> IDisposable
IObservable.Subscribe(observer: IObserver<Timers.ElapsedEventArgs * Timers.ElapsedEventArgs>) : IDisposable val ignore: value: 'T -> unit
type Console =
static member Beep: unit -> unit + 1 overload
static member Clear: unit -> unit
static member GetCursorPosition: unit -> struct (int * int)
static member MoveBufferArea: sourceLeft: int * sourceTop: int * sourceWidth: int * sourceHeight: int * targetLeft: int * targetTop: int -> unit + 1 overload
static member OpenStandardError: unit -> Stream + 1 overload
static member OpenStandardInput: unit -> Stream + 1 overload
static member OpenStandardOutput: unit -> Stream + 1 overload
static member Read: unit -> int
static member ReadKey: unit -> ConsoleKeyInfo + 1 overload
static member ReadLine: unit -> string
...
<summary>Represents the standard input, output, and error streams for console applications. This class cannot be inherited.</summary> Console.ReadLine() : string
The sample will output the timer event every second:
(Left): 2/14/2022 11:58:46 PM (Right): 2/14/2022 11:58:46 PM
(Left): 2/14/2022 11:58:46 PM (Right): 2/14/2022 11:58:47 PM
(Left): 2/14/2022 11:58:47 PM (Right): 2/14/2022 11:58:48 PM
|
Full Usage:
Event.partition predicate sourceEvent
Parameters:
'T -> bool
-
The function to determine which output event to trigger.
sourceEvent : IEvent<'Del, 'T>
-
The input event.
Returns: IEvent<'T> * IEvent<'T>
A tuple of events. The first is triggered when the predicate evaluates to true
and the second when the predicate evaluates to false.
|
Returns a new event that listens to the original event and triggers the first resulting event if the application of the predicate to the event arguments returned true, and the second event if it returned false.
Example
namespace System
val createTimer: interval: 'a -> IEvent<Timers.ElapsedEventHandler,Timers.ElapsedEventArgs>
val interval: 'a
val timer: Timers.Timer
namespace System.Timers
Multiple items
type Timer = inherit Component interface ISupportInitialize new: unit -> unit + 2 overloads member BeginInit: unit -> unit member Close: unit -> unit member EndInit: unit -> unit member Start: unit -> unit member Stop: unit -> unit member AutoReset: bool member Enabled: bool ... <summary>Generates an event after a set interval, with an option to generate recurring events.</summary> -------------------- Timers.Timer() : Timers.Timer Timers.Timer(interval: float) : Timers.Timer Timers.Timer(interval: TimeSpan) : Timers.Timer property Timers.Timer.AutoReset: bool with get, set
<summary>Gets or sets a Boolean indicating whether the <see cref="T:System.Timers.Timer" /> should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event only once (<see langword="false" />) or repeatedly (<see langword="true" />).</summary> <returns><see langword="true" /> if the <see cref="T:System.Timers.Timer" /> should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event each time the interval elapses; <see langword="false" /> if it should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event only once, after the first time the interval elapses. The default is <see langword="true" />.</returns> property Timers.Timer.Enabled: bool with get, set
<summary>Gets or sets a value indicating whether the <see cref="T:System.Timers.Timer" /> should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event.</summary> <exception cref="T:System.ObjectDisposedException">This property cannot be set because the timer has been disposed.</exception> <exception cref="T:System.ArgumentException">The <see cref="P:System.Timers.Timer.Interval" /> property was set to a value greater than <see cref="F:System.Int32.MaxValue">Int32.MaxValue</see> before the timer was enabled.</exception> <returns><see langword="true" /> if the <see cref="T:System.Timers.Timer" /> should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event; otherwise, <see langword="false" />. The default is <see langword="false" />.</returns> event Timers.Timer.Elapsed: IEvent<Timers.ElapsedEventHandler,Timers.ElapsedEventArgs>
val timer: IEvent<Timers.ElapsedEventHandler,Timers.ElapsedEventArgs>
val getEvenSeconds: number: Timers.ElapsedEventArgs -> bool
val number: Timers.ElapsedEventArgs
Multiple items
type ElapsedEventArgs = inherit EventArgs new: signalTime: DateTime -> unit member SignalTime: DateTime <summary>Provides data for the <see cref="E:System.Timers.Timer.Elapsed" /> event.</summary> -------------------- Timers.ElapsedEventArgs(signalTime: DateTime) : Timers.ElapsedEventArgs property Timers.ElapsedEventArgs.SignalTime: DateTime with get
<summary>Gets the date/time when the <see cref="E:System.Timers.Timer.Elapsed" /> event was raised.</summary> <returns>The time the <see cref="E:System.Timers.Timer.Elapsed" /> event was raised.</returns> property DateTime.Second: int with get
<summary>Gets the seconds component of the date represented by this instance.</summary> <returns>The seconds component, expressed as a value between 0 and 59.</returns> val leftPartition: IEvent<Timers.ElapsedEventArgs>
val rightPartition: IEvent<Timers.ElapsedEventArgs>
Multiple items
module Event from Microsoft.FSharp.Control -------------------- type Event<'T> = new: unit -> Event<'T> member Trigger: arg: 'T -> unit member Publish: IEvent<'T> -------------------- type Event<'Delegate,'Args (requires delegate and 'Delegate :> Delegate and reference type)> = new: unit -> Event<'Delegate,'Args> member Trigger: sender: obj * args: 'Args -> unit member Publish: IEvent<'Delegate,'Args> -------------------- new: unit -> Event<'T> -------------------- new: unit -> Event<'Delegate,'Args> val partition: predicate: ('T -> bool) -> sourceEvent: IEvent<'Del,'T> -> IEvent<'T> * IEvent<'T> (requires delegate and 'Del :> Delegate)
member IObservable.Subscribe: callback: ('T -> unit) -> IDisposable
IObservable.Subscribe(observer: IObserver<Timers.ElapsedEventArgs>) : IDisposable val x: Timers.ElapsedEventArgs
val printfn: format: Printf.TextWriterFormat<'T> -> 'T
val ignore: value: 'T -> unit
type Console =
static member Beep: unit -> unit + 1 overload
static member Clear: unit -> unit
static member GetCursorPosition: unit -> struct (int * int)
static member MoveBufferArea: sourceLeft: int * sourceTop: int * sourceWidth: int * sourceHeight: int * targetLeft: int * targetTop: int -> unit + 1 overload
static member OpenStandardError: unit -> Stream + 1 overload
static member OpenStandardInput: unit -> Stream + 1 overload
static member OpenStandardOutput: unit -> Stream + 1 overload
static member Read: unit -> int
static member ReadKey: unit -> ConsoleKeyInfo + 1 overload
static member ReadLine: unit -> string
...
<summary>Represents the standard input, output, and error streams for console applications. This class cannot be inherited.</summary> Console.ReadLine() : string
The sample will partition into two events if it is even or odd seconds:
Right partition: 2/15/2022 12:00:27 AM
Left partition: 2/15/2022 12:00:28 AM
Right partition: 2/15/2022 12:00:29 AM
Left partition: 2/15/2022 12:00:30 AM
Right partition: 2/15/2022 12:00:31 AM
|
|
Returns a new event consisting of the results of applying the given accumulating function to successive values triggered on the input event. An item of internal state records the current value of the state parameter. The internal state is not locked during the execution of the accumulation function, so care should be taken that the input IEvent not triggered by multiple threads simultaneously.
Example
namespace System
val createTimer: interval: 'a -> IEvent<Timers.ElapsedEventHandler,Timers.ElapsedEventArgs>
val interval: 'a
val timer: Timers.Timer
namespace System.Timers
Multiple items
type Timer = inherit Component interface ISupportInitialize new: unit -> unit + 2 overloads member BeginInit: unit -> unit member Close: unit -> unit member EndInit: unit -> unit member Start: unit -> unit member Stop: unit -> unit member AutoReset: bool member Enabled: bool ... <summary>Generates an event after a set interval, with an option to generate recurring events.</summary> -------------------- Timers.Timer() : Timers.Timer Timers.Timer(interval: float) : Timers.Timer Timers.Timer(interval: TimeSpan) : Timers.Timer property Timers.Timer.AutoReset: bool with get, set
<summary>Gets or sets a Boolean indicating whether the <see cref="T:System.Timers.Timer" /> should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event only once (<see langword="false" />) or repeatedly (<see langword="true" />).</summary> <returns><see langword="true" /> if the <see cref="T:System.Timers.Timer" /> should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event each time the interval elapses; <see langword="false" /> if it should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event only once, after the first time the interval elapses. The default is <see langword="true" />.</returns> property Timers.Timer.Enabled: bool with get, set
<summary>Gets or sets a value indicating whether the <see cref="T:System.Timers.Timer" /> should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event.</summary> <exception cref="T:System.ObjectDisposedException">This property cannot be set because the timer has been disposed.</exception> <exception cref="T:System.ArgumentException">The <see cref="P:System.Timers.Timer.Interval" /> property was set to a value greater than <see cref="F:System.Int32.MaxValue">Int32.MaxValue</see> before the timer was enabled.</exception> <returns><see langword="true" /> if the <see cref="T:System.Timers.Timer" /> should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event; otherwise, <see langword="false" />. The default is <see langword="false" />.</returns> event Timers.Timer.Elapsed: IEvent<Timers.ElapsedEventHandler,Timers.ElapsedEventArgs>
val timer: IEvent<Timers.ElapsedEventHandler,Timers.ElapsedEventArgs>
val multiplyBy: number: int -> timerEvent: Timers.ElapsedEventArgs -> int
val number: int
val timerEvent: Timers.ElapsedEventArgs
Multiple items
type ElapsedEventArgs = inherit EventArgs new: signalTime: DateTime -> unit member SignalTime: DateTime <summary>Provides data for the <see cref="E:System.Timers.Timer.Elapsed" /> event.</summary> -------------------- Timers.ElapsedEventArgs(signalTime: DateTime) : Timers.ElapsedEventArgs property Timers.ElapsedEventArgs.SignalTime: DateTime with get
<summary>Gets the date/time when the <see cref="E:System.Timers.Timer.Elapsed" /> event was raised.</summary> <returns>The time the <see cref="E:System.Timers.Timer.Elapsed" /> event was raised.</returns> val initialState: int
val scan: IEvent<int>
Multiple items
module Event from Microsoft.FSharp.Control -------------------- type Event<'T> = new: unit -> Event<'T> member Trigger: arg: 'T -> unit member Publish: IEvent<'T> -------------------- type Event<'Delegate,'Args (requires delegate and 'Delegate :> Delegate and reference type)> = new: unit -> Event<'Delegate,'Args> member Trigger: sender: obj * args: 'Args -> unit member Publish: IEvent<'Delegate,'Args> -------------------- new: unit -> Event<'T> -------------------- new: unit -> Event<'Delegate,'Args> val scan: collector: ('U -> 'T -> 'U) -> state: 'U -> sourceEvent: IEvent<'Del,'T> -> IEvent<'U> (requires delegate and 'Del :> Delegate)
member IObservable.Subscribe: callback: ('T -> unit) -> IDisposable
IObservable.Subscribe(observer: IObserver<int>) : IDisposable val x: int
val printf: format: Printf.TextWriterFormat<'T> -> 'T
val ignore: value: 'T -> unit
type Console =
static member Beep: unit -> unit + 1 overload
static member Clear: unit -> unit
static member GetCursorPosition: unit -> struct (int * int)
static member MoveBufferArea: sourceLeft: int * sourceTop: int * sourceWidth: int * sourceHeight: int * targetLeft: int * targetTop: int -> unit + 1 overload
static member OpenStandardError: unit -> Stream + 1 overload
static member OpenStandardInput: unit -> Stream + 1 overload
static member OpenStandardOutput: unit -> Stream + 1 overload
static member Read: unit -> int
static member ReadKey: unit -> ConsoleKeyInfo + 1 overload
static member ReadLine: unit -> string
...
<summary>Represents the standard input, output, and error streams for console applications. This class cannot be inherited.</summary> Console.ReadLine() : string
The sample will output depending on your timestamp. It will multiply the seconds with an initial state of 2: 106 5724 314820 17629920 1004905440 -1845026624 -1482388416
|
Full Usage:
Event.split splitter sourceEvent
Parameters:
'T -> Choice<'U1, 'U2>
-
The function to transform event values into one of two types.
sourceEvent : IEvent<'Del, 'T>
-
The input event.
Returns: IEvent<'U1> * IEvent<'U2>
A tuple of events. The first fires whenever splitter evaluates to Choice1of1 and
the second fires whenever splitter evaluates to Choice2of2.
|
Returns a new event that listens to the original event and triggers the first resulting event if the application of the function to the event arguments returned a Choice1Of2, and the second event if it returns a Choice2Of2.
Example
namespace System
val createTimer: interval: 'a -> IEvent<Timers.ElapsedEventHandler,Timers.ElapsedEventArgs>
val interval: 'a
val timer: Timers.Timer
namespace System.Timers
Multiple items
type Timer = inherit Component interface ISupportInitialize new: unit -> unit + 2 overloads member BeginInit: unit -> unit member Close: unit -> unit member EndInit: unit -> unit member Start: unit -> unit member Stop: unit -> unit member AutoReset: bool member Enabled: bool ... <summary>Generates an event after a set interval, with an option to generate recurring events.</summary> -------------------- Timers.Timer() : Timers.Timer Timers.Timer(interval: float) : Timers.Timer Timers.Timer(interval: TimeSpan) : Timers.Timer property Timers.Timer.AutoReset: bool with get, set
<summary>Gets or sets a Boolean indicating whether the <see cref="T:System.Timers.Timer" /> should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event only once (<see langword="false" />) or repeatedly (<see langword="true" />).</summary> <returns><see langword="true" /> if the <see cref="T:System.Timers.Timer" /> should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event each time the interval elapses; <see langword="false" /> if it should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event only once, after the first time the interval elapses. The default is <see langword="true" />.</returns> property Timers.Timer.Enabled: bool with get, set
<summary>Gets or sets a value indicating whether the <see cref="T:System.Timers.Timer" /> should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event.</summary> <exception cref="T:System.ObjectDisposedException">This property cannot be set because the timer has been disposed.</exception> <exception cref="T:System.ArgumentException">The <see cref="P:System.Timers.Timer.Interval" /> property was set to a value greater than <see cref="F:System.Int32.MaxValue">Int32.MaxValue</see> before the timer was enabled.</exception> <returns><see langword="true" /> if the <see cref="T:System.Timers.Timer" /> should raise the <see cref="E:System.Timers.Timer.Elapsed" /> event; otherwise, <see langword="false" />. The default is <see langword="false" />.</returns> event Timers.Timer.Elapsed: IEvent<Timers.ElapsedEventHandler,Timers.ElapsedEventArgs>
val timer: IEvent<Timers.ElapsedEventHandler,Timers.ElapsedEventArgs>
val bySeconds: timerEvent: Timers.ElapsedEventArgs -> Choice<int,string>
val timerEvent: Timers.ElapsedEventArgs
Multiple items
type ElapsedEventArgs = inherit EventArgs new: signalTime: DateTime -> unit member SignalTime: DateTime <summary>Provides data for the <see cref="E:System.Timers.Timer.Elapsed" /> event.</summary> -------------------- Timers.ElapsedEventArgs(signalTime: DateTime) : Timers.ElapsedEventArgs property Timers.ElapsedEventArgs.SignalTime: DateTime with get
<summary>Gets the date/time when the <see cref="E:System.Timers.Timer.Elapsed" /> event was raised.</summary> <returns>The time the <see cref="E:System.Timers.Timer.Elapsed" /> event was raised.</returns> property DateTime.Second: int with get
<summary>Gets the seconds component of the date represented by this instance.</summary> <returns>The seconds component, expressed as a value between 0 and 59.</returns> union case Choice.Choice1Of2: 'T1 -> Choice<'T1,'T2>
union case Choice.Choice2Of2: 'T2 -> Choice<'T1,'T2>
val evenSplit: IEvent<int>
val printOddNumbers: IEvent<string>
Multiple items
module Event from Microsoft.FSharp.Control -------------------- type Event<'T> = new: unit -> Event<'T> member Trigger: arg: 'T -> unit member Publish: IEvent<'T> -------------------- type Event<'Delegate,'Args (requires delegate and 'Delegate :> Delegate and reference type)> = new: unit -> Event<'Delegate,'Args> member Trigger: sender: obj * args: 'Args -> unit member Publish: IEvent<'Delegate,'Args> -------------------- new: unit -> Event<'T> -------------------- new: unit -> Event<'Delegate,'Args> val split: splitter: ('T -> Choice<'U1,'U2>) -> sourceEvent: IEvent<'Del,'T> -> IEvent<'U1> * IEvent<'U2> (requires delegate and 'Del :> Delegate)
val printOutput: event: IEvent<'a,'b> -> functionName: 'c -> unit (requires delegate and 'a :> Delegate)
val event: IEvent<'a,'b> (requires delegate and 'a :> Delegate)
val functionName: 'c
val add: callback: ('T -> unit) -> sourceEvent: IEvent<'Del,'T> -> unit (requires delegate and 'Del :> Delegate)
val output: 'b
val printfn: format: Printf.TextWriterFormat<'T> -> 'T
val nameof: 'T -> string
val ignore: value: 'T -> unit
type Console =
static member Beep: unit -> unit + 1 overload
static member Clear: unit -> unit
static member GetCursorPosition: unit -> struct (int * int)
static member MoveBufferArea: sourceLeft: int * sourceTop: int * sourceWidth: int * sourceHeight: int * targetLeft: int * targetTop: int -> unit + 1 overload
static member OpenStandardError: unit -> Stream + 1 overload
static member OpenStandardInput: unit -> Stream + 1 overload
static member OpenStandardOutput: unit -> Stream + 1 overload
static member Read: unit -> int
static member ReadKey: unit -> ConsoleKeyInfo + 1 overload
static member ReadLine: unit -> string
...
<summary>Represents the standard input, output, and error streams for console applications. This class cannot be inherited.</summary> Console.ReadLine() : string
The sample will split the events by even or odd seconds: evenSplit - Split output: 44. Type: System.Int32
printOddNumbers - Split output: 45 is not an even number. Type: System.String
evenSplit - Split output: 46. Type: System.Int32
printOddNumbers - Split output: 47 is not an even number. Type: System.String
evenSplit - Split output: 48. Type: System.Int32
printOddNumbers - Split output: 49 is not an even number. Type: System.String
|