Add debug logging for dropdown selection and power unsupported state
- Added detailed logging in CreateInputRow to help diagnose dropdown selection issues after config label changes - Power button now shows "Power Unsupported" and is disabled for monitors that don't support DDC/CI power control 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -13,9 +13,9 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Version>1.0.16</Version>
|
<Version>1.0.17</Version>
|
||||||
<AssemblyVersion>1.0.16.0</AssemblyVersion>
|
<AssemblyVersion>1.0.17.0</AssemblyVersion>
|
||||||
<FileVersion>1.0.16.0</FileVersion>
|
<FileVersion>1.0.17.0</FileVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -371,6 +371,10 @@ public partial class MainWindow : Window
|
|||||||
|
|
||||||
private StackPanel CreateInputRow(int? currentInput, List<InputSourceOption> options, string serialNumber)
|
private StackPanel CreateInputRow(int? currentInput, List<InputSourceOption> options, string serialNumber)
|
||||||
{
|
{
|
||||||
|
DebugLogger.Log($" CreateInputRow: currentInput={currentInput}, optionCount={options.Count}");
|
||||||
|
foreach (var opt in options)
|
||||||
|
DebugLogger.Log($" Option: Value={opt.Value}, Name={opt.Name}");
|
||||||
|
|
||||||
var row = new StackPanel { Orientation = Orientation.Horizontal, Margin = new Thickness(0, 3, 0, 3) };
|
var row = new StackPanel { Orientation = Orientation.Horizontal, Margin = new Thickness(0, 3, 0, 3) };
|
||||||
row.Children.Add(new TextBlock { Text = "Input", Foreground = Brushes.LightGray, Width = 70, FontSize = 12, VerticalAlignment = VerticalAlignment.Center });
|
row.Children.Add(new TextBlock { Text = "Input", Foreground = Brushes.LightGray, Width = 70, FontSize = 12, VerticalAlignment = VerticalAlignment.Center });
|
||||||
|
|
||||||
@@ -390,9 +394,14 @@ public partial class MainWindow : Window
|
|||||||
if (currentInput.HasValue)
|
if (currentInput.HasValue)
|
||||||
{
|
{
|
||||||
var index = options.FindIndex(o => o.Value == currentInput.Value);
|
var index = options.FindIndex(o => o.Value == currentInput.Value);
|
||||||
|
DebugLogger.Log($" Selection: Looking for Value={currentInput.Value}, found at index={index}");
|
||||||
if (index >= 0)
|
if (index >= 0)
|
||||||
combo.SelectedIndex = index;
|
combo.SelectedIndex = index;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DebugLogger.Log($" Selection: currentInput is null, no selection");
|
||||||
|
}
|
||||||
|
|
||||||
// Add event handler AFTER setting the initial selection
|
// Add event handler AFTER setting the initial selection
|
||||||
combo.SelectionChanged += async (s, e) =>
|
combo.SelectionChanged += async (s, e) =>
|
||||||
@@ -410,26 +419,33 @@ public partial class MainWindow : Window
|
|||||||
var row = new StackPanel { Orientation = Orientation.Horizontal, Margin = new Thickness(0, 3, 0, 3) };
|
var row = new StackPanel { Orientation = Orientation.Horizontal, Margin = new Thickness(0, 3, 0, 3) };
|
||||||
row.Children.Add(new TextBlock { Text = "Power", Foreground = Brushes.LightGray, Width = 70, FontSize = 12, VerticalAlignment = VerticalAlignment.Center });
|
row.Children.Add(new TextBlock { Text = "Power", Foreground = Brushes.LightGray, Width = 70, FontSize = 12, VerticalAlignment = VerticalAlignment.Center });
|
||||||
|
|
||||||
|
var isUnsupported = string.IsNullOrEmpty(status) || status == "Unknown";
|
||||||
|
|
||||||
var btn = new Button
|
var btn = new Button
|
||||||
{
|
{
|
||||||
Content = status,
|
Content = isUnsupported ? "Power Unsupported" : status,
|
||||||
Width = 170,
|
Width = 170,
|
||||||
Tag = serialNumber,
|
Tag = serialNumber,
|
||||||
Style = (Style)FindResource("DarkButton")
|
Style = (Style)FindResource("DarkButton"),
|
||||||
|
IsEnabled = !isUnsupported
|
||||||
};
|
};
|
||||||
btn.Click += async (s, e) =>
|
|
||||||
|
if (!isUnsupported)
|
||||||
{
|
{
|
||||||
if (s is Button b && b.Tag is string sn)
|
btn.Click += async (s, e) =>
|
||||||
{
|
{
|
||||||
var current = await CMMCommand.GetMonPowerStatus(sn);
|
if (s is Button b && b.Tag is string sn)
|
||||||
if (current == "Sleep" || current == "PowerOff")
|
{
|
||||||
await CMMCommand.PowerOn(sn);
|
var current = await CMMCommand.GetMonPowerStatus(sn);
|
||||||
else
|
if (current == "Sleep" || current == "PowerOff")
|
||||||
await CMMCommand.Sleep(sn);
|
await CMMCommand.PowerOn(sn);
|
||||||
await Task.Delay(1000);
|
else
|
||||||
b.Content = await CMMCommand.GetMonPowerStatus(sn);
|
await CMMCommand.Sleep(sn);
|
||||||
}
|
await Task.Delay(1000);
|
||||||
};
|
b.Content = await CMMCommand.GetMonPowerStatus(sn);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
row.Children.Add(btn);
|
row.Children.Add(btn);
|
||||||
return row;
|
return row;
|
||||||
|
|||||||
Reference in New Issue
Block a user