Skip to content

Commit b00b957

Browse files
committed
Colored output
1 parent 9e89e18 commit b00b957

2 files changed

Lines changed: 22 additions & 14 deletions

File tree

LighthouseV2PowerControl/Form1.Designer.cs

Lines changed: 16 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

LighthouseV2PowerControl/Form1.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
using System;
22
using System.Collections.Generic;
3+
using System.Drawing;
34
using System.Text.RegularExpressions;
45
using System.Threading.Tasks;
56
using System.Windows.Forms;
67
using Windows.Devices.Bluetooth;
78
using Windows.Devices.Bluetooth.GenericAttributeProfile;
89
using Windows.Devices.Enumeration;
910
using Windows.Storage.Streams;
11+
using Windows.UI.Composition;
1012

1113
namespace 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

Comments
 (0)