Skip to content

Commit c0cdf76

Browse files
committed
Add clear history button
1 parent 48ee8c8 commit c0cdf76

3 files changed

Lines changed: 33 additions & 2 deletions

File tree

AIDevGallery/Controls/DownloadProgressList.xaml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,27 @@
1717
<RowDefinition Height="Auto" />
1818
<RowDefinition Height="*" />
1919
</Grid.RowDefinitions>
20+
<Grid.ColumnDefinitions>
21+
<ColumnDefinition Width="*" />
22+
<ColumnDefinition Width="Auto" />
23+
</Grid.ColumnDefinitions>
2024
<TextBlock
25+
FontWeight="SemiBold"
2126
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
22-
Style="{StaticResource CaptionTextBlockStyle}"
2327
Text="Downloads" />
28+
<Button
29+
HorizontalAlignment="Right"
30+
AutomationProperties.Name="More options"
31+
Content="{ui:FontIcon Glyph=&#xE712;,
32+
FontSize=16}"
33+
Style="{StaticResource SubtleButtonStyle}"
34+
ToolTipService.ToolTip="More options">
35+
<Button.Flyout>
36+
<MenuFlyout>
37+
<MenuFlyoutItem Click="ClearHistory_Click" Text="Clear history" />
38+
</MenuFlyout>
39+
</Button.Flyout>
40+
</Button>
2441
<ItemsRepeater
2542
Grid.Row="1"
2643
IsTabStop="False"

AIDevGallery/Controls/DownloadProgressList.xaml.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,5 +75,16 @@ private void RetryDownloadClicked(object sender, RoutedEventArgs e)
7575
App.ModelCache.AddModelToDownloadQueue(downloadableModel.ModelDetails);
7676
}
7777
}
78+
79+
private void ClearHistory_Click(object sender, RoutedEventArgs e)
80+
{
81+
foreach (DownloadableModel model in downloadProgresses.ToList())
82+
{
83+
if (model.Status is DownloadStatus.Completed or DownloadStatus.Canceled)
84+
{
85+
downloadProgresses.Remove(model);
86+
}
87+
}
88+
}
7889
}
7990
}

AIDevGallery/MainWindow.xaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,10 @@
167167
Width="32"
168168
Height="32"
169169
IsActive="False" />
170-
<FontIcon FontSize="14" Glyph="&#xE896;" />
170+
<FontIcon
171+
AutomationProperties.AccessibilityView="Raw"
172+
FontSize="14"
173+
Glyph="&#xE896;" />
171174
</Grid>
172175
</Button.Content>
173176
<Button.Flyout>

0 commit comments

Comments
 (0)