Skip to content

Commit

Permalink
fix: allow theme messenger to build/register
Browse files Browse the repository at this point in the history
The xPanel is setup to use the config to save/store theme information. However, the messenger needs to be built for the xPanel to persist it's theme information that way.
  • Loading branch information
Andrew Welker committed Jun 24, 2024
1 parent 2d84e3e commit 8fee4ec
Showing 1 changed file with 17 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -141,21 +141,21 @@ public MobileControlTouchpanelController(string key, string name, BasicTriListWi

public void UpdateTheme(string theme)
{
localConfig.Theme = theme;
localConfig.Theme = theme;

var props = JToken.FromObject(localConfig);

var deviceConfig = ConfigReader.ConfigObject.Devices.FirstOrDefault((d) => d.Key == Key);

if(deviceConfig == null) { return; }
if (deviceConfig == null) { return; }

deviceConfig.Properties = props;

ConfigWriter.UpdateDeviceConfig(deviceConfig);
}

private void RegisterForExtenders()
{
{
if (Panel is TswXX70Base x70Panel)
{
x70Panel.ExtenderApplicationControlReservedSigs.DeviceExtenderSigChange += (e, a) =>
Expand All @@ -168,13 +168,14 @@ private void RegisterForExtenders()
{
x70Panel.ExtenderButtonToolbarReservedSigs.ShowButtonToolbar();
x70Panel.ExtenderButtonToolbarReservedSigs.Button2On();
} else
}
else
{
x70Panel.ExtenderButtonToolbarReservedSigs.HideButtonToolbar();
x70Panel.ExtenderButtonToolbarReservedSigs.Button2Off();
}
};


x70Panel.ExtenderZoomRoomAppReservedSigs.DeviceExtenderSigChange += (e, a) =>
{
Expand All @@ -189,7 +190,7 @@ private void RegisterForExtenders()
ZoomInCallFeedback.FireUpdate();
}
};


x70Panel.ExtenderEthernetReservedSigs.DeviceExtenderSigChange += (e, a) =>
{
Expand All @@ -200,7 +201,7 @@ private void RegisterForExtenders()

var handler = DeviceInfoChanged;

if(handler == null)
if (handler == null)
{
return;
}
Expand Down Expand Up @@ -248,7 +249,7 @@ private void RegisterForExtenders()
};

x60withZoomApp.ExtenderEthernetReservedSigs.DeviceExtenderSigChange += (e, a) =>
{
{
DeviceInfo.MacAddress = x60withZoomApp.ExtenderEthernetReservedSigs.MacAddressFeedback.StringValue;
DeviceInfo.IpAddress = x60withZoomApp.ExtenderEthernetReservedSigs.IpAddressFeedback.StringValue;

Expand All @@ -272,10 +273,6 @@ private void RegisterForExtenders()

public override bool CustomActivate()
{
if (!(Panel is TswXX70Base) && !(Panel is TswX60WithZoomRoomAppReservedSigs))
{
return base.CustomActivate();
}
var appMessenger = new ITswAppControlMessenger($"appControlMessenger-{Key}", $"/device/{Key}", this);

var zoomMessenger = new ITswZoomControlMessenger($"zoomControlMessenger-{Key}", $"/device/{Key}", this);
Expand All @@ -289,6 +286,13 @@ public override bool CustomActivate()
return base.CustomActivate();
}

if (!(Panel is TswXX70Base) && !(Panel is TswX60WithZoomRoomAppReservedSigs))
{
mc.AddDeviceMessenger(themeMessenger);

return base.CustomActivate();
}

mc.AddDeviceMessenger(appMessenger);
mc.AddDeviceMessenger(zoomMessenger);
mc.AddDeviceMessenger(themeMessenger);
Expand Down

0 comments on commit 8fee4ec

Please sign in to comment.