98eed39fe6
Introduce a dedicated settings page that lets users reorder, hide, and pin/unpin folders per account. Folders are organized into Pinned, Categories (Gmail only), and More sections with drag-to-reorder via ListView. New Order column on MailItemFolder persists the custom layout; the default sort falls back to alphabetic when no custom order is set. A reset action wipes all customization in a single transaction and restores system-folder stickiness. Co-authored-by: Claude <noreply@anthropic.com>
39 lines
1.2 KiB
C#
39 lines
1.2 KiB
C#
using System.Collections.ObjectModel;
|
|
using Microsoft.UI.Xaml;
|
|
using Microsoft.UI.Xaml.Controls;
|
|
using Wino.Mail.ViewModels.Data;
|
|
using Wino.Views.Abstract;
|
|
|
|
namespace Wino.Views;
|
|
|
|
public sealed partial class FolderCustomizationPage : FolderCustomizationPageAbstract
|
|
{
|
|
public FolderCustomizationPage()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private async void ListView_DropCompleted(UIElement sender, Microsoft.UI.Xaml.Controls.Primitives.DropCompletedEventArgs args)
|
|
{
|
|
// ListView.CanReorderItems automatically mutates the backing
|
|
// ObservableCollection; persist the new order here.
|
|
await ViewModel.PersistLayoutAsync();
|
|
}
|
|
|
|
private async void PinToggle_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
if (sender is FrameworkElement element && element.DataContext is FolderCustomizationItemViewModel item)
|
|
{
|
|
await ViewModel.TogglePinAsync(item);
|
|
}
|
|
}
|
|
|
|
private async void HideToggle_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
if (sender is FrameworkElement element && element.DataContext is FolderCustomizationItemViewModel item)
|
|
{
|
|
await ViewModel.ToggleHiddenAsync(item);
|
|
}
|
|
}
|
|
}
|