diff --git a/smx-config/App.config b/smx-config/App.config
index fba0990..0cbd0a0 100644
--- a/smx-config/App.config
+++ b/smx-config/App.config
@@ -13,6 +13,9 @@
False
+
+
+
diff --git a/smx-config/Helpers.cs b/smx-config/Helpers.cs
index 177d049..5b52770 100644
--- a/smx-config/Helpers.cs
+++ b/smx-config/Helpers.cs
@@ -381,6 +381,7 @@ namespace smx_config
// on the user's settings. This handles managing which sensors each slider controls.
static class ThresholdSettings
{
+ [Serializable]
public struct PanelAndSensor
{
public PanelAndSensor(int panel, int sensor)
@@ -408,10 +409,75 @@ namespace smx_config
// are then synced to the other panels.
{ "cardinal", 7 },
{ "corner", 2 },
+
+ // The aux threshold allows giving a list of specific sensors different thresholds.
+ { "aux", -1 },
};
+ // Save and load the list of aux sensors to settings. These aren't saved to the pad, we just
+ // keep them in application settings.
+ static List cachedAuxSensors;
+ static public void SetAuxSensors(List panelAndSensors)
+ {
+ List result = new List();
+ foreach(PanelAndSensor panelAndSensor in panelAndSensors)
+ {
+ List panelAndSensorArray = new List() { panelAndSensor.panel, panelAndSensor.sensor };
+ result.Add(panelAndSensorArray);
+ }
+
+ Properties.Settings.Default.AuxSensors = SerializeJSON.Serialize(result);
+ Properties.Settings.Default.Save();
+
+ // Clear the cache. Set it to null instead of assigning panelAndSensors to it to force
+ // it to re-parse at least once, to catch problems early.
+ cachedAuxSensors = null;
+ }
+
+ // Return the sensors that are controlled by the aux threshold slider. The other
+ // threshold sliders will leave these alone.
+ static public List GetAuxSensors()
+ {
+// Properties.Settings.Default.AuxSensors = "[[0,0], [1,0]]";
+ // This is only ever changed with calls to SetSavedAuxSensors.
+ if(cachedAuxSensors != null)
+ return Helpers.DeepClone(cachedAuxSensors);
+
+ List result = new List();
+ if(Properties.Settings.Default.AuxSensors == "")
+ return result;
+
+ try {
+ // This is a list of [panel,sensor] arrays:
+ // [[0,0], [0,1], [1,0]]
+ List sensors = SMXJSON.ParseJSON.Parse>(Properties.Settings.Default.AuxSensors);
+ foreach(object panelAndSensorObj in sensors)
+ {
+ List panelAndSensor = (List) panelAndSensorObj;
+ int panel = panelAndSensor.Get(0, -1);
+ int sensor = panelAndSensor.Get(1, -1);
+ if(panel == -1 || sensor == -1)
+ continue;
+
+ result.Add(new PanelAndSensor(panel, sensor));
+ }
+ } catch(ParseError) {
+ return result;
+ }
+
+ cachedAuxSensors = result;
+ // SetAuxSensors(result); // XXX
+
+ // SetSavedAuxSensors(result);
+ return Helpers.DeepClone(cachedAuxSensors);
+ }
+
static public List GetControlledSensorsForSliderType(string Type, bool advancedMode)
{
+ // The aux threshold slider always controls the aux sensors.
+ if(Type == "aux")
+ return GetAuxSensors();
+
List result = new List();
// Check if this slider is shown in this mode.
@@ -432,6 +498,7 @@ namespace smx_config
// If advanced mode is disabled, save to all panels this slider affects. The down arrow controls
// all four cardinal panels. (If advanced mode is enabled we'll never be a different cardinal
// direction, since those widgets won't exist.) If it's disabled, just write to our own panel.
+ List auxSensors = GetAuxSensors();
List saveToPanels = new List();
int ourPanelIdx = panelNameToIndex[Type];
saveToPanels.Add(ourPanelIdx);
@@ -442,25 +509,17 @@ namespace smx_config
{
for(int sensor = 0; sensor < 4; ++sensor)
{
+ // Ignore sensors controlled by the aux threshold.
PanelAndSensor panelAndSensor = new PanelAndSensor(panelIdx, sensor);
+ if(auxSensors.Contains(panelAndSensor))
+ continue;
+
result.Add(panelAndSensor);
}
}
return result;
}
-
- // Return the sensors that are controlled by the aux threshold slider. The other
- // threshold sliders will leave these alone.
- static public List GetAuxSensors()
- {
- List result = new List();
- result.Add(new PanelAndSensor(1,0));
- result.Add(new PanelAndSensor(1,1));
- result.Add(new PanelAndSensor(1,2));
- result.Add(new PanelAndSensor(1,3));
- return result;
- }
}
// This class just makes it easier to assemble binary command packets.
diff --git a/smx-config/MainWindow.xaml b/smx-config/MainWindow.xaml
index 94f884d..12192aa 100644
--- a/smx-config/MainWindow.xaml
+++ b/smx-config/MainWindow.xaml
@@ -931,6 +931,11 @@ instead of only panels with sensors.
+
+ Aux sensors
+
+
Reset all settings
diff --git a/smx-config/MainWindow.xaml.cs b/smx-config/MainWindow.xaml.cs
index 4ddde3f..b9dc0b6 100644
--- a/smx-config/MainWindow.xaml.cs
+++ b/smx-config/MainWindow.xaml.cs
@@ -17,7 +17,8 @@ namespace smx_config
{
InitializeComponent();
- onConfigChange = new OnConfigChange(this, delegate(LoadFromConfigDelegateArgs args) {
+ onConfigChange = new OnConfigChange(this, delegate (LoadFromConfigDelegateArgs args)
+ {
LoadUIFromConfig(args);
});
@@ -26,7 +27,7 @@ namespace smx_config
// to tray to keep playing animations. If we're not controlling animations,
// or the firmware supports doing them automatically, don't bug the user
// with a prompt.
- Closing += delegate(object sender, System.ComponentModel.CancelEventArgs e)
+ Closing += delegate (object sender, System.ComponentModel.CancelEventArgs e)
{
LoadFromConfigDelegateArgs args = CurrentSMXDevice.singleton.GetState();
@@ -70,10 +71,10 @@ namespace smx_config
List thresholdSliderNames = new List()
{
- "up-left", "up", "up-right", "left", "center", "right", "down-left", "down", "down-right", "cardinal", "corner",
+ "up-left", "up", "up-right", "left", "center", "right", "down-left", "down", "down-right", "cardinal", "corner", "aux",
};
- Dictionary thresholdToIcon = new Dictionary()
+ Dictionary thresholdToIcon = new Dictionary()
{
{ "up-left", "Resources/pad_up_left.png" },
{ "up", "Resources/pad_up.png" },
@@ -86,11 +87,12 @@ namespace smx_config
{ "down-right","Resources/pad_down_right.png" },
{ "cardinal", "Resources/pad_cardinal.png" },
{ "corner", "Resources/pad_diagonal.png" },
+ { "aux", "Resources/pad_diagonal.png" },
};
bool IsThresholdSliderShown(string type)
{
- bool AdvancedModeEnabled = (bool) AdvancedModeEnabledCheckbox.IsChecked;
+ bool AdvancedModeEnabled = (bool)AdvancedModeEnabledCheckbox.IsChecked;
SMX.SMXConfig config = ActivePad.GetFirstActivePadConfig();
bool[] enabledPanels = config.GetEnabledPanels();
@@ -108,20 +110,20 @@ namespace smx_config
// turned back on.
switch(type)
{
- case "up-left": return enabledPanels[0];
- case "up": return enabledPanels[1];
- case "up-right": return enabledPanels[2];
- case "left": return enabledPanels[3];
- case "center": return enabledPanels[4];
- case "right": return enabledPanels[5];
- case "down-left": return enabledPanels[6];
- case "down": return enabledPanels[7];
- case "down-right": return enabledPanels[8];
+ case "up-left": return enabledPanels[0];
+ case "up": return enabledPanels[1];
+ case "up-right": return enabledPanels[2];
+ case "left": return enabledPanels[3];
+ case "center": return enabledPanels[4];
+ case "right": return enabledPanels[5];
+ case "down-left": return enabledPanels[6];
+ case "down": return enabledPanels[7];
+ case "down-right": return enabledPanels[8];
// Show cardinal and corner if at least one panel they affect is enabled.
- case "cardinal": return enabledPanels[3] || enabledPanels[5] || enabledPanels[8];
- case "corner": return enabledPanels[0] || enabledPanels[2] || enabledPanels[6] || enabledPanels[8];
- default: return true;
+ case "cardinal": return enabledPanels[3] || enabledPanels[5] || enabledPanels[8];
+ case "corner": return enabledPanels[0] || enabledPanels[2] || enabledPanels[6] || enabledPanels[8];
+ default: return true;
}
}
@@ -153,7 +155,7 @@ namespace smx_config
ThresholdSlider slider = CreateThresholdSlider(sliderName);
DockPanel.SetDock(slider, Dock.Top);
- slider.Margin = new Thickness(0,8,0,0);
+ slider.Margin = new Thickness(0, 8, 0, 0);
ThresholdSliderContainer.Children.Add(slider);
}
}
@@ -163,20 +165,20 @@ namespace smx_config
base.OnApplyTemplate();
// Add our WndProc hook.
- HwndSource source = (HwndSource) PresentationSource.FromVisual(this);
+ HwndSource source = (HwndSource)PresentationSource.FromVisual(this);
source.AddHook(new HwndSourceHook(WndProcHook));
Version1.Content = "SMXConfig version " + SMX.SMX.Version();
Version2.Content = "SMXConfig version " + SMX.SMX.Version();
- AutoLightsColor.StartedDragging += delegate() { showAutoLightsColor.Start(); };
- AutoLightsColor.StoppedDragging += delegate() { showAutoLightsColor.Stop(); };
- AutoLightsColor.StoppedDragging += delegate() { showAutoLightsColor.Stop(); };
+ AutoLightsColor.StartedDragging += delegate () { showAutoLightsColor.Start(); };
+ AutoLightsColor.StoppedDragging += delegate () { showAutoLightsColor.Stop(); };
+ AutoLightsColor.StoppedDragging += delegate () { showAutoLightsColor.Stop(); };
CreateThresholdSliders();
// This doesn't happen at the same time AutoLightsColor is used, since they're on different tabs.
- Diagnostics.SetShowAllLights += delegate(bool on)
+ Diagnostics.SetShowAllLights += delegate (bool on)
{
if(on)
showAutoLightsColor.Start();
@@ -184,7 +186,7 @@ namespace smx_config
showAutoLightsColor.Stop();
};
- SetAllPanelsToCurrentColor.Click += delegate(object sender, RoutedEventArgs e)
+ SetAllPanelsToCurrentColor.Click += delegate (object sender, RoutedEventArgs e)
{
// Get the color of the selected color button, and apply it to all other buttons.
Color color = selectedButton.getColor();
@@ -206,7 +208,7 @@ namespace smx_config
ColorButton[] buttons = getColorPickerButtons();
foreach(ColorButton button in buttons)
{
- button.Click += delegate(object sender, RoutedEventArgs e)
+ button.Click += delegate (object sender, RoutedEventArgs e)
{
ColorButton clickedButton = sender as ColorButton;
selectedButton = clickedButton;
@@ -221,7 +223,7 @@ namespace smx_config
// The user pressed either the "panel colors" or "GIF animations" button.
bool pressedPanelColors = sender == PanelColorsButton;
- foreach(Tuple activePad in ActivePad.ActivePads())
+ foreach(Tuple activePad in ActivePad.ActivePads())
{
SMX.SMXConfig config = activePad.Item2;
@@ -240,19 +242,19 @@ namespace smx_config
private void LoadUIFromConfig(LoadFromConfigDelegateArgs args)
{
bool EitherControllerConnected = args.controller[0].info.connected || args.controller[1].info.connected;
- Main.Visibility = EitherControllerConnected? Visibility.Visible:Visibility.Hidden;
- Searching.Visibility = EitherControllerConnected? Visibility.Hidden:Visibility.Visible;
- ConnectedPads.Visibility = EitherControllerConnected? Visibility.Visible:Visibility.Hidden;
- PanelColorP1.Visibility = args.controller[0].info.connected? Visibility.Visible:Visibility.Collapsed;
- PanelColorP2.Visibility = args.controller[1].info.connected? Visibility.Visible:Visibility.Collapsed;
- EnableCenterTopSensorCheckbox.Visibility =
- P1_Floor.Visibility =
- P2_Floor.Visibility =
- args.firmwareVersion() >= 5? Visibility.Visible:Visibility.Collapsed;
+ Main.Visibility = EitherControllerConnected ? Visibility.Visible : Visibility.Hidden;
+ Searching.Visibility = EitherControllerConnected ? Visibility.Hidden : Visibility.Visible;
+ ConnectedPads.Visibility = EitherControllerConnected ? Visibility.Visible : Visibility.Hidden;
+ PanelColorP1.Visibility = args.controller[0].info.connected ? Visibility.Visible : Visibility.Collapsed;
+ PanelColorP2.Visibility = args.controller[1].info.connected ? Visibility.Visible : Visibility.Collapsed;
+ EnableCenterTopSensorCheckbox.Visibility =
+ P1_Floor.Visibility =
+ P2_Floor.Visibility =
+ args.firmwareVersion() >= 5 ? Visibility.Visible : Visibility.Collapsed;
// Show the color slider or GIF UI depending on which one is set in flags.
// If both pads are turned on, just use the first one.
- foreach(Tuple activePad in ActivePad.ActivePads())
+ foreach(Tuple activePad in ActivePad.ActivePads())
{
SMX.SMXConfig config = activePad.Item2;
@@ -260,8 +262,8 @@ namespace smx_config
// If it's not set, show the color slider UI.
SMX.SMXConfigFlags flags = config.configFlags;
bool usePressedAnimations = (flags & SMX.SMXConfigFlags.AutoLightingUsePressedAnimations) != 0;
- ColorPickerGroup.Visibility = usePressedAnimations? Visibility.Collapsed:Visibility.Visible;
- GIFGroup.Visibility = usePressedAnimations? Visibility.Visible:Visibility.Collapsed;
+ ColorPickerGroup.Visibility = usePressedAnimations ? Visibility.Collapsed : Visibility.Visible;
+ GIFGroup.Visibility = usePressedAnimations ? Visibility.Visible : Visibility.Collapsed;
// Tell the color mode buttons which one is selected, to set the button highlight.
PanelColorsButton.Selected = !usePressedAnimations;
@@ -294,7 +296,7 @@ namespace smx_config
}
}
}
- ThresholdWarningText.Visibility = ShowThresholdWarningText? Visibility.Visible : Visibility.Hidden;
+ ThresholdWarningText.Visibility = ShowThresholdWarningText ? Visibility.Visible : Visibility.Hidden;
// If a second controller has connected and we're on Both, see if we need to prompt
// to sync configs. We only actually need to do this if a controller just connected.
@@ -355,9 +357,9 @@ namespace smx_config
foreach(Tuple activePad in ActivePad.ActivePads())
{
SMX.SMXConfig config = activePad.Item2;
-
+
bool uploadsSupported = config.masterVersion >= 4;
- LeaveRunning.Visibility = uploadsSupported? Visibility.Collapsed:Visibility.Visible;
+ LeaveRunning.Visibility = uploadsSupported ? Visibility.Collapsed : Visibility.Visible;
break;
}
}
@@ -455,12 +457,12 @@ namespace smx_config
bool TwoControllersConnected = args.controller[0].info.connected && args.controller[1].info.connected;
// Only show the dropdown if two controllers are connected.
- ConnectedPadList.Visibility = TwoControllersConnected? Visibility.Visible:Visibility.Collapsed;
+ ConnectedPadList.Visibility = TwoControllersConnected ? Visibility.Visible : Visibility.Collapsed;
// Only show the P1/P2 text if only one controller is connected, since it takes the place
// of the dropdown.
- P1Connected.Visibility = (!TwoControllersConnected && args.controller[0].info.connected)? Visibility.Visible:Visibility.Collapsed;
- P2Connected.Visibility = (!TwoControllersConnected && args.controller[1].info.connected)? Visibility.Visible:Visibility.Collapsed;
+ P1Connected.Visibility = (!TwoControllersConnected && args.controller[0].info.connected) ? Visibility.Visible : Visibility.Collapsed;
+ P2Connected.Visibility = (!TwoControllersConnected && args.controller[1].info.connected) ? Visibility.Visible : Visibility.Collapsed;
if(!TwoControllersConnected)
return;
@@ -478,7 +480,7 @@ namespace smx_config
private void FactoryReset_Click(object sender, RoutedEventArgs e)
{
- foreach(Tuple activePad in ActivePad.ActivePads())
+ foreach(Tuple activePad in ActivePad.ActivePads())
{
int pad = activePad.Item1;
SMX.SMX.FactoryReset(pad);
@@ -494,7 +496,7 @@ namespace smx_config
private void ExportSettings(object sender, RoutedEventArgs e)
{
// Save the current thresholds on the first available pad as a preset.
- foreach(Tuple activePad in ActivePad.ActivePads())
+ foreach(Tuple activePad in ActivePad.ActivePads())
{
int pad = activePad.Item1;
SMX.SMXConfig config = activePad.Item2;
@@ -505,7 +507,7 @@ namespace smx_config
dialog.DefaultExt = ".smxcfg";
dialog.Filter = "StepManiaX settings (.smxcfg)|*.smxcfg";
bool? result = dialog.ShowDialog();
- if(result == null || !(bool) result)
+ if(result == null || !(bool)result)
return;
System.IO.File.WriteAllText(dialog.FileName, json);
@@ -521,13 +523,13 @@ namespace smx_config
dialog.DefaultExt = ".smxcfg";
dialog.Filter = "StepManiaX settings (.smxcfg)|*.smxcfg";
bool? result = dialog.ShowDialog();
- if(result == null || !(bool) result)
+ if(result == null || !(bool)result)
return;
string json = Helpers.ReadFile(dialog.FileName);
// Apply settings from the file to all active pads.
- foreach(Tuple activePad in ActivePad.ActivePads())
+ foreach(Tuple activePad in ActivePad.ActivePads())
{
int pad = activePad.Item1;
SMX.SMXConfig config = activePad.Item2;
@@ -551,13 +553,13 @@ namespace smx_config
dialog.DefaultExt = ".gif";
dialog.Filter = "Animated GIF (.gif)|*.gif";
bool? result = dialog.ShowDialog();
- if(result == null || !(bool) result)
+ if(result == null || !(bool)result)
return;
byte[] buf = Helpers.ReadBinaryFile(dialog.FileName);
- SMX.SMX.LightsType type = pressed? SMX.SMX.LightsType.LightsType_Pressed:SMX.SMX.LightsType.LightsType_Released;
+ SMX.SMX.LightsType type = pressed ? SMX.SMX.LightsType.LightsType_Pressed : SMX.SMX.LightsType.LightsType_Released;
- foreach(Tuple activePad in ActivePad.ActivePads())
+ foreach(Tuple activePad in ActivePad.ActivePads())
{
int pad = activePad.Item1;
@@ -583,7 +585,7 @@ namespace smx_config
// For firmwares that support it, upload the animation to the pad now. Otherwise,
// we'll run the animation directly.
- foreach(Tuple activePad in ActivePad.ActivePads())
+ foreach(Tuple activePad in ActivePad.ActivePads())
{
int pad = activePad.Item1;
@@ -598,6 +600,12 @@ namespace smx_config
}
}
+ private void SetAuxSensors_Click(object sender, RoutedEventArgs e)
+ {
+ SetAuxSensors dialog = new SetAuxSensors();
+ dialog.ShowDialog();
+ }
+
private void UploadLatestGIF()
{
// Create a progress window. Center it on top of the main window.
diff --git a/smx-config/Properties/Settings.Designer.cs b/smx-config/Properties/Settings.Designer.cs
index 6a30787..fad6923 100644
--- a/smx-config/Properties/Settings.Designer.cs
+++ b/smx-config/Properties/Settings.Designer.cs
@@ -12,7 +12,7 @@ namespace smx_config.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.6.0.0")]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
@@ -34,5 +34,17 @@ namespace smx_config.Properties {
this["LaunchOnStartup"] = value;
}
}
+
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("")]
+ public string AuxSensors {
+ get {
+ return ((string)(this["AuxSensors"]));
+ }
+ set {
+ this["AuxSensors"] = value;
+ }
+ }
}
}
diff --git a/smx-config/Properties/Settings.settings b/smx-config/Properties/Settings.settings
index 2d633bc..9f13323 100644
--- a/smx-config/Properties/Settings.settings
+++ b/smx-config/Properties/Settings.settings
@@ -5,5 +5,8 @@
False
+
+
+
\ No newline at end of file
diff --git a/smx-config/SMXConfig.csproj b/smx-config/SMXConfig.csproj
index 96f395d..4470f57 100644
--- a/smx-config/SMXConfig.csproj
+++ b/smx-config/SMXConfig.csproj
@@ -105,6 +105,9 @@
+
+ SetAuxSensors.xaml
+
ProgressWindow.xaml
@@ -123,6 +126,10 @@
MainWindow.xaml
Code
+
+ MSBuild:Compile
+ Designer
+
MSBuild:Compile
Designer
diff --git a/smx-config/SetAuxSensors.xaml b/smx-config/SetAuxSensors.xaml
new file mode 100644
index 0000000..58cd4cb
--- /dev/null
+++ b/smx-config/SetAuxSensors.xaml
@@ -0,0 +1,102 @@
+
+
+
+
+
+
+
+
+
+ Select which sensors are controlled
+by the auxilliary threshold.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/smx-config/SetAuxSensors.xaml.cs b/smx-config/SetAuxSensors.xaml.cs
new file mode 100644
index 0000000..2e59574
--- /dev/null
+++ b/smx-config/SetAuxSensors.xaml.cs
@@ -0,0 +1,99 @@
+using System;
+using System.Collections.Generic;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Controls.Primitives;
+
+namespace smx_config
+{
+ public class SensorSelectionButton: ToggleButton
+ {
+ }
+
+ // A control with one button for each of four sensors:
+ class SensorSelector: Control
+ {
+ // The panel we're editing (0-8).
+ public static readonly DependencyProperty PanelProperty = DependencyProperty.RegisterAttached("Panel",
+ typeof(int), typeof(SensorSelector), new FrameworkPropertyMetadata(0));
+
+ public int Panel {
+ get { return (int) this.GetValue(PanelProperty); }
+ set { this.SetValue(PanelProperty, value); }
+ }
+
+ ToggleButton[] SensorSelectionButtons = new ToggleButton[4];
+ public override void OnApplyTemplate()
+ {
+ base.OnApplyTemplate();
+
+ for(int sensor = 0; sensor < 4; ++sensor)
+ {
+ int ThisSensor = sensor; // bind
+ SensorSelectionButtons[sensor] = GetTemplateChild("Sensor" + sensor) as ToggleButton;
+ SensorSelectionButtons[sensor].Click += delegate(object sender, RoutedEventArgs e)
+ {
+ ClickedSensorButton(ThisSensor);
+ };
+ }
+
+ // These settings are stored in the application settings, not on the pad. However,
+ // we treat changes to this as config changes, so we can use the same OnConfigChange
+ // method for updating.
+ OnConfigChange onConfigChange;
+ onConfigChange = new OnConfigChange(this, delegate(LoadFromConfigDelegateArgs args) {
+ LoadUIFromConfig(args);
+ });
+ }
+
+ private void ClickedSensorButton(int sensor)
+ {
+ // Toggle the clicked sensor.
+ Console.WriteLine("Clicked sensor " + sensor);
+ List auxSensors = ThresholdSettings.GetAuxSensors();
+ bool enabled = !IsSensorEnabled(auxSensors, sensor);
+
+ if(enabled)
+ auxSensors.Add(new ThresholdSettings.PanelAndSensor(Panel, sensor));
+ else
+ auxSensors.Remove(new ThresholdSettings.PanelAndSensor(Panel, sensor));
+ ThresholdSettings.SetAuxSensors(auxSensors);
+
+ CurrentSMXDevice.singleton.FireConfigurationChanged(this);
+ }
+
+ // Return true if the given sensor is marked as an aux sensor.
+ bool IsSensorEnabled(List auxSensors, int sensor)
+ {
+ foreach(ThresholdSettings.PanelAndSensor panelAndSensor in auxSensors)
+ {
+ if(panelAndSensor.panel == Panel && panelAndSensor.sensor == sensor)
+ return true;
+ }
+ return false;
+ }
+
+ private void LoadUIFromConfig(LoadFromConfigDelegateArgs args)
+ {
+ // Check the selected aux sensors.
+ List auxSensors = ThresholdSettings.GetAuxSensors();
+ for(int sensor = 0; sensor < 4; ++sensor)
+ SensorSelectionButtons[sensor].IsChecked = IsSensorEnabled(auxSensors, sensor);
+ }
+ }
+
+ // This dialog sets which sensors are controlled by the auxilliary threshold. The actual
+ // work is done by SensorSelector above.
+ public partial class SetAuxSensors: Window
+ {
+ public SetAuxSensors()
+ {
+ InitializeComponent();
+ }
+
+ private void OK_Click(object sender, RoutedEventArgs e)
+ {
+ Close();
+ }
+ }
+}