mirror of
https://github.com/vbondarevsky/OneCleaner.git
synced 2025-02-14 20:14:58 +02:00
Merge branch 'release/v1.2'
This commit is contained in:
commit
4e5992bf56
@ -8,6 +8,7 @@
|
||||
DispatcherUnhandledException="App_DispatcherUnhandledException">
|
||||
<Application.Resources>
|
||||
<System:Double x:Key="ItemFontSize">16</System:Double>
|
||||
<SolidColorBrush x:Key="ItemBrush" Color="Black"/>
|
||||
<System:Double x:Key="DetailItemFontSize">11</System:Double>
|
||||
<FontStyle x:Key="DetailItemFontStyle">Italic</FontStyle>
|
||||
<SolidColorBrush x:Key="DetailItemBrush" Color="Gray"/>
|
||||
|
@ -6,6 +6,7 @@ namespace OneCleaner
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string Version { get; set; }
|
||||
public long VersionInt { get; set; }
|
||||
public string UUID { get; set; }
|
||||
public string Location { get; set; }
|
||||
public DateTime InstallDate { get; set; }
|
||||
|
@ -75,10 +75,13 @@ namespace OneCleaner
|
||||
if (name == null || !IsPlatform1C(vendor) || String.IsNullOrEmpty(location))
|
||||
continue;
|
||||
|
||||
var v = version.Split('.');
|
||||
long versionInt = long.Parse(v[0].PadLeft(2, '0') + v[1].PadLeft(2, '0') + v[2].PadLeft(3, '0') + v[3].PadLeft(5, '0'));
|
||||
InstalledVersion instVerItem = new InstalledVersion
|
||||
{
|
||||
Name = name,
|
||||
Version = version,
|
||||
VersionInt = versionInt,
|
||||
UUID = itemUUID,
|
||||
Location = location,
|
||||
InstallDate = DateTime.ParseExact(dateStr, "yyyyMMdd", CultureInfo.InvariantCulture),
|
||||
@ -90,7 +93,7 @@ namespace OneCleaner
|
||||
}
|
||||
}
|
||||
|
||||
return installedVersions;
|
||||
return installedVersions.OrderBy(i => i.VersionInt).ToList();
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@
|
||||
<WebPage>publish.htm</WebPage>
|
||||
<OpenBrowserOnPublish>false</OpenBrowserOnPublish>
|
||||
<ApplicationRevision>3</ApplicationRevision>
|
||||
<ApplicationVersion>1.1.0.%2a</ApplicationVersion>
|
||||
<ApplicationVersion>1.2.0.%2a</ApplicationVersion>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<PublishWizardCompleted>true</PublishWizardCompleted>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
|
@ -49,5 +49,5 @@ using System.Windows;
|
||||
// Можно задать все значения или принять номер сборки и номер редакции по умолчанию.
|
||||
// используя "*", как показано ниже:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.1.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.1.0.0")]
|
||||
[assembly: AssemblyVersion("1.2.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.2.0.0")]
|
||||
|
@ -16,74 +16,35 @@
|
||||
<local:StatusToTextConverter x:Key="StatusToTextConverter"/>
|
||||
<local:LongToSizeStringConverter x:Key="LongToSizeStringConverter"/>
|
||||
<local:StatusToTaskbarStatusConverter x:Key="StatusToTaskbarStatusConverter"/>
|
||||
|
||||
<DataTemplate x:Key="installedVersionItem" DataType="local:InstalledVersionItemViewModel">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="25"/>
|
||||
<ColumnDefinition Width="400"/>
|
||||
<ColumnDefinition Width="100"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<CheckBox Grid.Column="0" IsChecked="{Binding IsChecked}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
|
||||
<StackPanel Grid.Column="1">
|
||||
<TextBlock Text="{Binding Name}" FontSize="{DynamicResource ItemFontSize}"/>
|
||||
<TextBlock Text="{Binding InstallDate, StringFormat=\{0:dd.MM.yyyy\}}" FontStyle="{DynamicResource DetailItemFontStyle}" FontSize="{DynamicResource DetailItemFontSize}" Foreground="{DynamicResource DetailItemBrush}"/>
|
||||
</StackPanel>
|
||||
<TextBlock Grid.Column="2" Text="{Binding Size, Converter={StaticResource LongToSizeStringConverter}}" HorizontalAlignment="Right" FontSize="{DynamicResource ItemFontSize}"/>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate x:Key="cacheItem" DataType="local:CacheItemViewModel">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="25"/>
|
||||
<ColumnDefinition Width="400"/>
|
||||
<ColumnDefinition Width="100"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<CheckBox Grid.Column="0" IsChecked="{Binding IsChecked}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
|
||||
<StackPanel Grid.Column="1">
|
||||
<TextBlock Text="{Binding Name}" FontSize="{DynamicResource ItemFontSize}"/>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="{Binding UUID}" FontStyle="{DynamicResource DetailItemFontStyle}" FontSize="{DynamicResource DetailItemFontSize}" Foreground="{DynamicResource {x:Static SystemColors.ControlDarkBrushKey}}"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
<TextBlock Grid.Column="2" Text="{Binding Size, Converter={StaticResource LongToSizeStringConverter}}" HorizontalAlignment="Right" FontSize="{DynamicResource ItemFontSize}"/>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate x:Key="infoBaseItem" DataType="local:InfoBaseItemViewModel">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="25"/>
|
||||
<ColumnDefinition Width="400"/>
|
||||
<ColumnDefinition Width="100"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<CheckBox Grid.Column="0" IsChecked="{Binding IsChecked}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
|
||||
<StackPanel Grid.Column="1">
|
||||
<TextBlock Text="{Binding Name}" FontSize="{DynamicResource ItemFontSize}" TextWrapping="Wrap" />
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<TextBlock Text="{Binding Connection}" FontStyle="{DynamicResource DetailItemFontStyle}" FontSize="{DynamicResource DetailItemFontSize}" Foreground="{DynamicResource {x:Static SystemColors.ControlDarkBrushKey}}"/>
|
||||
<TextBlock Text="{Binding Version}" FontStyle="{DynamicResource DetailItemFontStyle}" FontSize="{DynamicResource DetailItemFontSize}" Foreground="{DynamicResource {x:Static SystemColors.ControlDarkBrushKey}}"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
<TextBlock Grid.Column="2" Text="{Binding Size, Converter={StaticResource LongToSizeStringConverter}}" HorizontalAlignment="Right" FontSize="{DynamicResource ItemFontSize}"/>
|
||||
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
<Style x:Key="HeaderStyle" TargetType="GridViewColumnHeader">
|
||||
<Setter Property="HorizontalContentAlignment" Value="Left" />
|
||||
</Style>
|
||||
<Style TargetType="ListViewItem">
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
|
||||
</Style>
|
||||
<Style TargetType="TextBox" xmlns:sys="clr-namespace:System;assembly=mscorlib">
|
||||
<Style.Resources>
|
||||
<VisualBrush x:Key="CueBannerBrush" AlignmentX="Left" AlignmentY="Center" Stretch="None">
|
||||
<VisualBrush.Visual>
|
||||
<Label Content="Фильтр" Foreground="LightGray" />
|
||||
</VisualBrush.Visual>
|
||||
</VisualBrush>
|
||||
</Style.Resources>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="Text" Value="{x:Static sys:String.Empty}">
|
||||
<Setter Property="Background" Value="{StaticResource CueBannerBrush}" />
|
||||
</Trigger>
|
||||
<Trigger Property="Text" Value="{x:Null}">
|
||||
<Setter Property="Background" Value="{StaticResource CueBannerBrush}" />
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Window.Resources>
|
||||
<Window.TaskbarItemInfo>
|
||||
<TaskbarItemInfo ProgressValue="{Binding Progress}" ProgressState="{Binding Status, Converter={StaticResource StatusToTaskbarStatusConverter}}"/>
|
||||
</Window.TaskbarItemInfo>
|
||||
<Grid Name="MainGrid">
|
||||
<TabControl>
|
||||
|
||||
<TabItem>
|
||||
<TabItem.Header>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
@ -96,6 +57,7 @@
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="32"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="16"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
|
||||
@ -107,14 +69,56 @@
|
||||
<Image Source="../Resource/unchecked.png" Stretch="None" />
|
||||
</Button>
|
||||
</StackPanel>
|
||||
<StackPanel HorizontalAlignment="Right" Grid.Column="1" Grid.Row="0" VerticalAlignment="Center">
|
||||
<StackPanel HorizontalAlignment="Right" Grid.Column="1" Grid.Row="0" VerticalAlignment="Center" Orientation="Horizontal">
|
||||
<TextBox Text="{Binding InstalledVersionsFilter, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Width="130" Margin="0,0,10,0" Padding="0" FontSize="16" />
|
||||
<Button Content="{Binding Status, Converter={StaticResource StatusToTextConverter}, Mode=OneWay}" Height="25" Width="110" Command="{Binding UninstallCommand}"/>
|
||||
</StackPanel>
|
||||
<ListView
|
||||
ItemsSource="{Binding InstalledVersions}"
|
||||
ItemTemplate="{StaticResource installedVersionItem}"
|
||||
PreviewKeyDown="List_PreviewKeyDown"
|
||||
Grid.Row="1" />
|
||||
Grid.Row="1">
|
||||
<ListView.View>
|
||||
<GridView>
|
||||
<GridView.Columns>
|
||||
<GridViewColumn Width="30">
|
||||
<GridViewColumn.Header>
|
||||
<GridViewColumnHeader Command="{Binding InstalledVersionsSortCommand}" CommandParameter="{Binding Tag, RelativeSource={RelativeSource Self}}" Tag="IsChecked"></GridViewColumnHeader>
|
||||
</GridViewColumn.Header>
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<CheckBox IsChecked="{Binding IsChecked}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
|
||||
<GridViewColumn Width="400">
|
||||
<GridViewColumn.Header>
|
||||
<GridViewColumnHeader Command="{Binding InstalledVersionsSortCommand}" CommandParameter="{Binding Tag, RelativeSource={RelativeSource Self}}" Tag="Version">Программа</GridViewColumnHeader>
|
||||
</GridViewColumn.Header>
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel>
|
||||
<TextBlock Text="{Binding Name}" FontSize="{DynamicResource ItemFontSize}" Foreground="{DynamicResource ItemBrush}"/>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
|
||||
<GridViewColumn Width="100">
|
||||
<GridViewColumn.Header>
|
||||
<GridViewColumnHeader Command="{Binding InstalledVersionsSortCommand}" CommandParameter="{Binding Tag, RelativeSource={RelativeSource Self}}" Tag="Size">Размер</GridViewColumnHeader>
|
||||
</GridViewColumn.Header>
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Size, Converter={StaticResource LongToSizeStringConverter}}" HorizontalAlignment="Right" FontSize="{DynamicResource ItemFontSize}" Foreground="{DynamicResource ItemBrush}"/>
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
|
||||
</GridView.Columns>
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
<TextBlock TextWrapping="Wrap"
|
||||
Text="Получение списка установленных версий..."
|
||||
HorizontalAlignment="Center"
|
||||
@ -122,7 +126,13 @@
|
||||
FontSize="18"
|
||||
Foreground="#FF9C9C9C"
|
||||
Grid.Row="1" Visibility="{Binding InstalledVersionsArePopulating, Converter={StaticResource BooleanToVisibilityConverter}, Mode=OneWay}" />
|
||||
|
||||
<StackPanel Grid.Row="2" Orientation="Horizontal">
|
||||
<TextBlock Text="Всего: "/>
|
||||
<TextBlock Text="{Binding InstalledVersionsTotalSize, Converter={StaticResource LongToSizeStringConverter}, Mode=OneWay}" FontWeight="Bold"/>
|
||||
<TextBlock Text=" "/>
|
||||
<TextBlock Text="К удалению: "/>
|
||||
<TextBlock Text="{Binding InstalledVersionsFreeSize, Converter={StaticResource LongToSizeStringConverter}, Mode=OneWay}" FontWeight="Bold"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
<TabItem>
|
||||
@ -137,6 +147,7 @@
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="32"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="16"/>
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel HorizontalAlignment="Left" Grid.Column="0" Grid.Row="0" Orientation="Horizontal">
|
||||
<Button Margin="0,3" Background="{x:Null}" BorderThickness="0.4" Command="{Binding SelectAllCommand}" Width="25" Height="25" HorizontalContentAlignment="Center" CommandParameter="{Binding Cache}">
|
||||
@ -146,14 +157,54 @@
|
||||
<Image Source="../Resource/unchecked.png" Stretch="None" />
|
||||
</Button>
|
||||
</StackPanel>
|
||||
<StackPanel HorizontalAlignment="Right" Grid.Column="1" Grid.Row="0" VerticalAlignment="Center">
|
||||
<StackPanel HorizontalAlignment="Right" Grid.Column="1" Grid.Row="0" VerticalAlignment="Center" Orientation="Horizontal">
|
||||
<TextBox Text="{Binding CacheFilter, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Width="130" Margin="0,0,10,0" Padding="0" FontSize="16" />
|
||||
<Button Command="{Binding RemoveCacheCommand}" Content="Удалить" Height="25" Width="110" />
|
||||
</StackPanel>
|
||||
<ListView
|
||||
ItemsSource="{Binding Cache}"
|
||||
ItemTemplate="{StaticResource cacheItem}"
|
||||
PreviewKeyDown="List_PreviewKeyDown"
|
||||
Grid.Row="1" />
|
||||
Grid.Row="1">
|
||||
<ListView.View>
|
||||
<GridView>
|
||||
<GridView.Columns>
|
||||
<GridViewColumn Width="30">
|
||||
<GridViewColumn.Header>
|
||||
<GridViewColumnHeader Command="{Binding CacheSortCommand}" CommandParameter="{Binding Tag, RelativeSource={RelativeSource Self}}" Tag="IsChecked"/>
|
||||
</GridViewColumn.Header>
|
||||
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<CheckBox IsChecked="{Binding IsChecked}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
|
||||
<GridViewColumn Width="400">
|
||||
<GridViewColumn.Header>
|
||||
<GridViewColumnHeader Command="{Binding CacheSortCommand}" CommandParameter="{Binding Tag, RelativeSource={RelativeSource Self}}" Tag="Name">Информационная база</GridViewColumnHeader>
|
||||
</GridViewColumn.Header>
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Name}" FontSize="{DynamicResource ItemFontSize}" Foreground="{DynamicResource ItemBrush}"/>
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
|
||||
<GridViewColumn Width="100">
|
||||
<GridViewColumn.Header>
|
||||
<GridViewColumnHeader Command="{Binding CacheSortCommand}" CommandParameter="{Binding Tag, RelativeSource={RelativeSource Self}}" Tag="Size">Размер</GridViewColumnHeader>
|
||||
</GridViewColumn.Header>
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Size, Converter={StaticResource LongToSizeStringConverter}}" TextAlignment="Right" FontSize="{DynamicResource ItemFontSize}" Foreground="{DynamicResource ItemBrush}"/>
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
</GridView.Columns>
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
|
||||
<TextBlock TextWrapping="Wrap"
|
||||
Text="Получение кэша метаданных..."
|
||||
@ -162,6 +213,13 @@
|
||||
FontSize="18"
|
||||
Foreground="#FF9C9C9C"
|
||||
Grid.Row="1" Visibility="{Binding CacheArePopulating, Converter={StaticResource BooleanToVisibilityConverter}, Mode=OneWay}" />
|
||||
<StackPanel Grid.Row="2" Orientation="Horizontal">
|
||||
<TextBlock Text="Всего: "/>
|
||||
<TextBlock Text="{Binding CacheTotalSize, Converter={StaticResource LongToSizeStringConverter}, Mode=OneWay}" FontWeight="Bold"/>
|
||||
<TextBlock Text=" "/>
|
||||
<TextBlock Text="К удалению: "/>
|
||||
<TextBlock Text="{Binding CacheFreeSize, Converter={StaticResource LongToSizeStringConverter}, Mode=OneWay}" FontWeight="Bold"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
<TabItem>
|
||||
@ -176,6 +234,7 @@
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="32"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="16"/>
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel HorizontalAlignment="Left" Grid.Column="0" Grid.Row="0" Orientation="Horizontal">
|
||||
<Button Margin="0,3" Background="{x:Null}" BorderThickness="0.4" Command="{Binding SelectAllCommand}" Width="25" Height="25" HorizontalContentAlignment="Center" CommandParameter="{Binding InfoBases}">
|
||||
@ -185,14 +244,63 @@
|
||||
<Image Source="../Resource/unchecked.png" Stretch="None" />
|
||||
</Button>
|
||||
</StackPanel>
|
||||
<StackPanel HorizontalAlignment="Right" Grid.Column="1" Grid.Row="0" VerticalAlignment="Center">
|
||||
<StackPanel HorizontalAlignment="Right" Grid.Column="1" Grid.Row="0" VerticalAlignment="Center" Orientation="Horizontal">
|
||||
<TextBox Text="{Binding InfoBasesFilter, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Width="130" Margin="0,0,10,0" Padding="0" FontSize="16" />
|
||||
<Button Command="{Binding RemoveInfoBaseCommand}" Content="Удалить" Height="25" Width="110" />
|
||||
</StackPanel>
|
||||
<ListView
|
||||
ItemsSource="{Binding InfoBases}"
|
||||
ItemTemplate="{StaticResource infoBaseItem}"
|
||||
PreviewKeyDown="List_PreviewKeyDown"
|
||||
Grid.Row="1" />
|
||||
Grid.Row="1">
|
||||
<ListView.View>
|
||||
<GridView>
|
||||
<GridView.Columns>
|
||||
<GridViewColumn Width="30">
|
||||
<GridViewColumn.Header>
|
||||
<GridViewColumnHeader Command="{Binding InfoBasesSortCommand}" CommandParameter="{Binding Tag, RelativeSource={RelativeSource Self}}" Tag="IsChecked"/>
|
||||
</GridViewColumn.Header>
|
||||
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<CheckBox IsChecked="{Binding IsChecked}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
|
||||
<GridViewColumn Width="400">
|
||||
<GridViewColumn.Header>
|
||||
<GridViewColumnHeader Command="{Binding InfoBasesSortCommand}" CommandParameter="{Binding Tag, RelativeSource={RelativeSource Self}}" Tag="Name">Информационная база</GridViewColumnHeader>
|
||||
</GridViewColumn.Header>
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Grid.Column="1">
|
||||
<TextBlock Text="{Binding Name}" FontSize="{DynamicResource ItemFontSize}" TextWrapping="Wrap" Foreground="{DynamicResource ItemBrush}"/>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<TextBlock Text="{Binding Connection}" FontStyle="{DynamicResource DetailItemFontStyle}" FontSize="{DynamicResource DetailItemFontSize}" Foreground="{DynamicResource {x:Static SystemColors.ControlDarkBrushKey}}"/>
|
||||
<TextBlock Text="{Binding Version}" FontStyle="{DynamicResource DetailItemFontStyle}" FontSize="{DynamicResource DetailItemFontSize}" Foreground="{DynamicResource {x:Static SystemColors.ControlDarkBrushKey}}"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
|
||||
<GridViewColumn Width="100">
|
||||
<GridViewColumn.Header>
|
||||
<GridViewColumnHeader Command="{Binding InfoBasesSortCommand}" CommandParameter="{Binding Tag, RelativeSource={RelativeSource Self}}" Tag="Size">Размер</GridViewColumnHeader>
|
||||
</GridViewColumn.Header>
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Size, Converter={StaticResource LongToSizeStringConverter}}" TextAlignment="Right" FontSize="{DynamicResource ItemFontSize}" Foreground="{DynamicResource ItemBrush}" VerticalAlignment="Top"/>
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
|
||||
</GridView.Columns>
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
|
||||
<TextBlock TextWrapping="Wrap"
|
||||
Text="Получение списка информационных баз..."
|
||||
@ -201,7 +309,13 @@
|
||||
FontSize="18"
|
||||
Foreground="#FF9C9C9C"
|
||||
Grid.Row="1" Visibility="{Binding InfoBasesArePopulating, Converter={StaticResource BooleanToVisibilityConverter}, Mode=OneWay}" />
|
||||
|
||||
<StackPanel Grid.Row="2" Orientation="Horizontal">
|
||||
<TextBlock Text="Всего: "/>
|
||||
<TextBlock Text="{Binding InfoBasesTotalSize, Converter={StaticResource LongToSizeStringConverter}, Mode=OneWay}" FontWeight="Bold"/>
|
||||
<TextBlock Text=" "/>
|
||||
<TextBlock Text="К удалению: "/>
|
||||
<TextBlock Text="{Binding InfoBasesFreeSize, Converter={StaticResource LongToSizeStringConverter}, Mode=OneWay}" FontWeight="Bold"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
|
@ -4,7 +4,7 @@ namespace OneCleaner
|
||||
{
|
||||
public class InstalledVersionItemViewModel : BaseItemViewModel
|
||||
{
|
||||
public string Version { get; set; }
|
||||
public long Version { get; set; }
|
||||
public DateTime InstallDate { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Collections.Specialized;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Input;
|
||||
@ -12,6 +13,59 @@ namespace OneCleaner
|
||||
public Status Status { get; private set; }
|
||||
public double Progress { get; private set; }
|
||||
|
||||
public long InstalledVersionsTotalSize { get; private set; }
|
||||
public long InstalledVersionsFreeSize { get; private set; }
|
||||
public long CacheTotalSize { get; private set; }
|
||||
public long CacheFreeSize { get; private set; }
|
||||
public long InfoBasesTotalSize { get; private set; }
|
||||
public long InfoBasesFreeSize { get; private set; }
|
||||
|
||||
#region Filter
|
||||
|
||||
public string InstalledVersionsFilter { get; set; }
|
||||
public void OnInstalledVersionsFilterChanged()
|
||||
{
|
||||
var view = CollectionViewSource.GetDefaultView(InstalledVersions);
|
||||
if (view != null)
|
||||
{
|
||||
view.Filter = x =>
|
||||
{
|
||||
var item = x as InstalledVersionItemViewModel;
|
||||
return item.Name.Contains(InstalledVersionsFilter);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public string CacheFilter { get; set; }
|
||||
public void OnCacheFilterChanged()
|
||||
{
|
||||
var view = CollectionViewSource.GetDefaultView(Cache);
|
||||
if (view != null)
|
||||
{
|
||||
view.Filter = x =>
|
||||
{
|
||||
var item = x as CacheItemViewModel;
|
||||
return item.Name.Contains(CacheFilter);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public string InfoBasesFilter { get; set; }
|
||||
public void OnInfoBasesFilterChanged()
|
||||
{
|
||||
var view = CollectionViewSource.GetDefaultView(InfoBases);
|
||||
if (view != null)
|
||||
{
|
||||
view.Filter = x =>
|
||||
{
|
||||
var item = x as InfoBaseItemViewModel;
|
||||
return item.Name.Contains(InfoBasesFilter) || item.Connection.Contains(InfoBasesFilter);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public bool InstalledVersionsArePopulating { get; private set; }
|
||||
public bool CacheArePopulating { get; private set; }
|
||||
public bool InfoBasesArePopulating { get; private set; }
|
||||
@ -24,8 +78,11 @@ namespace OneCleaner
|
||||
public ICommand SelectAllCommand { get; set; }
|
||||
public ICommand UnselectAllCommand { get; set; }
|
||||
|
||||
public ICommand RemoveCacheCommand { get; private set; }
|
||||
public ICommand InstalledVersionsSortCommand { get; set; }
|
||||
public ICommand InfoBasesSortCommand { get; set; }
|
||||
public ICommand CacheSortCommand { get; set; }
|
||||
|
||||
public ICommand RemoveCacheCommand { get; private set; }
|
||||
public ICommand RemoveInfoBaseCommand { get; private set; }
|
||||
|
||||
public MainWindowViewModel()
|
||||
@ -33,12 +90,22 @@ namespace OneCleaner
|
||||
Status = Status.Idle;
|
||||
|
||||
InstalledVersions = new ObservableCollection<InstalledVersionItemViewModel>();
|
||||
InstalledVersions.CollectionChanged += ItemsCollectionChanged;
|
||||
|
||||
PopulateInstalledVersions();
|
||||
|
||||
InfoBases = new ObservableCollection<InfoBaseItemViewModel>();
|
||||
InfoBases.CollectionChanged += ItemsCollectionChanged;
|
||||
|
||||
Cache = new ObservableCollection<CacheItemViewModel>();
|
||||
Cache.CollectionChanged += ItemsCollectionChanged;
|
||||
|
||||
PopulateInfoBasesAndCache();
|
||||
|
||||
InstalledVersionsSortCommand = new RelayCommand(p => { Sort(CollectionViewSource.GetDefaultView(InstalledVersions), (string)p); });
|
||||
InfoBasesSortCommand = new RelayCommand(p => { Sort(CollectionViewSource.GetDefaultView(InfoBases), (string)p); });
|
||||
CacheSortCommand = new RelayCommand(p => { Sort(CollectionViewSource.GetDefaultView(Cache), (string)p); });
|
||||
|
||||
UninstallCommand = new RelayCommand(p => { Uninstall(); });
|
||||
|
||||
SelectAllCommand = new RelayCommand(
|
||||
@ -76,6 +143,53 @@ namespace OneCleaner
|
||||
});
|
||||
}
|
||||
|
||||
private void ItemsCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
|
||||
{
|
||||
if (e.OldItems != null)
|
||||
{
|
||||
foreach (INotifyPropertyChanged item in e.OldItems)
|
||||
{
|
||||
UpdateSize();
|
||||
item.PropertyChanged -= ItemPropertyChanged;
|
||||
}
|
||||
}
|
||||
if (e.NewItems != null)
|
||||
{
|
||||
foreach (INotifyPropertyChanged item in e.NewItems)
|
||||
item.PropertyChanged += ItemPropertyChanged;
|
||||
}
|
||||
}
|
||||
|
||||
private void ItemPropertyChanged(object sender, PropertyChangedEventArgs e)
|
||||
{
|
||||
UpdateSize();
|
||||
}
|
||||
|
||||
private void UpdateSize()
|
||||
{
|
||||
InstalledVersionsTotalSize = InstalledVersions.Select(i => i.Size).Sum();
|
||||
InstalledVersionsFreeSize = InstalledVersions.Select(i => i).Where(i => i.IsChecked == true).Sum(i => i.Size);
|
||||
|
||||
CacheTotalSize = Cache.Select(i => i.Size).Sum();
|
||||
CacheFreeSize = Cache.Select(i => i).Where(i => i.IsChecked == true).Sum(i => i.Size);
|
||||
|
||||
InfoBasesTotalSize = InfoBases.Select(i => i.Size).Sum();
|
||||
InfoBasesFreeSize = InfoBases.Select(i => i).Where(i => i.IsChecked == true).Sum(i => i.Size);
|
||||
}
|
||||
|
||||
private void Sort(ICollectionView view, string Name)
|
||||
{
|
||||
var sort = view.SortDescriptions.Select(item => item).Where(item => item.PropertyName == Name).FirstOrDefault();
|
||||
view.SortDescriptions.Clear();
|
||||
if (sort.PropertyName == null)
|
||||
view.SortDescriptions.Add(new SortDescription(Name, ListSortDirection.Ascending));
|
||||
else
|
||||
view.SortDescriptions.Add(
|
||||
new SortDescription(
|
||||
Name,
|
||||
(sort.Direction == ListSortDirection.Ascending) ? ListSortDirection.Descending : ListSortDirection.Ascending));
|
||||
}
|
||||
|
||||
private async void Uninstall()
|
||||
{
|
||||
if (Status == Status.Uninstalling)
|
||||
@ -167,7 +281,7 @@ namespace OneCleaner
|
||||
Name = item.Name,
|
||||
UUID = item.UUID,
|
||||
Size = item.Size,
|
||||
Version = item.Version,
|
||||
Version = item.VersionInt,
|
||||
InstallDate = item.InstallDate
|
||||
}
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user