Skip to content

Commit 942afff

Browse files
authored
Merge pull request #4 from Gaardsholt/idle-color
Added option to control idle color
2 parents 52e5168 + 30ce2ad commit 942afff

File tree

4 files changed

+11
-4
lines changed

4 files changed

+11
-4
lines changed

AppSettings.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ public class Settings
1717
public string Ring_Tune => Configuration.GetValue("AppSettings:Ring_Tune", "OpenOffice");
1818
public string Ring_Color => Configuration.GetValue("AppSettings:Ring_Color", "Red");
1919
public int Ring_Time => Configuration.GetValue("AppSettings:Ring_Time", 5000);
20+
public string Idle_Color => Configuration.GetValue("AppSettings:Idle_Color", "Off");
2021

2122
public Settings()
2223
{

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@
1313
| ApiKey | | * |
1414
| KeyName | ApiKey | * |
1515
| Ring_Tune | OpenOffice | "OpenOffice", "Quiet", "Funky", "FairyTale", "KuandoTrain", "TelephoneNordic", "TelephoneOriginal", "TelephonePickMeUp", "IM1", "IM2" |
16-
| Ring_Color | Red | "Red", "Green", "Blue", "Yellow", "Off |
16+
| Ring_Color | Red | "Red", "Green", "Blue", "Yellow", "Off" |
1717
| Ring_Time | 5000 | |
18+
| Idle_Color | Off | See "Ring_Color" |
1819

1920

2021
Example of a appsettings.json:
@@ -26,8 +27,9 @@ Example of a appsettings.json:
2627
"Ring_Time": 5500,
2728
"Ring_Tune": "OpenOffice",
2829
"Ring_Color": "Red",
30+
"KeyName": "ApiKey",
2931
"ApiKey": "some-key",
30-
"KeyName": "ApiKey"
32+
"Idle_Color": "Off"
3133
}
3234
}
3335
```

ServerConnect.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,13 @@ class ServerConnect
1414

1515
public ContextMenuStrip _menu;
1616
private static Settings _settings;
17+
private static Busylight.BusylightColor _idleColor;
1718

1819
public ServerConnect(Settings settings, ContextMenuStrip menu)
1920
{
2021
_settings = settings;
2122
_menu = menu;
23+
_idleColor = GetColorFromString(_settings.Idle_Color);
2224

2325
connection = new HubConnectionBuilder()
2426
.WithUrl(new Uri(_settings.SignalR_Uri), options =>
@@ -65,13 +67,14 @@ public async Task Connect()
6567

6668
busy.Alert(color, tune, Busylight.BusylightVolume.High);
6769
await Task.Delay(_settings.Ring_Time);
68-
busy.Light(Busylight.BusylightColor.Off);
70+
busy.Light(_idleColor);
6971
});
7072

7173
try
7274
{
7375
await ConnectWithRetryAsync();
7476
AddClickEvent();
77+
busy.Light(_idleColor);
7578
}
7679
catch (Exception e)
7780
{

appsettings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
"AppSettings": {
33
"Location": "Brande",
44
"SignalR_Uri": "http://localhost:50625/BusyHub",
5-
"Ring_Time": 5500,
5+
"Ring_Time": 6800,
66
"Ring_Tune": "OpenOffice",
77
"Ring_Color": "Red",
8+
"Idle_Color": "Blue",
89
"ApiKey": "some-key"
910
}
1011
}

0 commit comments

Comments
 (0)