-
Notifications
You must be signed in to change notification settings - Fork 750
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: Add guidelines for implementing WinUI/WinRT features
- Loading branch information
1 parent
4947bc1
commit bde528b
Showing
4 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
doc/articles/contributing/guidelines/implementing-a-new winui-winrt-feature.md
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,31 @@ | ||
## Guidelines for implementing a new WinUI/WinRT API | ||
|
||
Implementing a new WinUI/WinRT API generally requires to: | ||
- Find the generated API source file (e.g. `src\Uno.UWP\Generated\3.0.0.0\Windows.Data.Pdf\PdfDocument.cs`) | ||
- Copy the file to the non-generated location (e.g. `src\Uno.UWP\Data.Pdf\PdfDocument.cs`) | ||
- Keep only the members that need to be implemented in the non-generated location | ||
- Remove (completely or partially depending on the platforms) the implemented members in the generated file | ||
|
||
If your API implementation is for a specific platform: | ||
- You can use a platform suffix in the source file name (`PdfDocument.android.cs`) so the file is built only for this platform | ||
- Remove the parts that relate to your platform in the `NotImplemented` attribute: | ||
``` | ||
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ | ||
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")] | ||
public global::Windows.Data.Pdf.PdfPageDimensions Dimensions | ||
{ | ||
#endif | ||
``` | ||
becomes | ||
``` | ||
#if false || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ | ||
[global::Uno.NotImplemented("__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")] | ||
public global::Windows.Data.Pdf.PdfPageDimensions Dimensions | ||
{ | ||
#endif | ||
``` | ||
when implemented for Android only. | ||
When implementing a feature, try to place as much code as possible in a common source file (a non-suffixed file), so that it is reused across platforms. Make sure to follow [partial classes coding guidelines](code-style.md). | ||
Note that the generated files may be overriden at any point, and placing custom code (aside from changing the `NotImplemented` values) will be overwritten. |
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