forked from files-community/Files
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature: Added an action to toggle the dot files setting (files-commu…
- Loading branch information
Showing
5 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Copyright (c) 2024 Files Community | ||
// Licensed under the MIT License. See the LICENSE. | ||
|
||
namespace Files.App.Actions | ||
{ | ||
internal sealed class ToggleDotFilesSettingAction : ObservableObject, IToggleAction | ||
{ | ||
private readonly IFoldersSettingsService FoldersSettingsService; | ||
|
||
public string Label | ||
=> "ShowDotFiles".GetLocalizedResource(); | ||
|
||
public string Description | ||
=> "ToggleDotFilesSettingDescription".GetLocalizedResource(); | ||
|
||
public bool IsOn | ||
=> FoldersSettingsService.ShowDotFiles; | ||
|
||
public ToggleDotFilesSettingAction() | ||
{ | ||
FoldersSettingsService = Ioc.Default.GetRequiredService<IFoldersSettingsService>(); | ||
|
||
FoldersSettingsService.PropertyChanged += Settings_PropertyChanged; | ||
} | ||
|
||
public Task ExecuteAsync(object? parameter = null) | ||
{ | ||
FoldersSettingsService.ShowDotFiles = !FoldersSettingsService.ShowDotFiles; | ||
|
||
return Task.CompletedTask; | ||
} | ||
|
||
private void Settings_PropertyChanged(object? sender, PropertyChangedEventArgs e) | ||
{ | ||
if (e.PropertyName is nameof(IFoldersSettingsService.ShowDotFiles)) | ||
OnPropertyChanged(nameof(IsOn)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters