增加排序功能

This commit is contained in:
liufei
2022-03-25 16:24:03 +08:00
parent 7d48b16900
commit c46f66b54d
11 changed files with 266 additions and 9 deletions

View File

@@ -3,7 +3,9 @@
public enum SortType
{
CUSTOM = 1, //自定义排序
NAME = 2, //按名称排
COUNT = 3 //按使用次数
COUNT_UP = 2, //按使用次数升
COUNT_LOW = 3, //按使用次数
NAME_UP = 4, //按名称升序
NAME_LOW = 5, //按名称降序
}
}

View File

@@ -1,6 +1,6 @@
using GeekDesk.Constant;
using GeekDesk.Control.Windows;
using GeekDesk.Thread;
using GeekDesk.MyThread;
using GeekDesk.Util;
using GeekDesk.ViewModel;
using HandyControl.Data;

View File

@@ -13,6 +13,7 @@
<UserControl.Resources>
<cvt:UpdateTypeConvert x:Key="UpdateTypeConvert"/>
<cvt:SortTypeConvert x:Key="SortTypeConvert"/>
</UserControl.Resources>
<Grid MouseDown="DragMove" Background="Transparent">
<hc:SimplePanel Margin="20" >
@@ -40,6 +41,45 @@
</CheckBox.Background>
</CheckBox>
</hc:UniformSpacingPanel>
<TextBlock Text="排序方式" Margin="0,25,0,0"/>
<hc:UniformSpacingPanel Spacing="10" Margin="20,8,0,0">
<RadioButton x:Name="CustomSort" Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
Style="{StaticResource RadioButtonIcon}" Content="自定义"
Tag="1"
hc:IconElement.Geometry="{StaticResource CustomSort}"
PreviewMouseLeftButtonDown="SortType_PreviewMouseLeftButtonDown"
IsChecked="{Binding IconSortType, Mode=OneWay, Converter={StaticResource SortTypeConvert}, ConverterParameter=1}"/>
<RadioButton x:Name="CountUpSort" Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
hc:IconElement.Geometry="{StaticResource UpSort}"
Style="{StaticResource RadioButtonIcon}" Content="使用次数"
Tag="2"
PreviewMouseLeftButtonDown="SortType_PreviewMouseLeftButtonDown"
IsChecked="{Binding IconSortType, Mode=OneWay, Converter={StaticResource SortTypeConvert}, ConverterParameter=2}"/>
<RadioButton x:Name="CountLowSort" Margin="10,0,0,0" Visibility="Collapsed" Background="{DynamicResource SecondaryRegionBrush}"
hc:IconElement.Geometry="{StaticResource LowSort}"
Style="{StaticResource RadioButtonIcon}" Content="使用次数"
Tag="3"
PreviewMouseLeftButtonDown="SortType_PreviewMouseLeftButtonDown"
IsChecked="{Binding IconSortType, Mode=OneWay, Converter={StaticResource SortTypeConvert}, ConverterParameter=3}"/>
<RadioButton x:Name="NameUpSort" Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
hc:IconElement.Geometry="{StaticResource UpSort}"
Style="{StaticResource RadioButtonIcon}" Content="名称"
Tag="4"
PreviewMouseLeftButtonDown="SortType_PreviewMouseLeftButtonDown"
IsChecked="{Binding IconSortType, Mode=OneWay, Converter={StaticResource SortTypeConvert}, ConverterParameter=4}"/>
<RadioButton x:Name="NameLowSort" Margin="10,0,0,0" Visibility="Collapsed" Background="{DynamicResource SecondaryRegionBrush}"
hc:IconElement.Geometry="{StaticResource LowSort}"
Style="{StaticResource RadioButtonIcon}" Content="名称"
Tag="5"
PreviewMouseLeftButtonDown="SortType_PreviewMouseLeftButtonDown"
IsChecked="{Binding IconSortType, Mode=OneWay, Converter={StaticResource SortTypeConvert}, ConverterParameter=5}"/>
</hc:UniformSpacingPanel>
<TextBlock Text="更新源" Margin="0,25,0,0"/>
<hc:UniformSpacingPanel Spacing="10" Margin="20,8,0,0">
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
@@ -56,6 +96,6 @@
</StackPanel>
</hc:SimplePanel>
</Grid>
</UserControl>

View File

@@ -26,6 +26,13 @@ namespace GeekDesk.Control.UserControls.Config
public OtherControl()
{
InitializeComponent();
this.Loaded += OtherControl_Loaded;
}
private void OtherControl_Loaded(object sender, RoutedEventArgs e)
{
Sort_Check();
}
private void SelfStartUpBox_Click(object sender, RoutedEventArgs e)
@@ -46,5 +53,70 @@ namespace GeekDesk.Control.UserControls.Config
Window.GetWindow(this).DragMove();
}
}
private void SortType_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
RadioButton rb = sender as RadioButton;
SortType type = (SortType)int.Parse(rb.Tag.ToString());
SortType resType = type;
switch (type)
{
case SortType.CUSTOM:
break;
case SortType.COUNT_UP:
if (rb.IsChecked == true)
{
CountLowSort.IsChecked = true;
CountUpSort.Visibility = Visibility.Collapsed;
CountLowSort.Visibility = Visibility.Visible;
resType = SortType.COUNT_LOW;
}
break;
case SortType.COUNT_LOW:
if (rb.IsChecked == true)
{
CountUpSort.IsChecked = true;
CountLowSort.Visibility = Visibility.Collapsed;
CountUpSort.Visibility = Visibility.Visible;
resType = SortType.COUNT_UP;
}
break;
case SortType.NAME_UP:
if (rb.IsChecked == true)
{
NameLowSort.IsChecked = true;
NameUpSort.Visibility = Visibility.Collapsed;
NameLowSort.Visibility = Visibility.Visible;
resType = SortType.NAME_LOW;
}
break;
case SortType.NAME_LOW:
if (rb.IsChecked == true)
{
NameUpSort.IsChecked = true;
NameLowSort.Visibility = Visibility.Collapsed;
NameUpSort.Visibility = Visibility.Visible;
resType = SortType.NAME_UP;
}
break;
}
MainWindow.appData.AppConfig.IconSortType = resType;
CommonCode.SortIconList();
}
private void Sort_Check()
{
if (NameLowSort.IsChecked == true)
{
NameUpSort.Visibility = Visibility.Collapsed;
NameLowSort.Visibility = Visibility.Visible;
}
if (CountLowSort.IsChecked == true)
{
CountUpSort.Visibility = Visibility.Collapsed;
CountLowSort.Visibility = Visibility.Visible;
}
}
}
}

View File

@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Data;
namespace GeekDesk.Converts
{
class SearchResWidth : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
double menuLeftWidth = double.Parse(value.ToString());
return MainWindow.mainWindow.Width - menuLeftWidth;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return null;
}
}
}

View File

@@ -0,0 +1,29 @@
using GeekDesk.Constant;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
namespace GeekDesk.Converts
{
public class SortTypeConvert : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return (SortType)value == (SortType)int.Parse(parameter.ToString());
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
bool isChecked = (bool)value;
if (!isChecked)
{
return null;
}
return (SortType)int.Parse(parameter.ToString());
}
}
}

View File

@@ -72,6 +72,9 @@
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="NPinyin.Core, Version=3.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\NPinyin.Core.3.0.0\lib\net45\NPinyin.Core.dll</HintPath>
</Reference>
<Reference Include="Quartz, Version=3.3.3.0, Culture=neutral, PublicKeyToken=f6b8c98a402cc8a4, processorArchitecture=MSIL">
<HintPath>packages\Quartz.3.3.3\lib\net472\Quartz.dll</HintPath>
</Reference>
@@ -189,6 +192,8 @@
</Compile>
<Compile Include="Converts\DoubleToGridLength.cs" />
<Compile Include="Converts\MenuInfoConvert.cs" />
<Compile Include="Converts\SearchResWidth.cs" />
<Compile Include="Converts\SortTypeConvert.cs" />
<Compile Include="Converts\TodoTaskExecConvert.cs" />
<Compile Include="Converts\IntToCornerRadius.cs" />
<Compile Include="Converts\OpcityConvert.cs" />
@@ -198,9 +203,9 @@
<Compile Include="Converts\HideTypeConvert.cs" />
<Compile Include="Interface\IWindowCommon.cs" />
<Compile Include="Task\ToDoTask.cs" />
<Compile Include="Thread\MouseHookThread.cs" />
<Compile Include="Thread\DispatcherBuild.cs" />
<Compile Include="Thread\UpdateThread.cs" />
<Compile Include="MyThread\MouseHookThread.cs" />
<Compile Include="MyThread\DispatcherBuild.cs" />
<Compile Include="MyThread\UpdateThread.cs" />
<Compile Include="Util\AeroGlassHelper.cs" />
<Compile Include="Util\GlobalHotKey.cs" />
<Compile Include="Util\CommonCode.cs" />
@@ -223,6 +228,7 @@
<Compile Include="Util\SvgToGeometry.cs" />
<Compile Include="ViewModel\AppConfig.cs" />
<Compile Include="ViewModel\AppData.cs" />
<Compile Include="ViewModel\Temp\SearchIconList.cs" />
<Compile Include="ViewModel\ToDoInfo.cs" />
<Compile Include="ViewModel\IconfontInfo.cs" />
<Compile Include="ViewModel\IconInfo.cs" />

View File

@@ -37,6 +37,7 @@
M512 0c282.775704 0 512 229.224296 512 512S794.775704 1024 512 1024 0 794.775704 0 512 229.224296 0 512 0zM303.407407 455.111111a56.888889 56.888889 0 1 0 0 113.777778 56.888889 56.888889 0 0 0 0-113.777778z m208.592593 0a56.888889 56.888889 0 1 0 0 113.777778 56.888889 56.888889 0 0 0 0-113.777778z m208.592593 0a56.888889 56.888889 0 1 0 0 113.777778 56.888889 56.888889 0 0 0 0-113.777778z
</Geometry>
<!--更新源-->
<Geometry x:Key="Gitee">
M512 0C230.4 0 0 230.4 0 512s230.4 512 512 512 512-230.4 512-512S793.6 0 512 0z m284.8 313.6c0 12.8-12.8 25.6-25.6 25.6H416c-41.6 0-76.8 35.2-76.8 76.8v243.2c0 12.8 12.8 25.6 25.6 25.6h240c41.6 0 76.8-35.2 76.8-76.8v-12.8c0-12.8-12.8-25.6-25.6-25.6H480c-12.8 0-25.6-12.8-25.6-25.6v-64c0-12.8 12.8-25.6 25.6-25.6h291.2c12.8 0 25.6 12.8 25.6 25.6v144c0 92.8-76.8 169.6-169.6 169.6H252.8c-12.8 0-25.6-12.8-25.6-25.6V412.8C227.2 310.4 310.4 224 416 224h355.2c12.8 0 25.6 12.8 25.6 25.6v64z
</Geometry>
@@ -44,6 +45,23 @@
<Geometry x:Key="GitHub">
M1021.72444445 512a495.16088889 495.16088889 0 0 1-97.57582223 299.64515555 500.62222222 500.62222222 0 0 1-250.85724444 184.22897778 30.58346667 30.58346667 0 0 1-26.2144-4.73315555 25.85031111 25.85031111 0 0 1-8.00995556-20.02488889v-139.81013334a119.05706667 119.05706667 0 0 0-34.58844444-94.29902222 473.31555555 473.31555555 0 0 0 67.72053333-11.65084444 248.30862222 248.30862222 0 0 0 62.2592-26.2144 187.50577778 187.50577778 0 0 0 53.52106667-43.69066667 209.35111111 209.35111111 0 0 0 36.40888889-69.90506667 334.2336 334.2336 0 0 0 13.83537778-100.12444444 191.87484445 191.87484445 0 0 0-52.7928889-136.53333333 176.21902222 176.21902222 0 0 0-5.09724444-135.44106667 87.01724445 87.01724445 0 0 0-53.52106666 7.28177778 341.87946667 341.87946667 0 0 0-61.16693334 29.12711111l-25.12213333 15.65582222a473.31555555 473.31555555 0 0 0-254.86222223 0c-7.28177778-5.09724445-16.384-10.55857778-28.03484444-17.84035555A371.00657778 371.00657778 0 0 0 300.82844445 220.72888889a94.29902222 94.29902222 0 0 0-57.16195556-9.10222222 178.40355555 178.40355555 0 0 0-4.73315556 136.53333333 197.70026667 197.70026667 0 0 0-52.4288 137.26151111A327.68 327.68 0 0 0 200.33991111 584.81777778a223.55057778 223.55057778 0 0 0 36.40888889 69.90506667 172.94222222 172.94222222 0 0 0 53.52106667 44.41884444 304.7424 304.7424 0 0 0 62.2592 26.2144 471.13102222 471.13102222 0 0 0 68.08462222 11.65084444 105.22168889 105.22168889 0 0 0-32.768 68.44871112 112.86755555 112.86755555 0 0 1-30.21937778 9.4663111 190.41848889 190.41848889 0 0 1-36.40888889 3.2768A78.6432 78.6432 0 0 1 274.61404445 803.27111111a124.5184 124.5184 0 0 1-36.4088889-41.50613333 109.22666667 109.22666667 0 0 0-32.03982222-34.58844445 91.7504 91.7504 0 0 0-32.768-16.01991111h-13.1072a47.33155555 47.33155555 0 0 0-19.29671111 2.91271111q-5.46133333 3.2768-3.2768 7.64586667a50.24426667 50.24426667 0 0 0 6.18951111 9.10222222 62.98737778 62.98737778 0 0 0 8.73813334 8.37404445l4.73315555 2.91271111a88.83768889 88.83768889 0 0 1 29.12711111 25.12213333 179.49582222 179.49582222 0 0 1 20.75306667 33.49617778l6.5536 15.29173333a82.28408889 82.28408889 0 0 0 29.12711111 41.14204445 109.22666667 109.22666667 0 0 0 44.05475556 18.93262222 223.18648889 223.18648889 0 0 0 45.8752 4.73315556 207.16657778 207.16657778 0 0 0 36.40888888-2.54862223l15.29173334-2.54862222v95.39128889a26.2144 26.2144 0 0 1-8.73813334 20.02488889 31.67573333 31.67573333 0 0 1-26.57848888 4.73315555 498.43768889 498.43768889 0 0 1-249.40088889-185.32124444A486.78684445 486.78684445 0 0 1 2.27555555 512a497.70951111 497.70951111 0 0 1 68.44871112-254.86222222A504.6272 504.6272 0 0 1 257.13777778 70.72426667 497.70951111 497.70951111 0 0 1 512 2.27555555a497.70951111 497.70951111 0 0 1 254.86222222 68.44871112A504.6272 504.6272 0 0 1 953.27573333 257.13777778 496.98133333 496.98133333 0 0 1 1021.72444445 512z
</Geometry>
<!--更新源-->
<!--排序方式-->
<Geometry x:Key="CustomSort">
M950.896028 907.262252 799.11209 753.232157c-12.108782-12.302187-31.893384-12.434194-44.163849-0.325411-12.286838 12.103666-12.434194 31.878035-0.325411 44.163849l151.783938 154.030096c6.110161 6.206352 14.177907 9.31311 22.24463 9.31311 7.919367 0 15.839757-2.989077 21.919219-8.987698C962.857455 939.323459 963.004811 919.54909 950.896028 907.262252z
M884.039341 602.546226c30.65723-17.944697 39.848567-39.624463 42.156122-54.645574 2.26253-14.700817 0.147356-37.530778-22.773679-62.84021-44.830021-49.441039-119.794363-128.689964-142.222165-152.352897-5.586229-32.177863-24.425296-139.980101-37.535895-206.1655-4.869914-24.50716-19.174712-44.387953-39.248909-54.53915-19.896142-10.060123-43.38102-9.739828-66.149583 0.919952-61.168128 28.716019-160.318312 77.455069-189.568497 91.861174-32.803103-3.975545-145.002488-17.466814-211.030297-24.145933-21.283746-2.170432-42.202171 5.363148-57.380872 20.608364-15.971763 16.038278-24.099884 38.928614-21.751397 61.238736 7.060813 67.115584 20.99415 179.407066 25.055652 211.919551-14.049994 29.635971-62.535265 132.146693-90.514503 194.163141-13.837146 30.555923-8.352225 53.30402-1.311879 67.004043 9.378601 18.249643 27.083845 31.165814 48.677653 35.461653 64.594157 12.617365 177.831174 32.345686 211.060997 38.104853 23.967878 22.915919 104.747669 99.984179 153.59826 144.738475 19.759019 18.116613 38.028105 22.941502 51.890834 22.941502 3.360538 0 6.461155-0.284479 9.261944-0.726547 14.365172-2.292206 34.922371-11.127432 51.245128-40.153512 33.336246-59.07342 87.722924-160.679539 103.425557-190.086289 28.390607-15.70775 124.57218-69.067029 183.102225-103.293551C884.029108 602.551342 884.034225 602.551342 884.039341 602.546226zM852.482625 548.642548c-68.234057 39.898709-188.638311 106.333794-189.842743 106.998943-5.301749 2.922563-9.642614 7.324826-12.484336 12.672624-0.681522 1.276063-68.345598 128.328737-107.075691 196.964954-2.948145 5.236258-5.428639 7.848759-6.699586 8.860808-1.514493-0.568958-4.666276-2.272763-9.06854-6.308683-57.065693-52.281737-158.473291-149.420101-159.490457-150.396335-4.493338-4.306072-10.17678-7.172353-16.312524-8.230452-1.428535-0.243547-143.858432-24.786523-218.98548-39.45664-2.917446-0.579191-4.793166-1.942235-5.195326-2.725064-0.457418-0.889253-0.873903-4.900613 2.673899-12.728906 32.568766-72.198346 93.310176-200.045105 93.920066-201.331401 2.562359-5.383614 3.523243-11.391445 2.780323-17.309224-0.178055-1.408069-17.827017-141.622508-26.047236-219.706911-0.381693-3.634784 1.183965-7.90504 3.89368-10.623965 2.115174-2.124384 4.122901-2.592035 5.779633-2.592035 0.37146 0 0.721431 0.020466 1.057075 0.056282 76.915787 7.777127 217.582527 24.954345 218.995713 25.127284 6.019087 0.726547 12.164041-0.310062 17.619286-2.99931 1.245364-0.615007 125.360126-61.899792 196.786898-95.439676 4.895497-2.297322 9.063423-2.922563 11.437493-1.733481 2.699482 1.367137 5.118578 5.67321 6.17156 10.959609 15.310707 77.302597 38.628786 212.590839 38.862099 213.947743 1.046842 6.089695 3.883447 11.732206 8.138354 16.211217 0.950651 0.9967 95.328136 100.345406 147.737786 158.14788 5.880941 6.491855 7.284917 10.608615 7.345292 11.30037C864.163665 539.349905 861.291245 543.483038 852.482625 548.642548z
M348.905458 492.080322c-12.169157-12.220323-31.948643-12.266371-44.168965-0.085958-12.220323 12.169157-12.261255 31.943526-0.085958 44.168965l22.676465 22.768563c6.099928 6.125511 14.111392 9.190313 22.127973 9.190313 7.970532 0 15.94618-3.035126 22.040992-9.104355 12.220323-12.169157 12.261255-31.948643 0.085958-44.168965L348.905458 492.080322z
M508.766352 376.774179c6.105045 6.125511 14.116509 9.190313 22.127973 9.190313 7.970532 0 15.94618-3.035126 22.040992-9.104355 12.220323-12.174274 12.261255-31.948643 0.085958-44.168965l-22.681582-22.768563c-12.17939-12.220323-31.948643-12.256138-44.168965-0.085958-12.220323 12.174274-12.261255 31.948643-0.085958 44.168965L508.766352 376.774179z
M564.67878 441.515692c-16.851806 3.680832-27.53103 20.322861-23.856337 37.174668 0.056282 0.248663 4.707209 25.564235-11.290137 41.621956-15.524578 15.575744-39.035038 11.153014-40.616046 10.832719-16.673751-3.715625-33.310663 6.668886-37.225833 23.352871-3.934612 16.790408 6.486738 33.596166 23.281239 37.535895 6.003737 1.408069 13.852496 2.409886 22.748097 2.409886 22.895453 0 52.745295-6.634094 76.067466-30.04734 32.16763-32.289404 32.777521-77.43972 28.065196-99.023294C598.167498 448.51613 581.51933 437.856349 564.67878 441.515692z
</Geometry>
<Geometry x:Key="UpSort">
M470.016 976.896q-44.032 0-59.392-20.48t-15.36-65.536q0-20.48-0.512-64.512t-1.024-93.696-1.536-96.768-1.024-74.752q0-39.936-7.68-62.464t-35.328-21.504q-20.48 0-48.64-1.024t-49.664 0q-35.84 0-45.568-19.456t13.824-50.176q24.576-30.72 57.344-72.704t67.584-86.016 68.096-87.04 58.88-75.776q23.552-29.696 45.568-30.72t46.592 26.624q24.576 29.696 56.832 69.632t67.072 82.432 68.608 83.968 60.416 73.216q29.696 35.84 23.04 58.88t-43.52 23.04q-11.264 0-25.088 0.512t-29.184 1.024-30.208 1.024-27.136 0.512q-25.6 1.024-32.256 16.384t-5.632 41.984q0 29.696 0.512 77.824t1.024 100.352 1.536 101.376 1.024 79.872q0 13.312-2.048 27.648t-9.728 26.112-21.504 19.968-36.352 8.192q-27.648 0-52.736 0.512t-56.832 1.536z
</Geometry>
<Geometry x:Key="LowSort">
M564.224 44.032q43.008 0 58.368 20.48t15.36 65.536q0 20.48 0.512 64.512t0.512 93.696 0.512 96.768 0.512 74.752q0 38.912 7.68 61.952t35.328 22.016q19.456 0 48.128 1.024t49.152 1.024q35.84 0 45.568 18.944t-13.824 49.664q-24.576 30.72-57.344 72.704t-68.096 86.016-69.12 86.528-59.392 75.264q-23.552 29.696-45.568 30.72t-45.568-27.648q-24.576-29.696-57.344-69.632t-67.072-82.432-67.584-83.968-59.904-74.24q-29.696-35.84-22.528-58.88t44.032-23.04l24.576 0q14.336 0 29.696-0.512t30.208-1.536 26.112-1.024q26.624 0 32.768-15.36t6.144-41.984q0-29.696-0.512-77.824t-0.512-100.352-0.512-101.376-0.512-79.872q0-13.312 2.048-27.648t9.728-26.112 20.992-19.456 36.864-7.68q27.648 0 53.248-0.512t57.344-0.512z
</Geometry>
<!--排序方式-->
</ResourceDictionary>

View File

@@ -1,6 +1,8 @@
using GeekDesk.Constant;
using GeekDesk.ViewModel;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Runtime.InteropServices;
using System.Runtime.Serialization.Formatters.Binary;
@@ -186,8 +188,39 @@ namespace GeekDesk.Util
/// <summary>
/// 排序图标
/// </summary>
public static void SortIconList()
{
if (MainWindow.appData.AppConfig.IconSortType != SortType.CUSTOM)
{
ObservableCollection<MenuInfo> menuList = MainWindow.appData.MenuList;
//List<IconInfo> list = new List<IconInfo>(menuList[MainWindow.appData.AppConfig.SelectedMenuIndex].IconList);
List<IconInfo> list;
foreach (MenuInfo menuInfo in menuList)
{
list = new List<IconInfo>(menuInfo.IconList);
switch (MainWindow.appData.AppConfig.IconSortType)
{
case SortType.COUNT_UP:
list.Sort((x, y) => x.Count.CompareTo(y.Count));
break;
case SortType.COUNT_LOW:
list.Sort((x, y) => y.Count.CompareTo(x.Count));
break;
case SortType.NAME_UP:
list.Sort((x, y) => x.Name.CompareTo(y.Name));
break;
case SortType.NAME_LOW:
list.Sort((x, y) => y.Name.CompareTo(x.Name));
break;
}
menuInfo.IconList = new ObservableCollection<IconInfo>(list);
}
MainWindow.appData.AppConfig.SelectedMenuIcons = MainWindow.appData.MenuList[MainWindow.appData.AppConfig.SelectedMenuIndex].IconList;
}
}
}
}

View File

@@ -0,0 +1,31 @@
using System.Collections.ObjectModel;
using System.ComponentModel;
namespace GeekDesk.ViewModel.Temp
{
public class SearchIconList
{
private static ObservableCollection<IconInfo> iconList = new ObservableCollection<IconInfo>();
public static ObservableCollection<IconInfo> IconList
{
get
{
return iconList;
}
set
{
iconList = value;
OnPropertyChanged("IconList");
}
}
public static event PropertyChangedEventHandler PropertyChanged;
private static void OnPropertyChanged(string propertyName)
{
PropertyChanged?.Invoke(null, new PropertyChangedEventArgs(propertyName));
}
}
}

View File

@@ -6,6 +6,7 @@
<package id="Microsoft.Extensions.Logging.Abstractions" version="2.1.1" targetFramework="net472" />
<package id="MouseKeyHook" version="5.6.0" targetFramework="net472" />
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net472" />
<package id="NPinyin.Core" version="3.0.0" targetFramework="net472" />
<package id="Quartz" version="3.3.3" targetFramework="net472" />
<package id="System.Buffers" version="4.5.1" targetFramework="net472" />
<package id="System.Diagnostics.DiagnosticSource" version="4.7.1" targetFramework="net472" />