Skip to content

Conversation

@Jaylyn-Barbee
Copy link
Contributor

Summary of the Pull Request

This PR introduces new UI to allow the users to manually enter their lat/long.

PR Checklist

@Jaylyn-Barbee Jaylyn-Barbee changed the title Feature/lightswitch manual location [Light Switch] Enter latitude and longitude manually in Sunrise to sunset mode Nov 4, 2025
@Jaylyn-Barbee Jaylyn-Barbee marked this pull request as ready for review November 4, 2025 17:48
@Jaylyn-Barbee
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

private async Task GetGeoLocation()
private async void GetGeoLocation_Click(object sender, RoutedEventArgs e)
{
SyncButton.IsEnabled = false;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the lat/lon textboxes be disabled too?

ViewModel.Latitude = lat.ToString(CultureInfo.InvariantCulture);
ViewModel.Longitude = lon.ToString(CultureInfo.InvariantCulture);

LocationResultPanel.Visibility = Visibility.Visible;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do run this method too when manually entering values?

Should the save button be disabled ubtil we checked if the entered values are actual numbers?

@niels9001 niels9001 requested a review from Copilot November 5, 2025 06:22
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates the Light Switch location dialog to improve user experience by allowing manual latitude/longitude entry alongside automatic location detection. The primary button changes from "Select" to "Save" and the UI is reorganized to present input fields and a detect button together.

  • Adds manual latitude/longitude number boxes for direct user input
  • Replaces auto-trigger geolocation on dialog open with an explicit "Detect location" button
  • Restructures location result panel to display sunrise/sunset times more clearly

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
Resources.resw Updates button labels and resource strings, adds new latitude/longitude headers and detection button text
LightSwitchPage.xaml.cs Refactors geolocation from auto-trigger to button click handler, adds value change handler for manual coordinate entry
LightSwitchPage.xaml Restructures location dialog UI with number input boxes, repositions detect button, and adjusts result panel layout
Comments suppressed due to low confidence (3)

src/settings-ui/Settings.UI/SettingsXAML/Views/LightSwitchPage.xaml:1

  • Inconsistent indentation: this line uses a tab character while surrounding lines use spaces. The file should maintain consistent indentation throughout.
<?xml version="1.0" encoding="utf-8" ?>

src/settings-ui/Settings.UI/SettingsXAML/Views/LightSwitchPage.xaml:1

  • Inconsistent indentation: this line uses a tab character while surrounding lines use spaces. The file should maintain consistent indentation throughout.
<?xml version="1.0" encoding="utf-8" ?>

src/settings-ui/Settings.UI/SettingsXAML/Views/LightSwitchPage.xaml:1

  • Inconsistent indentation: this line uses a tab character while surrounding lines use spaces. The file should maintain consistent indentation throughout.
<?xml version="1.0" encoding="utf-8" ?>

ViewModel.Latitude = lat.ToString(CultureInfo.InvariantCulture);
ViewModel.Longitude = lon.ToString(CultureInfo.InvariantCulture);

LocationResultPanel.Visibility = Visibility.Visible;
Copy link

Copilot AI Nov 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The LatLonBox_ValueChanged handler does not enable the primary button when valid coordinates are entered. The GetGeoLocation_Click handler sets LocationDialog.IsPrimaryButtonEnabled = true on line 138, but this handler does not. Users who manually enter valid coordinates cannot save them because the primary button remains disabled (initialized to False on line 203 of the XAML).

Suggested change
LocationResultPanel.Visibility = Visibility.Visible;
LocationResultPanel.Visibility = Visibility.Visible;
// Enable the primary button when valid coordinates are entered
if (LocationDialog != null)
{
LocationDialog.IsPrimaryButtonEnabled = true;
}

Copilot uses AI. Check for mistakes.
@niels9001 niels9001 added this to the PowerToys 0.96 milestone Nov 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Light Switch: Setting location manually without maps

3 participants