Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 'Clear Log' Button #1418

Merged
merged 8 commits into from
Oct 5, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Flow.Launcher/Languages/en.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
onesounds marked this conversation as resolved.
Show resolved Hide resolved
<system:String x:Key="welcomewindow">Wizard</system:String>

<!-- FileManager Setting Dialog -->
Expand Down
4 changes: 4 additions & 0 deletions Flow.Launcher/SettingWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -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}">
Expand Down
17 changes: 17 additions & 0 deletions Flow.Launcher/SettingWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,23 @@ private void OpenLogFolder(object sender, RoutedEventArgs e)
{
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();
onesounds marked this conversation as resolved.
Show resolved Hide resolved
foreach (FileInfo file in files)
{
file.Delete();
}
}
else
{
}

}

private void OnPluginStoreRefreshClick(object sender, RoutedEventArgs e)
{
Expand Down