Skip to content

[Repo Assist] refactor: eliminate duplicated Lerp/frame-constants in MainWindowΒ #135

Closed as not planned

Description

@github-actions

πŸ€– This pull request was created by Repo Assist, an automated AI assistant.

Summary

Removes two instances of copy-pasted logic from MainWindow.xaml.cs β€” no behaviour change.

Changes

1. Colour-temperature colour helper

SetColorTemperature and UpdateAdditionalMonitorWindows each contained an identical local Lerp closure plus identical cool/warm colour definitions and gradient-stop loop. Extracted into two private static helpers:

  • ComputeTemperatureColor(double temperature) β€” returns the interpolated Color
  • ApplyTemperatureColorToBrush(LinearGradientBrush brush, double temperature) β€” applies it to the inner gradient stops

Both call sites are now one line each.

2. Frame geometry constants

CreateFrameGeometry, CreateMonitorWindow, and UpdateMonitorGeometry each declared the same three local constants:

const double frameThickness = 80;
const double outerRadius    = 100;
const double innerRadius    = 60;

Promoted to class-level private const fields (FrameThickness, FrameOuterRadius, FrameInnerRadius). Any future adjustment to the frame shape now requires a single edit.

Test Status

Build: 0 errors, 0 warnings (dotnet build -p:EnableWindowsTargeting=true)

Note

πŸ”’ Integrity filter blocked 1 item

The following item were blocked because they don't meet the GitHub integrity level.

To allow these resources, lower min-integrity in your GitHub frontmatter:

tools:
  github:
    min-integrity: approved  # merged | approved | unapproved | none

Generated by Repo Assist Β· ● 2.9M Β· β—·

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@cbb46ab386962aa371045839fc9998ee4e97ca64

Note

This was originally intended as a pull request, but GitHub Actions is not permitted to create or approve pull requests in this repository.
The changes have been pushed to branch repo-assist/improve-dedup-2026-07-14-e0d27251d48fa4c9.

Click here to create the pull request

To fix the permissions issue, go to Settings β†’ Actions β†’ General and enable Allow GitHub Actions to create and approve pull requests. See also: gh-aw FAQ

Show patch preview (175 of 175 lines)
From 0b6f267b4dd6b3bab99284299c9c5e8cdb353ac4 Mon Sep 17 00:00:00 2001
From: "github-actions[bot]" <github-actions[bot]@users.noreply.github.com>
Date: Tue, 14 Jul 2026 01:16:20 +0000
Subject: [PATCH] refactor: eliminate duplicated Lerp/frame-constants in
 MainWindow

- Add ComputeTemperatureColor and ApplyTemperatureColorToBrush helpers,
  replacing identical local Lerp closures in SetColorTemperature and
  UpdateAdditionalMonitorWindows
- Promote FrameThickness / FrameOuterRadius / FrameInnerRadius to
  class-level constants, replacing three separate sets of identical
  local const declarations in CreateFrameGeometry, CreateMonitorWindow,
  and UpdateMonitorGeometry

No behaviour change. Build: 0 errors, 0 warnings.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---
 WindowsEdgeLight/MainWindow.xaml.cs | 97 ++++++++++++-----------------
 1 file changed, 39 insertions(+), 58 deletions(-)

diff --git a/WindowsEdgeLight/MainWindow.xaml.cs b/WindowsEdgeLight/MainWindow.xaml.cs
index 3644301..b8f58c7 100644
--- a/WindowsEdgeLight/MainWindow.xaml.cs
+++ b/WindowsEdgeLight/MainWindow.xaml.cs
@@ -26,6 +26,11 @@ public partial class MainWindow : Window
     private const double MinColorTemp = 0.0;
     private const double MaxColorTemp = 1.0;
 
+    // Frame geometry constants (shared by CreateFrameGeometry, CreateMonitorWindow, UpdateMonitorGeometry)
+    private const double FrameThickness = 80;
+    private const double FrameOuterRadius = 100;
+    private const double FrameInnerRadius = 60;
+
     // DPI Scale
     private double _dpiScaleX = 1.0;
     private double _dpiScaleY = 1.0;
@@ -570,9 +575,9 @@ Version {version}";
         double width = this.ActualWidth - 40;  // 20px margin on each side
         double height = this.ActualHeight - 40;
         
-        const double frameThickness = 80;
-        const double outerRadius = 100;  // Extra rounded like macOS
-        const double innerRadius = 60;   // Keep proportional
+        const do
... (truncated)

Activity

  1. shanselman commented on Aug 8, 2026

    @shanselman
    Owner

    Refactor-only churn does not meet the significance bar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions