-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Code Quality: WCT Settings Control #13045
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
Closed
0x5bfa
wants to merge
23
commits into
files-community:main
from
0x5bfa:5bfa/Introduce-NewSettingsControls
Closed
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
2d11759
Move outdated controls
0x5bfa 03b6f27
Introduced new control
0x5bfa a61e637
Fix some wrong code
0x5bfa 016eae6
Fix and apply
0x5bfa cee884d
Merge branch 'main' into 5bfa/Introduce-NewSettingsControls
0x5bfa 09b2f76
Replace all in settings
0x5bfa c9efc6a
Remove outdated controls
0x5bfa 7ed2e24
Adjusted
0x5bfa c7eab1c
Fix some
0x5bfa 3a96d1e
Merge remote-tracking branch 'upstream/main' into 5bfa/Introduce-NewS…
0x5bfa 3aaedf1
Merge branch 'main' into 5bfa/Introduce-NewSettingsControls
0x5bfa cbbaf6c
Fixed
0x5bfa 858f65b
Merge branch '5bfa/Introduce-NewSettingsControls' of https://github.c…
0x5bfa 6eb3ff6
Fixed
0x5bfa bddac66
Fixed
0x5bfa 9ff18f4
Remove
0x5bfa 37c53a9
Capitalize
0x5bfa 37ea60f
Merge branch 'main' into 5bfa/Introduce-NewSettingsControls
yaira2 fd706fc
Merge branch 'main' into 5bfa/Introduce-NewSettingsControls
0x5bfa 3c4eb70
Merge branch 'main' into 5bfa/Introduce-NewSettingsControls
0x5bfa 8187116
Merge branch 'main' into 5bfa/Introduce-NewSettingsControls
0x5bfa 54b883a
fix
0x5bfa 1478338
Merge branch '5bfa/Introduce-NewSettingsControls' of https://github.c…
0x5bfa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,21 @@ | ||
// Copyright (c) 2023 Files Community | ||
// Licensed under the MIT License. See the LICENSE. | ||
|
||
using Microsoft.UI.Xaml; | ||
using Microsoft.UI.Xaml.Controls; | ||
using Microsoft.UI.Xaml.Data; | ||
using Microsoft.UI.Xaml.Documents; | ||
using Microsoft.UI.Xaml.Input; | ||
using Microsoft.UI.Xaml.Media; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Runtime.InteropServices.WindowsRuntime; | ||
|
||
namespace Files.App.UserControls | ||
{ | ||
internal static partial class ControlHelpers | ||
{ | ||
internal static bool IsXamlRootAvailable { get; } = Windows.Foundation.Metadata.ApiInformation.IsPropertyPresent("Windows.UI.Xaml.UIElement", "XamlRoot"); | ||
} | ||
} |
69 changes: 69 additions & 0 deletions
69
src/Files.App/UserControls/Settings/ResourceDictionaryExtensions.cs
This file contains hidden or 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,69 @@ | ||
// Copyright (c) 2023 Files Community | ||
// Licensed under the MIT License. See the LICENSE. | ||
|
||
using Microsoft.UI.Xaml; | ||
using Microsoft.UI.Xaml.Controls; | ||
using Microsoft.UI.Xaml.Data; | ||
using Microsoft.UI.Xaml.Documents; | ||
using Microsoft.UI.Xaml.Input; | ||
using Microsoft.UI.Xaml.Media; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Runtime.InteropServices.WindowsRuntime; | ||
|
||
namespace Files.App.UserControls | ||
{ | ||
internal static class ResourceDictionaryExtensions | ||
{ | ||
/// <summary> | ||
/// Copies the <see cref="ResourceDictionary"/> provided as a parameter into the calling dictionary, includes overwriting the source location, theme dictionaries, and merged dictionaries. | ||
/// </summary> | ||
/// <param name="destination">ResourceDictionary to copy values to.</param> | ||
/// <param name="source">ResourceDictionary to copy values from.</param> | ||
internal static void CopyFrom(this ResourceDictionary destination, ResourceDictionary source) | ||
{ | ||
if (source.Source != null) | ||
{ | ||
destination.Source = source.Source; | ||
} | ||
else | ||
{ | ||
// Clone theme dictionaries | ||
if (source.ThemeDictionaries != null) | ||
{ | ||
foreach (var theme in source.ThemeDictionaries) | ||
{ | ||
if (theme.Value is ResourceDictionary themedResource) | ||
{ | ||
var themeDictionary = new ResourceDictionary(); | ||
themeDictionary.CopyFrom(themedResource); | ||
destination.ThemeDictionaries[theme.Key] = themeDictionary; | ||
} | ||
else | ||
{ | ||
destination.ThemeDictionaries[theme.Key] = theme.Value; | ||
} | ||
} | ||
} | ||
|
||
// Clone merged dictionaries | ||
if (source.MergedDictionaries != null) | ||
{ | ||
foreach (var mergedResource in source.MergedDictionaries) | ||
{ | ||
var themeDictionary = new ResourceDictionary(); | ||
themeDictionary.CopyFrom(mergedResource); | ||
destination.MergedDictionaries.Add(themeDictionary); | ||
} | ||
} | ||
|
||
// Clone all contents | ||
foreach (var item in source) | ||
{ | ||
destination[item.Key] = item.Value; | ||
} | ||
} | ||
} | ||
} | ||
} |
116 changes: 0 additions & 116 deletions
116
src/Files.App/UserControls/Settings/SettingsBlockControl.xaml
This file was deleted.
Oops, something went wrong.
146 changes: 0 additions & 146 deletions
146
src/Files.App/UserControls/Settings/SettingsBlockControl.xaml.cs
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.