48 lines
2.5 KiB
PowerShell
48 lines
2.5 KiB
PowerShell
# Temporary WinForms workload matching the GTK response marker and geometry.
|
|
$ErrorActionPreference='Stop'
|
|
Add-Type -ReferencedAssemblies System.Windows.Forms,System.Drawing -TypeDefinition @'
|
|
using System;
|
|
using System.Drawing;
|
|
using System.Windows.Forms;
|
|
using System.Runtime.InteropServices;
|
|
public class VDIResponseReference : Form {
|
|
[DllImport("user32.dll")] public static extern bool SetProcessDPIAware();
|
|
int seq=0, mode=0;
|
|
readonly TextBox entry=new TextBox();
|
|
readonly Timer expiry=new Timer();
|
|
public VDIResponseReference() {
|
|
Text="VDI temporary response reference"; FormBorderStyle=FormBorderStyle.None;
|
|
Bounds=Screen.PrimaryScreen.Bounds; TopMost=true; DoubleBuffered=true; KeyPreview=true;
|
|
entry.Bounds=new Rectangle(900,850,600,70); entry.Font=new Font("Arial",28);
|
|
entry.UseSystemPasswordChar=true;
|
|
entry.TextChanged+=delegate { if(mode==3) {seq=entry.TextLength; Invalidate();} };
|
|
entry.KeyDown+=delegate(object sender,KeyEventArgs e) { if(mode==3 && e.KeyCode==Keys.Enter) {seq=1000+entry.TextLength; Invalidate(); e.SuppressKeyPress=true;} };
|
|
Controls.Add(entry);
|
|
for(int i=0;i<2;i++) {
|
|
var b=new Button(); b.Text="Application "+(i+1); b.Bounds=new Rectangle(600+i*1000,450,300,250);
|
|
b.MouseEnter+=delegate {if(mode==1) {seq++; Invalidate();}};
|
|
b.Click+=delegate {if(mode==2) {seq++; Invalidate();}};
|
|
Controls.Add(b);
|
|
}
|
|
expiry.Interval=600000; expiry.Tick+=delegate {Close();}; expiry.Start();
|
|
}
|
|
protected override bool ProcessCmdKey(ref Message msg,Keys keyData) {
|
|
if(keyData>=Keys.F1 && keyData<=Keys.F3) {
|
|
mode=0; entry.Clear(); mode=(int)keyData-(int)Keys.F1+1; seq=0;
|
|
if(mode==3) entry.Focus(); else ActiveControl=null;
|
|
Invalidate(); return true;
|
|
}
|
|
return base.ProcessCmdKey(ref msg,keyData);
|
|
}
|
|
protected override void OnPaint(PaintEventArgs e) {
|
|
var g=e.Graphics; g.Clear(Color.FromArgb(240,245,250));
|
|
using(var f=new Font("Arial",20)) g.DrawString("VDI: Windows hover / click / masked input; synthetic submit has no backend",f,Brushes.Black,60,50);
|
|
if(seq>=1000) using(var f=new Font("Arial",20)) g.DrawString("Synthetic page ready",f,Brushes.Black,60,180);
|
|
PaintBits(g,40,16,seq); PaintBits(g,800,8,0x5a); PaintBits(g,1160,4,mode);
|
|
}
|
|
void PaintBits(Graphics g,int start,int bits,int value) {for(int i=0;i<bits;i++) g.FillRectangle((value&(1<<i))!=0?Brushes.White:Brushes.Black,start+i*40,1350,40,70);}
|
|
}
|
|
'@
|
|
[VDIResponseReference]::SetProcessDPIAware() | Out-Null
|
|
[Windows.Forms.Application]::Run((New-Object VDIResponseReference))
|