Skip to main content

CoolClock

Namespace: Wisej.Web.Ext.CoolClock

Assembly: Wisej.Web.Ext.CoolClock (4.1.0.0)

Represents an analog clock control based on the CoolClock JavaScript library (coolclock), rendered on an HTML canvas.

public class CoolClock : Widget

The clock face is always round; its radius is half of the smaller of Width and Height and it is centered horizontally. The time displayed is the browser's time, optionally shifted using GmtOffset.

Example:

Adding a clock showing the time in Tokyo to a page:

var clock = new CoolClock
{
Size = new Size(200, 200),
Skin = CoolClockSkin.Classic,
ShowDigital = true,
GmtOffset = 9
};
this.Controls.Add(clock);

Constructors​

Instance member CoolClock()​

Initializes a new instance of the CoolClock control.

Properties​

Instance member ClockType​

CoolClockType: Returns or sets the type of clock to render. (Default: Standard)

Logarithmic and LogarithmicReversed draw the hands and tick marks on a logarithmic scale instead of the standard linear dial.

Instance member GmtOffset​

Int32: Returns or sets the offset from GMT, in hours, of the time displayed by the clock. (Default: 0)

When the value is not 0, the clock shows the UTC time plus the specified number of hours. When the value is 0 (the default), the clock shows the local time of the browser, not the GMT time.

Example:

Displaying clocks for different time zones:

this.clockNewYork.GmtOffset = -5;
this.clockBerlin.GmtOffset = 1;
this.clockLocal.GmtOffset = 0; // browser's local time.

Instance member InitScript​

String: Returns the initialization script that creates the clock on the client.

The script is loaded from the embedded resource startup.js and cannot be changed; the setter is ignored.

Instance member LongTickDelay​

Int32: Returns or sets the interval in milliseconds between redraws of the clock when ShowSecondHand is false. (Default: 15000)

When ShowSecondHand is true, TickDelay is used instead. The default is 15000 (15 seconds).

Instance member Options​

Object: Returns the options object sent to the client-side CoolClock instance.

The options are built from the Skin, TickDelay, LongTickDelay, ShowSecondHand, ShowDigital, GmtOffset and ClockType properties and the current size of the control. The setter is ignored; use the individual properties instead.

Instance member Packages​

List<Package>: Returns the list of packages (the coolclock.js library) loaded on the client before the clock is created.

Instance member ShowDigital​

Boolean: Returns or sets whether the time is also displayed in digital format inside the clock face. (Default: False)

Instance member ShowSecondHand​

Boolean: Returns or sets whether the clock displays the second hand. (Default: True)

This property also determines whether the clock is redrawn every TickDelay or every LongTickDelay milliseconds.

Instance member Skin​

CoolClockSkin: Returns or sets the skin used to render the clock. (Default: ChunkySwiss)

See CoolClockSkin for the available skins. The default is ChunkySwiss.

Instance member TickDelay​

Int32: Returns or sets the interval in milliseconds between redraws of the clock when ShowSecondHand is true. (Default: 1000)

When ShowSecondHand is false, LongTickDelay is used instead. The default is 1000 (one second).

Example:

Setting the redraw intervals for both modes:

this.coolClock1.TickDelay = 1000; // redraw every second with the second hand.
this.coolClock1.LongTickDelay = 30000; // redraw every 30 seconds without it.

Implements​