Skip to content

Feature: Add network discovery prompt when turned off#18560

Open
0x5bfa wants to merge 1 commit into
files-community:mainfrom
0x5bfa:fix-9735
Open

Feature: Add network discovery prompt when turned off#18560
0x5bfa wants to merge 1 commit into
files-community:mainfrom
0x5bfa:fix-9735

Conversation

@0x5bfa

@0x5bfa 0x5bfa commented Jun 7, 2026

Copy link
Copy Markdown
Member

Resolved / Related Issues

Steps used to test these changes

  1. Turn off the Network Discovery from Settings > Network & internet > Advanced network settings > Advanced sharing settings
  2. Go to Network from the sidebar
image

Copilot AI review requested due to automatic review settings June 7, 2026 18:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds a Network Discovery warning InfoBar to the main UI when viewing an empty Network folder, with a shortcut into Windows network advanced settings.

Changes:

  • Introduces a ShellViewModel.IsNetworkDiscoveryInfoBarOpen flag and updates it based on folder emptiness and current directory.
  • Adds a new InfoBar to MainPage.xaml and wires it to the active pane’s ShellViewModel via PropertyChanged.
  • Simplifies GridLayoutPage.xaml grid row usage by removing explicit row definitions/assignments in the shown hunk.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/Files.App/Views/MainPage.xaml.cs Tracks active ShellViewModel to show/hide the Network Discovery InfoBar and handles InfoBar actions/events.
src/Files.App/Views/MainPage.xaml Adds the Network Discovery InfoBar and shifts grid rows to accommodate it.
src/Files.App/Views/Layouts/GridLayoutPage.xaml Removes explicit row definitions and Grid.Row assignments in the root grid snippet.
src/Files.App/ViewModels/ShellViewModel.cs Adds IsNetworkDiscoveryInfoBarOpen and sets it when in the Network folder and empty.
src/Files.App/Strings/en-US/Resources.resw Adds localized strings for the new InfoBar title/message.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/Files.App/Views/MainPage.xaml.cs Outdated
Comment thread src/Files.App/Views/MainPage.xaml.cs Outdated
Comment thread src/Files.App/Views/MainPage.xaml.cs Outdated
Comment thread src/Files.App/Views/MainPage.xaml.cs
Comment thread src/Files.App/Views/MainPage.xaml Outdated
@0x5bfa 0x5bfa force-pushed the fix-9735 branch 2 times, most recently from ee6962b to 67c5517 Compare June 7, 2026 18:50
@0x5bfa

0x5bfa commented Jun 7, 2026

Copy link
Copy Markdown
Member Author

We need better check for the network discovery being turned off. I have an idea.

<value>Open settings</value>
</data>
<data name="NetworkDiscoveryInfoBarTitle" xml:space="preserve">
<value>Network discovery might be turned off</value>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
<value>Network discovery might be turned off</value>
<value>Network discovery is turned off</value>

<value>Network discovery might be turned off</value>
</data>
<data name="NetworkDiscoveryInfoBarMessage" xml:space="preserve">
<value>Network devices may not appear when network discovery is turned off. Open Windows Settings to enable it.</value>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
<value>Network devices may not appear when network discovery is turned off. Open Windows Settings to enable it.</value>
<value>Network devices will not appear when network discovery is turned off. Open Windows Settings to enable it.</value>

</local:BaseGroupableLayoutPage.Resources>

<Grid x:Name="RootGrid" ContextFlyout="{x:Bind BaseContextMenuFlyout}">
<Grid.RowDefinitions>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why were the RowDefinitions removed?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

THis wasn't used and thought its not worth creating a separate PR.
Should I revert?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We might as well remove it, thanks for noticing!

TabIndex="2"
Visibility="{x:Bind ViewModel.ShowToolbar, Mode=OneWay}" />

<InfoBar

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is there a chance we'll want to reuse this info bar for other purposes as well? If so, we'll want to make it more generic with support for customizing the content and action.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I'm not sure. Since there's a Button specific to this scenario, I don't think we can reuse this InfoBar.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Sounds good for now, just something to keep in mind for the future.


private async void OpenNetworkAdvancedSettingsButton_Click(object sender, RoutedEventArgs e)
{
await Windows.System.Launcher.LaunchUriAsync(new Uri("ms-settings:network-advancedsettings"));

@Josh65-2201 Josh65-2201 Jun 7, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It would be better to have this directly enable it for the current network like Windows File Explorer does or go to ms-settings:network-advancedsharing as that where it can be enabled.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This would be ideal, but we should also consider the risks of modifying a setting in Windows from Files.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Not sure what risk there would be if it's done the same way as Windows File Explorer.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

File Explorer is signed by Windows, which means auto-elevation is supported by default. However Files is not signed by Windows so it requires to prompt a UAC dialog. I found the implementation of this pop bar in Explorer and did the same, it didn't work for Files (it did work on CLI though). I'm not sure it's that worth it to look into deeper.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I've discovered that if you create a Task Scheduler task with "Run with highest privileges" enabled, you can launch certain processes with administrative privileges simply by invoking that task.

image

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

We have an exact process for that purpose in Files.App.Server but it's not currently working (works but doesn't work for a certain case; when the consumer is launched as admin). When it gets resolved, we would certainly should add an option to directly enable this.

But for the time being, we should just let users open Settings and enable it.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

In that case, it can be change to go to ms-settings:network-advancedsharing as it's more direct way to enable it.

@mdtauk

mdtauk commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Just a slight aesthetic nit pick. Could you please adjust the corner radius for the InfoBar so it matches the pane rounding, and the toolbar rounding.

@yair100 yair100 added ready for review Pull requests that are ready for review changes requested Changes are needed for this pull request and removed ready for review Pull requests that are ready for review labels Jun 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changes requested Changes are needed for this pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: Prompt to enable network discovery when clicking the Network option

6 participants