unoplatform/uno

Remove reflection to Uno.Toolkit

Open

#782 aperta il 17 apr 2019

Vedi su GitHub
 (1 commento) (0 reazioni) (0 assegnatari)C# (837 fork)batch import
area/performance 📈difficulty/starter 🚀good first issuekind/enhancementlow-hanging-🍒no-repro

Metriche repository

Star
 (9789 star)
Metriche merge PR
 (Merge medio 14g 8h) (130 PR mergiate in 30 g)

Descrizione

I'm submitting a...

  • Feature request

Current behavior

Currently some classes in Uno.UI are using reflection to access classes in the toolkit and interact with them. This is not extensible, and in some cases the dependency can be inverted.

For instance Android's NativeFramePresenter seek for the CommandBarExtensions https://github.com/nventive/Uno/blob/master/src/Uno.UI/NativeFramePresenter.Android.cs#L28 in order to update the visibility of the back button (https://github.com/nventive/Uno/blob/master/src/Uno.UI/NativeFramePresenter.Android.cs#L81).

Expected behavior

No cross-layer dependencies.

For the example above, the CommandBar could instead walk the tree to discover the Frame and register to the history change events to update the visibility by itself.

Minimal reproduction of the problem with instructions

N/A

Environment

Nuget Package: Uno.UI Package Version(s): irrelevant

Affected platform(s):

  • iOS
  • Android
  • WebAssembly
  • Windows
  • Build tasks

Visual Studio: irrelevant Relevant plugins: none

Guida contributor