11using System ;
22using System . Collections . Generic ;
3+ using System . Drawing ;
34using System . Text . RegularExpressions ;
45using System . Threading . Tasks ;
56using System . Windows . Forms ;
67using Windows . Devices . Bluetooth ;
78using Windows . Devices . Bluetooth . GenericAttributeProfile ;
89using Windows . Devices . Enumeration ;
910using Windows . Storage . Streams ;
11+ using Windows . UI . Composition ;
1012
1113namespace LighthouseV2PowerControl
1214{
@@ -23,11 +25,9 @@ public partial class Form1 : Form
2325 public Form1 ( string [ ] args )
2426 {
2527 InitializeComponent ( ) ;
26- lbStatus . Text = null ;
2728 btnStart . Click += ( obj , e ) => SendOnLighthouseAsync ( activateByte ) ;
2829 btnStop . Click += ( obj , e ) => SendOnLighthouseAsync ( deactivateByte ) ;
2930 btnStop . Enabled = btnStart . Enabled = false ;
30-
3131 if ( args . Length > 0 )
3232 {
3333 UseArgumentsAsync ( args ) ;
@@ -116,12 +116,14 @@ private async Task SendOnLighthouseAsync(byte byte4send)
116116
117117 private void Log ( object msg )
118118 {
119- lbStatus . Items . Add ( msg ) ;
119+ lvStatus . Items . Add ( msg . ToString ( ) ) ;
120+ lvStatus . Items [ lvStatus . Items . Count - 1 ] . ForeColor = Color . Green ;
120121 }
121122
122123 private void LogError ( object msg )
123124 {
124- lbStatus . Items . Add ( msg ) ;
125+ lvStatus . Items . Add ( msg . ToString ( ) ) ;
126+ lvStatus . Items [ lvStatus . Items . Count - 1 ] . ForeColor = Color . DarkRed ;
125127 }
126128 }
127129}
0 commit comments