mirror of
https://github.com/vbondarevsky/OneCleaner.git
synced 2024-11-21 10:05:50 +02:00
Добавлены поля для вывода общего размера и освобождаемого. Без заполнения.
This commit is contained in:
parent
351f37edfe
commit
f2622e1e22
@ -41,24 +41,36 @@
|
||||
<Window.TaskbarItemInfo>
|
||||
<TaskbarItemInfo/>
|
||||
</Window.TaskbarItemInfo>
|
||||
<Grid>
|
||||
<Grid Name="MainGrid">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="32"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="35"/>
|
||||
<RowDefinition Height="40"/>
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock TextWrapping="Wrap" Text="Получение списка установленных версий..." HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="18" Foreground="#FF9C9C9C" Grid.Row="1"/>
|
||||
<ListView x:Name="List" ItemTemplate="{StaticResource myItem}" PreviewKeyDown="List_PreviewKeyDown" Grid.Row="1"/>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Grid.Row="2" Margin="10,7,5,5">
|
||||
<Button x:Name="ButtonCancel" Content="Отменить" Visibility="Collapsed" Click="ButtonCancel_Click" Margin="0,0,3,0"/>
|
||||
<Button x:Name="ButtonUninstall" Content="Выполнить удаление" Click="ButtonUninstall_Click" Margin="3,0,0,0"/>
|
||||
</StackPanel>
|
||||
<Grid Grid.Row="2">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="150"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Grid.Column="0" Orientation="Horizontal" HorizontalAlignment="Left" Margin="0,6">
|
||||
<Label Content="Всего:" Margin="0"/>
|
||||
<Label Content="{Binding TotalSize}" Margin="0"/>
|
||||
<Label Content="К удалению:" Margin="0"/>
|
||||
<Label Content="{Binding FreeSize}" Margin="0"/>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Column="1" Orientation="Horizontal" Margin="0,6,6,6" HorizontalAlignment="Right">
|
||||
<Button x:Name="ButtonCancel" Content="Отменить" Visibility="Collapsed" Click="ButtonCancel_Click" Margin="0"/>
|
||||
<Button x:Name="ButtonUninstall" Content="Выполнить удаление" Click="ButtonUninstall_Click" Margin="6,0,0,0"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left" Grid.Row="0" Grid.Column="0">
|
||||
<Button Margin="3 3" Background="{x:Null}" BorderThickness="0.4" Click="Button_Click" Width="25" Height="25">
|
||||
<Button Margin="3 3" Background="{x:Null}" BorderThickness="0.4" Click="ButtonSelectAll_Click" Width="25" Height="25">
|
||||
<Image Source="checked.png" Stretch="None" />
|
||||
</Button>
|
||||
|
||||
<Button Margin="3 3" Background="{x:Null}" BorderThickness="0.4" Click="Button_Click_2" Width="25" Height="25">
|
||||
<Button Margin="3 3" Background="{x:Null}" BorderThickness="0.4" Click="ButtonUnselectAll_Click" Width="25" Height="25">
|
||||
<Image Source="unchecked.png" Stretch="None" />
|
||||
</Button>
|
||||
</StackPanel>
|
||||
|
@ -4,9 +4,7 @@ using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Shell;
|
||||
|
||||
namespace OneCleaner
|
||||
@ -16,6 +14,9 @@ namespace OneCleaner
|
||||
/// </summary>
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
public string TotalSize { get; set; }
|
||||
public string FreeSize { get; set; }
|
||||
|
||||
private InstalledVersionUICollection _installedVersions = new InstalledVersionUICollection();
|
||||
private bool _cancelFlag = false;
|
||||
|
||||
@ -24,6 +25,12 @@ namespace OneCleaner
|
||||
InitializeComponent();
|
||||
List.ItemsSource = _installedVersions;
|
||||
|
||||
MainGrid.DataContext = this;
|
||||
|
||||
TotalSize = "0 MB";
|
||||
FreeSize = "0 MB";
|
||||
|
||||
|
||||
#if DEBUG
|
||||
this.Title = this.Title + " (DEBUG)";
|
||||
#endif
|
||||
@ -65,26 +72,6 @@ namespace OneCleaner
|
||||
};
|
||||
}
|
||||
|
||||
private void Button_Click_1(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var item = FindVisualParent<ListItem>(sender as Button);
|
||||
}
|
||||
|
||||
public static T FindVisualParent<T>(DependencyObject childElement) where T : DependencyObject
|
||||
{
|
||||
DependencyObject parent = VisualTreeHelper.GetParent(childElement);
|
||||
T parentAsT = parent as T;
|
||||
if (parent == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else if (parentAsT != null)
|
||||
{
|
||||
return parentAsT;
|
||||
}
|
||||
return FindVisualParent<T>(parent);
|
||||
}
|
||||
|
||||
private void ButtonCancel_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
_cancelFlag = true;
|
||||
@ -111,7 +98,7 @@ namespace OneCleaner
|
||||
}
|
||||
}
|
||||
|
||||
private void Button_Click(object sender, RoutedEventArgs e)
|
||||
private void ButtonSelectAll_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
foreach (var item in _installedVersions)
|
||||
{
|
||||
@ -119,7 +106,7 @@ namespace OneCleaner
|
||||
}
|
||||
}
|
||||
|
||||
private void Button_Click_2(object sender, RoutedEventArgs e)
|
||||
private void ButtonUnselectAll_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
foreach (var item in _installedVersions)
|
||||
{
|
||||
@ -163,7 +150,6 @@ namespace OneCleaner
|
||||
this.TaskbarItemInfo.ProgressState = TaskbarItemProgressState.None;
|
||||
|
||||
SetWindowStateIdle();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user