Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function HippyDippy-Clock {
- param (
- [string]$Name,
- [Int]$Row,
- [Int]$Column,
- [Int]$RowSpan,
- [Int]$ColumnSpan,
- [Int]$Width,
- [Int]$Height,
- [Double]$Top,
- [Double]$Left,
- [Windows.Controls.Dock]$Dock,
- [Switch]$Show,
- [Switch]$AsJob
- )
- begin {ipmo showui}
- process {
- if (-not $psBoundParameters.Background) {
- $psBoundParameters.Background = 'Transparent'
- }
- $uiParameters = @{} + $psBoundParameters
- Border @uiParameters -On_Loaded {
- $this.Child = Grid -Columns 150, 300* {
- Image -Source "http://weaselzippers.us/wp-content/uploads/2011/05/hippie.jpg" -Column 0
- Label -Name Target -FontSize 90 -Column 1 `
- -FontFamily "Impact, Arial" -FontWeight 800 -Foreground (
- LinearGradientBrush $(
- GradientStop -Color Red -Offset 1
- GradientStop -Color Orange -Offset 0.85
- GradientStop -Color Yellow -Offset 0.7
- GradientStop -Color Green -Offset 0.55
- GradientStop -Color Blue -Offset 0.4
- GradientStop -Color Indigo -Offset 0.2
- GradientStop -Color Violet -Offset 0
- )
- )
- }
- $this.DataContext = Get-PowerShellDataSource -On_OutputChanged {
- $output = Get-PowerShellOutput -Last -OutputOnly
- $Target.Content = $output
- } -Script {
- while ($true) {
- (Get-Date).ToString('T'); Start-Sleep -Seconds 1
- }
- }
- } -On_Initialized {
- $window.SizeToContent = 'WidthAndHeight'
- $window.WindowStyle = 'None'
- $window.Background = 'Transparent'
- $window.AllowsTransparency = $true
- $window.WindowStartupLocation = 'CenterScreen'
- Add-EventHandler -EventName "On_Closing" -Handler {
- if ($this.Content.DataContext.Command.Stop) {
- $this.Content.DataContext.Command.Stop()
- }
- } -Object $window
- # When the right mouse button is down, close the control
- Add-EventHandler -EventName "On_PreviewMouseRightButtonDown" -Handler {
- $_.Handled = $true
- Close-Control
- } -Object $window
- Add-EventHandler -EventName "On_PreviewMouseLeftButtonDown" -Handler {
- $_.Handled = $true
- $this.DragMove()
- } -Object $window
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment