Add 'Clear Log' Button in about

This commit is contained in:
DB p 2022-09-27 10:27:43 +09:00
parent 792b383505
commit 5140690e07
3 changed files with 23 additions and 0 deletions

View file

@ -162,6 +162,8 @@
<system:String x:Key="devtool">DevTools</system:String>
<system:String x:Key="settingfolder">Setting Folder</system:String>
<system:String x:Key="logfolder">Log Folder</system:String>
<system:String x:Key="clearlogfolder">Clear Logs</system:String>
<system:String x:Key="clearlogfolderMessage">Are you sure you want to delete the entire log?</system:String>
<system:String x:Key="welcomewindow">Wizard</system:String>
<!-- FileManager Setting Dialog -->

View file

@ -2523,6 +2523,10 @@
Margin="0,0,12,0"
Click="OpenSettingFolder"
Content="{DynamicResource settingfolder}" />
<Button
Margin="0,0,12,0"
Click="ClearLogFolder"
Content="{DynamicResource clearlogfolder}" />
<Button Click="OpenLogFolder" Content="{DynamicResource logfolder}" />
</StackPanel>
<TextBlock Style="{StaticResource Glyph}">

View file

@ -269,6 +269,23 @@ namespace Flow.Launcher
{
PluginManager.API.OpenDirectory(Path.Combine(DataLocation.DataDirectory(), Constant.Logs, Constant.Version));
}
private void ClearLogFolder(object sender, RoutedEventArgs e)
{
var confirmResult = MessageBox.Show(InternationalizationManager.Instance.GetTranslation("clearlogfolderMessage"),InternationalizationManager.Instance.GetTranslation("clearlogfolder"), MessageBoxButton.YesNo);
if (confirmResult == MessageBoxResult.Yes)
{
DirectoryInfo Di = new DirectoryInfo(Path.Combine(DataLocation.DataDirectory(), Constant.Logs, Constant.Version));
FileInfo[] files = Di.GetFiles();
foreach (FileInfo file in files)
{
file.Delete();
}
}
else
{
}
}
private void OnPluginStoreRefreshClick(object sender, RoutedEventArgs e)
{