11using System ;
22using System . Collections . Generic ;
3+ using System . Drawing ;
4+ using System . Globalization ;
35using System . Linq ;
46using System . Threading ;
57using System . Threading . Tasks ;
8+ using System . Web . UI . WebControls ;
69using System . Windows . Forms ;
710using Newtonsoft . Json ;
811using Proxmox_Desktop_Client . Classes . consoles ;
912using Proxmox_Desktop_Client . Classes . pveAPI . objects ;
13+ using Label = System . Windows . Forms . Label ;
1014using Timer = System . Timers . Timer ;
1115
1216namespace Proxmox_Desktop_Client . Panels ;
@@ -148,6 +152,17 @@ private void GenerateMachineTile(MachineData machineData)
148152 Properties . Resources . vm_logo ,
149153 SizeMode = PictureBoxSizeMode . StretchImage
150154 } ;
155+
156+ // Label Status of Virtual Machine
157+ var newStatus = new Label ( )
158+ {
159+ Name = "Status_" + machineData . Vmid . ToString ( ) ,
160+ Location = new System . Drawing . Point ( 0 , 110 ) ,
161+ Anchor = AnchorStyles . Bottom | AnchorStyles . Left ,
162+ Text = CultureInfo . CurrentCulture . TextInfo . ToTitleCase ( machineData . Status . ToLower ( ) ) ,
163+ Font = new Font ( Font . FontFamily , 7f , FontStyle . Bold ) ,
164+ ForeColor = ( machineData . Status . ToLower ( ) == "running" ? Color . Green : Color . Red )
165+ } ;
151166
152167 // Generate Context Menus
153168 var mainContextMenu = new ContextMenuStrip ( ) ;
@@ -228,7 +243,6 @@ private void GenerateMachineTile(MachineData machineData)
228243 }
229244 } ;
230245
231-
232246 // Set States for Menu Items
233247 // Remote Items
234248 remoteContextMenu . Enabled = ( machineData . Status == "running" ) ;
@@ -248,7 +262,7 @@ private void GenerateMachineTile(MachineData machineData)
248262 newPbDots . ContextMenuStrip = mainContextMenu ;
249263 newGroupBox . Controls . Add ( newPbDots ) ;
250264 newGroupBox . Controls . Add ( newPbImg ) ;
251-
265+ newPbImg . Controls . Add ( newStatus ) ;
252266 machinePanel . Controls . Add ( newGroupBox ) ;
253267
254268 }
0 commit comments