PoshCode Archive  Artifact Content

Artifact f99e87e1e26fa4c1a45e7ac45acc880cc04e14ce2d878dc5eee4fe5cb0dd1158:

  • File ShowUI-Clock-6.ps1 — part of check-in [a4719dea5a] at 2018-06-10 13:27:33 on branch trunk — This clock is digital. No fancy sweeping movements and animations here, but you do get to see the date and day of the week, and you can easily play with fonts and colors to suit your desktop … (user: Joel Bennett size: 1791)

# encoding: ascii
# api: powershell
# title: ShowUI Clock 6
# description: This clock is digital.  No fancy sweeping movements and animations here, but you do get to see the date and day of the week, and you can easily play with fonts and colors to suit your desktop …
# version: 0.6
# author: Joel Bennett
# license: CC0
# x-poshcode-id: 3553
# x-archived: 2012-08-04T23:31:13
# x-published: 2012-07-30T13:28:00
#
#
New-UIWidget -AsJob -Content {
    $shadow = DropShadowEffect -Color Black -Shadow 0 -Blur 8
    $now = Get-Date;
    StackPanel {
        TextBlock -Name "Time" ('{0:h:mm tt}' -f $now) -FontSize 108 -LineHeight 100 -LineStackingStrategy BlockLineHeight -Margin 0 -Padding 0 -Foreground White -Effect $shadow -FontFamily "Century Gothic"
        StackPanel -Orientation Horizontal {
            TextBlock -Name "Day" ('{0:dd}' -f $now) -FontSize 80 -LineHeight 80 -LineStackingStrategy BlockLineHeight -Margin 0 -Padding 0 -Foreground White -Opacity 0.6 -Effect $shadow -FontFamily "Century Gothic"
            StackPanel {
                TextBlock -Name "Month" ('{0:MMMM}' -f $now).ToUpper() -fontsize 40 -LineHeight 40 -LineStackingStrategy BlockLineHeight -Margin 0 -Padding 0 -FontFamily "Century Gothic"
                TextBlock -Name "Weekday" ('{0:dddd}' -f $now).ToUpper() -fontsize 28 -LineHeight 28 -LineStackingStrategy BlockLineHeight -Margin 0 -Padding 0 -Foreground White -Effect $shadow -FontFamily "Century Gothic"
            } -Margin 0
        } -Margin 0
    } -Margin 0
} -Interval "0:0:0.2" -UpdateBlock {
    $now = Get-Date

    $Time.Text    =  '{0:h:mm tt}' -f $now
    $Day.Text     =  '{0:dd}'   -f $now
    $Month.Text   = ('{0:MMMM}' -f $now).ToUpper()
    $Weekday.Text = ('{0:dddd}' -f $now).ToUpper()
}