Forced BufferStarted notification to pop up on the screen that is being recorded so the user knows which one to have the application on

This commit is contained in:
2026-03-30 14:38:41 -07:00
parent a7fbf3bc22
commit 03f94296ae

View File

@@ -25,6 +25,7 @@ $ErrorActionPreference = 'Stop'
Add-Type -AssemblyName PresentationFramework Add-Type -AssemblyName PresentationFramework
Add-Type -AssemblyName WindowsBase Add-Type -AssemblyName WindowsBase
Add-Type -AssemblyName System.Drawing Add-Type -AssemblyName System.Drawing
Add-Type -AssemblyName System.Windows.Forms
Add-Type -TypeDefinition @" Add-Type -TypeDefinition @"
using System; using System;
@@ -54,7 +55,7 @@ if ($Type -eq 'BufferStarted') {
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="IT Screen Recorder" SizeToContent="Height" Width="440" Title="IT Screen Recorder" SizeToContent="Height" Width="440"
WindowStartupLocation="CenterScreen" ResizeMode="NoResize" WindowStartupLocation="Manual" ResizeMode="NoResize"
Topmost="True" ShowInTaskbar="False"> Topmost="True" ShowInTaskbar="False">
<Grid Margin="20"> <Grid Margin="20">
<Grid.RowDefinitions> <Grid.RowDefinitions>
@@ -92,7 +93,11 @@ if ($Type -eq 'BufferStarted') {
$imgTray.Source = $wpfShield $imgTray.Source = $wpfShield
$txtContact.Text = "Questions? Contact IT at $ContactNumber" $txtContact.Text = "Questions? Contact IT at $ContactNumber"
$txtBody.Inlines.Add("Your screen is being recorded into a rolling $BufferMinutes-minute replay buffer. Nothing is saved until you request it.`n`nTo save a clip, ") $txtBody.Inlines.Add("Your screen is being recorded into a rolling $BufferMinutes-minute replay buffer. Nothing is saved until you request it.`n`n")
$bold0 = New-Object System.Windows.Documents.Run('Open the application you want to capture on this screen.')
$bold0.FontWeight = [System.Windows.FontWeights]::Bold
$txtBody.Inlines.Add($bold0)
$txtBody.Inlines.Add("`n`nTo save a clip, ")
$bold1 = New-Object System.Windows.Documents.Run('right-click the shield icon') $bold1 = New-Object System.Windows.Documents.Run('right-click the shield icon')
$bold1.FontWeight = [System.Windows.FontWeights]::Bold $bold1.FontWeight = [System.Windows.FontWeights]::Bold
$txtBody.Inlines.Add($bold1) $txtBody.Inlines.Add($bold1)
@@ -107,7 +112,7 @@ if ($Type -eq 'BufferStarted') {
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="IT Screen Recorder" SizeToContent="Height" Width="440" Title="IT Screen Recorder" SizeToContent="Height" Width="440"
WindowStartupLocation="CenterScreen" ResizeMode="NoResize" WindowStartupLocation="Manual" ResizeMode="NoResize"
Topmost="True" ShowInTaskbar="False"> Topmost="True" ShowInTaskbar="False">
<Grid Margin="20"> <Grid Margin="20">
<Grid.RowDefinitions> <Grid.RowDefinitions>
@@ -164,4 +169,10 @@ if ($Type -eq 'ReplaySaved') {
$btnOK.Content = 'OK' $btnOK.Content = 'OK'
$btnOK.Add_Click({ $window.Close() }.GetNewClosure()) $btnOK.Add_Click({ $window.Close() }.GetNewClosure())
} }
# Center on the primary monitor (the one OBS is recording)
$screen = [System.Windows.Forms.Screen]::PrimaryScreen.Bounds
$window.Add_Loaded({
$window.Left = $screen.Left + ($screen.Width - $window.ActualWidth) / 2
$window.Top = $screen.Top + ($screen.Height - $window.ActualHeight) / 2
}.GetNewClosure())
$window.ShowDialog() | Out-Null $window.ShowDialog() | Out-Null