Skip to content
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

UWP DI updates #1685

Merged
merged 8 commits into from
Feb 12, 2019
Merged

UWP DI updates #1685

merged 8 commits into from
Feb 12, 2019

Conversation

dansiegel
Copy link
Member

@dansiegel dansiegel commented Feb 9, 2019

Description of Change

Updates Gesture Service and NavigationService to ensure that these service instances are constructed by the DI container. Refactors the naming of some of the internal use interfaces to better align with Prism conventions.

API Changes

List all API changes here (or just put None), example:

Added:

  • object IContainerProvider.Resolve(Type, string, params (Type, object)[]);

Changed:

  • interface IPlatformNavigationService2 => interface IFrameFacadeProvider
  • interface IFrameFacade2 => interface IFrameProvider

Removed:
Methods from IPrismApplicationBase were made protected rather than public

  • interface IPrismApplicationBase

Behavioral Changes

Describe any non-bug related behavioral changes that may change how users app behaves when upgrading to this version of the codebase.

PR Checklist

  • Has tests (if omitted, state reason in description)
  • Rebased on top of master at time of PR
  • Changes adhere to coding standard

@dansiegel dansiegel added UWP DO-NOT-MERGE-!!! 🛑 Pull Request should not be merged in it's current state labels Feb 9, 2019
@dansiegel dansiegel removed the DO-NOT-MERGE-!!! 🛑 Pull Request should not be merged in it's current state label Feb 9, 2019
@dansiegel
Copy link
Member Author

Known Issue:
There seems to be a tooling issue that causes an unhandled exception in the Sandbox app. When referencing the build artifacts in an external app everything works.

Could not load type 'System.Runtime.CompilerServices.IAsyncStateMachine' from assembly 'System.Runtime, Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.

{
if (args.StartKind == StartKinds.Launch)
{
NavigationService.NavigateAsync(nameof(MainPage));
NavigationService.NavigateAsync("/MainPage");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can't we use $"/{nameof(MainPage)}"? I don't like suggesting magic strings

Copy link
Member Author

@dansiegel dansiegel Feb 10, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

two things here... 1) using nameof on a View type is actually worse IMO... 2) remember this is a Sandbox app

@bartlannoeye
Copy link
Contributor

This error on launch is because of UWP being forced on 6.2.2 by MSBuild.Sdk.Extras.

Created PR to roll back to 6.1.9: novotnyllc/MSBuildSdkExtras#152

@dansiegel
Copy link
Member Author

downgrading to 6.1.9 per @bartlannoeye's suggestion, I noticed we were targeting different versions of the UWP package between Prism and the Sandbox app... now that these are all the same the Sandbox app actually does work.


namespace Prism.Navigation
{
public static class NavigationServiceRegistry
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like this should be a NavigationServiceFactory.

// required for view-models

containerRegistry.Register<INavigationService, NavigationService>(NavigationServiceParameterName);
containerRegistry.Register<IPlatformNavigationService, NavigationService>(NavigationServiceParameterName);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we have a secondary registration for IPLatformNavigationService? This should not be needed.


namespace Prism.Services
{
public class GestureService : IGestureService
public class GestureService : IGestureService, IDestructibleGestureService
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why have a new interface for Destroy that is specific to the gesture service? Just bake it part of the IGestureServcie

@brianlagunas brianlagunas merged commit 508b5c8 into master Feb 12, 2019
@brianlagunas brianlagunas deleted the uwp-di branch February 12, 2019 03:35
@jp-weber
Copy link

jp-weber commented Feb 16, 2019

@dansiegel , @brianlagunas
With these changes how it is possible to create a new NavigationService within a page for the NavigationView?

In the old way, the implementation is like this:
https://github.com/jp-weber/Template10/blob/master/Source/Template10.Extras.16299/Controls/NavViewEx.cs#L45

@lock
Copy link

lock bot commented Jan 28, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants