diff --git a/windows/Flock.Screenshots/ScreenshotSession.cs b/windows/Flock.Screenshots/ScreenshotSession.cs index 08c683d..5f769ae 100644 --- a/windows/Flock.Screenshots/ScreenshotSession.cs +++ b/windows/Flock.Screenshots/ScreenshotSession.cs @@ -2,6 +2,7 @@ using Flock.Tray.ViewModels; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Input; using Microsoft.UI.Xaml.Media; namespace Flock.Tray; @@ -79,6 +80,32 @@ internal async Task ShowAddDomain(string site, string domain) return window; } + /// A destructive confirmation, without changing the demo project folders. + internal async Task ShowRemoveProjectFolder() + { + var window = (SettingsWindow)await ShowSettings(SettingsPane.General); + await Settled(); + _ = window.Confirm("Remove C:\\Projects from project folders?", + "Its folders stop being served as sites. Nothing is deleted from disk.", "Remove", true); + await Settled(); + var dialog = VisualTreeHelper.GetOpenPopupsForXamlRoot(window.XamlRoot) + .Select(popup => popup.Child is { } child ? Find(child, _ => true) : null) + .FirstOrDefault(found => found is not null) + ?? throw new InvalidOperationException("The confirmation dialog did not open."); + var remove = Find - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - \ No newline at end of file + diff --git a/windows/Flock.Tray/Settings/ServicesPane.xaml.cs b/windows/Flock.Tray/Settings/ServicesPane.xaml.cs index 2f7b67e..211e80f 100644 --- a/windows/Flock.Tray/Settings/ServicesPane.xaml.cs +++ b/windows/Flock.Tray/Settings/ServicesPane.xaml.cs @@ -80,9 +80,9 @@ public void Select(string id) rows.SelectedId = id; } - private void FilterChanged(SelectorBar sender, SelectorBarSelectionChangedEventArgs args) + private void FilterChanged(object sender, RoutedEventArgs args) { - rows.ShowAll = sender.SelectedItem == Filter.Items[1]; + rows.ShowAll = ReferenceEquals(sender, AllFilter); } private void ModelChanged() @@ -103,7 +103,8 @@ private void ServiceSelected(object sender, RoutedEventArgs args) private void SelectedServiceChanged(ServiceViewModel? service) { - Filter.SelectedItem = Filter.Items[rows.ShowAll ? 1 : 0]; + AllFilter.IsChecked = rows.ShowAll; + InstalledFilter.IsChecked = !rows.ShowAll; if (service is null) { DetailHost.Content = Ui.EmptyState(Ui.GlyphServer, "No services"); @@ -351,4 +352,4 @@ private async Task EditPort(Service service) else await Model.Services.SetPortAsync(service.Id, port); } } -} \ No newline at end of file +} diff --git a/windows/Flock.Tray/Settings/SettingsWindow.xaml b/windows/Flock.Tray/Settings/SettingsWindow.xaml index 08a4cce..b729983 100644 --- a/windows/Flock.Tray/Settings/SettingsWindow.xaml +++ b/windows/Flock.Tray/Settings/SettingsWindow.xaml @@ -3,7 +3,7 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:Flock.Tray"> - + @@ -82,7 +82,7 @@ - + @@ -103,4 +103,4 @@ - \ No newline at end of file + diff --git a/windows/Flock.Tray/Settings/SettingsWindow.xaml.cs b/windows/Flock.Tray/Settings/SettingsWindow.xaml.cs index 59674ea..2c20b4a 100644 --- a/windows/Flock.Tray/Settings/SettingsWindow.xaml.cs +++ b/windows/Flock.Tray/Settings/SettingsWindow.xaml.cs @@ -290,4 +290,4 @@ public override async Task ReleaseAsync() } await base.ReleaseAsync(); } -} \ No newline at end of file +} diff --git a/windows/Flock.Tray/Ui.cs b/windows/Flock.Tray/Ui.cs index ef5d238..b64c5f7 100644 --- a/windows/Flock.Tray/Ui.cs +++ b/windows/Flock.Tray/Ui.cs @@ -55,6 +55,20 @@ internal static class Ui public static Brush Brush(string key) => Resource(key); + /// Uses the flyout palette without depending on an acrylic backdrop behind a constrained popup. + public static Style OpaqueMenuPresenterStyle() + { + var background = Brush("AcrylicBackgroundFillColorDefaultBrush"); + return new Style(typeof(MenuFlyoutPresenter)) + { + Setters = + { + new Setter(Control.BackgroundProperty, + background is AcrylicBrush acrylic ? new SolidColorBrush(acrylic.FallbackColor) : background), + }, + }; + } + public static Brush SecondaryText => Brush("TextFillColorSecondaryBrush"); public static Brush TertiaryText => Brush("TextFillColorTertiaryBrush"); public static Brush Success => Brush("SystemFillColorSuccessBrush"); @@ -384,20 +398,41 @@ public static async Task Confirm(XamlRoot root, string question, string de }; if (destructive) { - // The accent button style, recolored through the resources its template looks up (the - // same red in both themes, so white text stays readable). - dialog.PrimaryButtonStyle = Resource