Skip to content

Commit 5414245

Browse files
authored
Merge pull request #1049 from AutoDarkMode/winui3
Auto Dark Mode Version 11 with WinUI3
2 parents 5eb86f3 + 5678573 commit 5414245

File tree

434 files changed

+63899
-70645
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

434 files changed

+63899
-70645
lines changed

.editorconfig

Lines changed: 205 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,205 @@
1+
# Rules in this file were initially inferred by Visual Studio IntelliCode from the Template Studio codebase.
2+
# You can modify the rules from these initially generated values to suit your own policies.
3+
# You can learn more about editorconfig here: https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference.
4+
5+
[*.cs]
6+
7+
#Core editorconfig formatting - indentation
8+
9+
#use soft tabs (spaces) for indentation
10+
indent_style = space
11+
12+
#Formatting - new line options
13+
14+
#place else statements on a new line
15+
csharp_new_line_before_else = true
16+
#require braces to be on a new line for lambdas, methods, control_blocks, types, properties, and accessors (also known as "Allman" style)
17+
csharp_new_line_before_open_brace = all
18+
19+
#Formatting - organize using options
20+
21+
#sort System.* using directives alphabetically, and place them before other usings
22+
dotnet_sort_system_directives_first = true
23+
24+
#Formatting - spacing options
25+
26+
#require NO space between a cast and the value
27+
csharp_space_after_cast = false
28+
#require a space before the colon for bases or interfaces in a type declaration
29+
csharp_space_after_colon_in_inheritance_clause = true
30+
#require a space after a keyword in a control flow statement such as a for loop
31+
csharp_space_after_keywords_in_control_flow_statements = true
32+
#require a space before the colon for bases or interfaces in a type declaration
33+
csharp_space_before_colon_in_inheritance_clause = true
34+
#remove space within empty argument list parentheses
35+
csharp_space_between_method_call_empty_parameter_list_parentheses = false
36+
#remove space between method call name and opening parenthesis
37+
csharp_space_between_method_call_name_and_opening_parenthesis = false
38+
#do not place space characters after the opening parenthesis and before the closing parenthesis of a method call
39+
csharp_space_between_method_call_parameter_list_parentheses = false
40+
#remove space within empty parameter list parentheses for a method declaration
41+
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
42+
#place a space character after the opening parenthesis and before the closing parenthesis of a method declaration parameter list.
43+
csharp_space_between_method_declaration_parameter_list_parentheses = false
44+
45+
#Formatting - wrapping options
46+
47+
#leave code block on separate lines
48+
csharp_preserve_single_line_blocks = true
49+
50+
#Style - Code block preferences
51+
52+
#prefer curly braces even for one line of code
53+
csharp_prefer_braces = true:silent
54+
55+
#Style - expression bodied member options
56+
57+
#prefer expression bodies for accessors
58+
csharp_style_expression_bodied_accessors = true:warning
59+
#prefer block bodies for constructors
60+
csharp_style_expression_bodied_constructors = false:suggestion
61+
#prefer expression bodies for methods
62+
csharp_style_expression_bodied_methods = when_on_single_line:silent
63+
#prefer expression-bodied members for properties
64+
csharp_style_expression_bodied_properties = false
65+
csharp_preserve_single_line_properties = true
66+
67+
#Style - expression level options
68+
69+
#prefer out variables to be declared before the method call
70+
csharp_style_inlined_variable_declaration = false:suggestion
71+
#prefer the language keyword for member access expressions, instead of the type name, for types that have a keyword to represent them
72+
dotnet_style_predefined_type_for_member_access = true:suggestion
73+
74+
#Style - Expression-level preferences
75+
76+
#prefer default over default(T)
77+
csharp_prefer_simple_default_expression = true:suggestion
78+
#prefer objects to be initialized using object initializers when possible
79+
dotnet_style_object_initializer = true:suggestion
80+
81+
#Style - implicit and explicit types
82+
83+
#prefer var over explicit type in all cases, unless overridden by another code style rule
84+
csharp_style_var_elsewhere = true:suggestion
85+
#prefer var is used to declare variables with built-in system types such as int
86+
csharp_style_var_for_built_in_types = true:suggestion
87+
#prefer var when the type is already mentioned on the right-hand side of a declaration expression
88+
csharp_style_var_when_type_is_apparent = true:suggestion
89+
90+
#Style - language keyword and framework type options
91+
92+
#prefer the language keyword for local variables, method parameters, and class members, instead of the type name, for types that have a keyword to represent them
93+
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
94+
95+
#Style - Language rules
96+
csharp_style_implicit_object_creation_when_type_is_apparent = true:warning
97+
csharp_style_var_for_built_in_types = true:warning
98+
99+
#Style - modifier options
100+
101+
#prefer accessibility modifiers to be declared except for public interface members. This will currently not differ from always and will act as future proofing for if C# adds default interface methods.
102+
dotnet_style_require_accessibility_modifiers = for_non_interface_members:suggestion
103+
104+
#Style - Modifier preferences
105+
106+
#when this rule is set to a list of modifiers, prefer the specified ordering.
107+
csharp_preferred_modifier_order = public,private,protected,internal,static,async,readonly,override,sealed,abstract,virtual:warning
108+
dotnet_style_readonly_field = true:warning
109+
110+
#Style - Pattern matching
111+
112+
#prefer pattern matching instead of is expression with type casts
113+
csharp_style_pattern_matching_over_as_with_null_check = true:warning
114+
115+
#Style - qualification options
116+
117+
#prefer events not to be prefaced with this. or Me. in Visual Basic
118+
dotnet_style_qualification_for_event = false:suggestion
119+
#prefer fields not to be prefaced with this. or Me. in Visual Basic
120+
dotnet_style_qualification_for_field = false:suggestion
121+
#prefer methods not to be prefaced with this. or Me. in Visual Basic
122+
dotnet_style_qualification_for_method = false:suggestion
123+
#prefer properties not to be prefaced with this. or Me. in Visual Basic
124+
dotnet_style_qualification_for_property = false:suggestion
125+
csharp_indent_labels = one_less_than_current
126+
csharp_using_directive_placement = outside_namespace:silent
127+
csharp_prefer_simple_using_statement = true:warning
128+
csharp_style_namespace_declarations = file_scoped:warning
129+
csharp_style_expression_bodied_operators = false:silent
130+
csharp_style_expression_bodied_indexers = true:silent
131+
csharp_style_expression_bodied_lambdas = true:silent
132+
csharp_style_expression_bodied_local_functions = false:silent
133+
csharp_preserve_single_line_properties = true
134+
135+
[*.{cs,vb}]
136+
dotnet_style_operator_placement_when_wrapping = beginning_of_line
137+
tab_width = 4
138+
indent_size = 4
139+
end_of_line = crlf
140+
dotnet_style_coalesce_expression = true:suggestion
141+
dotnet_style_null_propagation = true:suggestion
142+
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
143+
dotnet_style_prefer_auto_properties = true:silent
144+
dotnet_style_object_initializer = true:suggestion
145+
dotnet_style_collection_initializer = true:suggestion
146+
dotnet_style_prefer_simplified_boolean_expressions = true:suggestion
147+
dotnet_style_prefer_conditional_expression_over_assignment = true:silent
148+
dotnet_style_prefer_conditional_expression_over_return = true:silent
149+
dotnet_diagnostic.IDE0007.severity = none
150+
[*.{cs,vb}]
151+
152+
#Style - Unnecessary code rules
153+
csharp_style_unused_value_assignment_preference = discard_variable:warning
154+
155+
#### Naming styles ####
156+
157+
# Naming rules
158+
159+
dotnet_naming_rule.interface_should_be_begins_with_i.severity = suggestion
160+
dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface
161+
dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i
162+
163+
dotnet_naming_rule.types_should_be_pascal_case.severity = suggestion
164+
dotnet_naming_rule.types_should_be_pascal_case.symbols = types
165+
dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case
166+
167+
dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = suggestion
168+
dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
169+
dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case
170+
171+
# Symbol specifications
172+
173+
dotnet_naming_symbols.interface.applicable_kinds = interface
174+
dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
175+
dotnet_naming_symbols.interface.required_modifiers =
176+
177+
dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
178+
dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
179+
dotnet_naming_symbols.types.required_modifiers =
180+
181+
dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
182+
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
183+
dotnet_naming_symbols.non_field_members.required_modifiers =
184+
185+
# Naming styles
186+
187+
dotnet_naming_style.begins_with_i.required_prefix = I
188+
dotnet_naming_style.begins_with_i.required_suffix =
189+
dotnet_naming_style.begins_with_i.word_separator =
190+
dotnet_naming_style.begins_with_i.capitalization = pascal_case
191+
192+
dotnet_naming_style.pascal_case.required_prefix =
193+
dotnet_naming_style.pascal_case.required_suffix =
194+
dotnet_naming_style.pascal_case.word_separator =
195+
dotnet_naming_style.pascal_case.capitalization = pascal_case
196+
197+
dotnet_naming_style.pascal_case.required_prefix =
198+
dotnet_naming_style.pascal_case.required_suffix =
199+
dotnet_naming_style.pascal_case.word_separator =
200+
dotnet_naming_style.pascal_case.capitalization = pascal_case
201+
dotnet_style_explicit_tuple_names = true:suggestion
202+
dotnet_style_prefer_inferred_tuple_names = true:suggestion
203+
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
204+
dotnet_style_prefer_compound_assignment = true:warning
205+
dotnet_style_prefer_simplified_interpolation = true:suggestion

.github/CODEOWNERS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
* @armin2208 @spiritreader
2+
/AutoDarkModeApp/ @AutoDarkMode/ui @armin2208 @spiritreader
3+
/AutoDarkModeApp.Core/ @AutoDarkMode/ui @armin2208 @spiritreader
4+
Windows\ Auto\ Dark\ Mode.sln @AutoDarkMode/ui @armin2208 @spiritreader

.github/DEVELOPMENT_NOTE.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
2+
# Development Note
3+
4+
## About this project
5+
6+
This project base on [Auto Dark Mode](https://github.com/AutoDarkMode/Windows-Auto-Night-Mode), this project upgrades it from WPF to WinUI 3. The project start at 23.02.2025.
7+
8+
## What's changed?
9+
10+
1. The project is developed based on Windows App SDK 1.6 and .Net8.0. Thanks to WinUI, the UI style is more modern now. The program adopts MWWM framework, use [Xaml Styler](https://marketplace.visualstudio.com/items?itemName=TeamXavalon.XAMLStyler2022) for styling Xaml.
11+
2. The localization code is similar to the official WinUI example, I use the `string.GetLocalized`, it is code of [Template Studio for WinUI](https://github.com/microsoft/TemplateStudio). The x:Uid is not used, because the source code of Auto Dark Mode does not match it, localization is a huge project, and it is best to improve it as much as possible, rather than reinventing it.
12+
3. The format of some pages may change a little, because the MWWM framework makes the interface interaction more natural and may not need some additional acitons.
13+
4. Some localization resources have been added, which is due to the above-mentioned interface changes, and some interface changes are aimed at the consistency of interface style. Such as **TimePage**'s first settingscard: IsAutoThemeSwitching doesn't have header textblock.
14+
5. Also thanks to the MWWM architecture, I think every page can be updated with the Config file in real time, which does not require developers to add too much code, but only to initialize the page "reasonably".
15+
6. Delete some redundant code, such as the how to get localization part in AutoDarkMode.Lib.
16+
7. Replace the traditional png icon, because Windows App SDK does not directly support SVG icon. Use it after converting SVG icon into font resource file.
17+
8. We can still use the previous localization resx, but it needs to be converted into resw file. At the same time, there are some new key:
18+
19+
- PostponeButtonUnDelay
20+
- EnterToApply
21+
- UpdatesChannelBeta
22+
- UpdatesChannelStable
23+
- SettingsPageLanguage
24+
- lblScripts
25+
- lblSet
26+
27+
## Task progress
28+
29+
- [ ] App
30+
- [ ] Localization (Finished: en-us, fr, ja, zh-hans)
31+
- [x] TimePage (LackFunction: Postpone)
32+
- [x] SwitchModesPage (LackFunction: BatteryDarkMode)
33+
- [ ] AppsPage
34+
- [ ] PersonalizationPage
35+
- [ ] ScriptsPage
36+
- [ ] DonationPage
37+
- [ ] AboutPage
38+
- [x] SettingsPage
39+
40+
## What needs constant attention?
41+
42+
1. Need the unification of variable naming, the source code is full of naming methods with different styles, which easily leads to difficulties in subsequent code maintenance. *[Code quality]*
43+
2. The name of localized text is need to updated for the same reason as above. *[Code quality]*

.github/FUNDING.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# These are supported funding model platforms
22

3-
github: ['Spiritreader']
3+
github: ['AutoDarkMode']
44
patreon: # Replace with a single Patreon username
55
open_collective: # Replace with a single Open Collective username
66
ko_fi: # Replace with a single Ko-Fi username

0 commit comments

Comments
 (0)