From ab97c43a8fe6572eef4b431ae7a48ca8ffbee897 Mon Sep 17 00:00:00 2001 From: croire <1432593898@qq.com> Date: Wed, 12 Jan 2022 13:44:18 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E4=B8=8B=E8=BD=BD=E5=AE=8C?= =?UTF-8?q?=E6=88=90=E9=A1=B5=E9=9D=A2=E7=9A=84=E6=8E=92=E5=BA=8F=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ViewDownloadFinishedViewModel.cs | 32 +++++++++++++++++-- .../DownloadManager/ViewDownloadFinished.xaml | 7 ++-- 2 files changed, 34 insertions(+), 5 deletions(-) diff --git a/DownKyi/ViewModels/DownloadManager/ViewDownloadFinishedViewModel.cs b/DownKyi/ViewModels/DownloadManager/ViewDownloadFinishedViewModel.cs index ec28582..614e524 100644 --- a/DownKyi/ViewModels/DownloadManager/ViewDownloadFinishedViewModel.cs +++ b/DownKyi/ViewModels/DownloadManager/ViewDownloadFinishedViewModel.cs @@ -18,12 +18,34 @@ namespace DownKyi.ViewModels.DownloadManager set => SetProperty(ref downloadedList, value); } + private int finishedSortBy; + public int FinishedSortBy + { + get => finishedSortBy; + set => SetProperty(ref finishedSortBy, value); + } + #endregion public ViewDownloadFinishedViewModel(IEventAggregator eventAggregator) : base(eventAggregator) { // 初始化DownloadedList DownloadedList = App.DownloadedList; + + DownloadFinishedSort finishedSort = SettingsManager.GetInstance().GetDownloadFinishedSort(); + switch (finishedSort) + { + case DownloadFinishedSort.DOWNLOAD: + FinishedSortBy = 0; + break; + case DownloadFinishedSort.NUMBER: + FinishedSortBy = 1; + break; + default: + FinishedSortBy = 0; + break; + } + App.SortDownloadedList(finishedSort); } #region 命令申明 @@ -42,14 +64,20 @@ namespace DownKyi.ViewModels.DownloadManager switch (index) { - case 1: + case 0: App.SortDownloadedList(DownloadFinishedSort.DOWNLOAD); + // 更新设置 + SettingsManager.GetInstance().SetDownloadFinishedSort(DownloadFinishedSort.DOWNLOAD); break; - case 2: + case 1: App.SortDownloadedList(DownloadFinishedSort.NUMBER); + // 更新设置 + SettingsManager.GetInstance().SetDownloadFinishedSort(DownloadFinishedSort.NUMBER); break; default: App.SortDownloadedList(DownloadFinishedSort.DOWNLOAD); + // 更新设置 + SettingsManager.GetInstance().SetDownloadFinishedSort(DownloadFinishedSort.DOWNLOAD); break; } } diff --git a/DownKyi/Views/DownloadManager/ViewDownloadFinished.xaml b/DownKyi/Views/DownloadManager/ViewDownloadFinished.xaml index 3d317ba..27bbf81 100644 --- a/DownKyi/Views/DownloadManager/ViewDownloadFinished.xaml +++ b/DownKyi/Views/DownloadManager/ViewDownloadFinished.xaml @@ -245,14 +245,15 @@ Grid.Column="1" Width="120" HorizontalAlignment="Left" - VerticalAlignment="Center"> + VerticalAlignment="Center" + SelectedIndex="{Binding FinishedSortBy}"> - - + +