{"action":"created","issue":{"url":"https://api.github.com/repos/PrismLibrary/Prism/issues/646","repository_url":"https://api.github.com/repos/PrismLibrary/Prism","labels_url":"https://api.github.com/repos/PrismLibrary/Prism/issues/646/labels{/name}","comments_url":"https://api.github.com/repos/PrismLibrary/Prism/issues/646/comments","events_url":"https://api.github.com/repos/PrismLibrary/Prism/issues/646/events","html_url":"https://github.com/PrismLibrary/Prism/pull/646","id":161086658,"number":646,"title":"Task-based Asynchronous View-Switching Navigation","user":{"login":"dvorn","id":13989659,"avatar_url":"https://avatars.githubusercontent.com/u/13989659?v=3","gravatar_id":"","url":"https://api.github.com/users/dvorn","html_url":"https://github.com/dvorn","followers_url":"https://api.github.com/users/dvorn/followers","following_url":"https://api.github.com/users/dvorn/following{/other_user}","gists_url":"https://api.github.com/users/dvorn/gists{/gist_id}","starred_url":"https://api.github.com/users/dvorn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dvorn/subscriptions","organizations_url":"https://api.github.com/users/dvorn/orgs","repos_url":"https://api.github.com/users/dvorn/repos","events_url":"https://api.github.com/users/dvorn/events{/privacy}","received_events_url":"https://api.github.com/users/dvorn/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/PrismLibrary/Prism/labels/cla-signed","name":"cla-signed","color":"207de5"},{"url":"https://api.github.com/repos/PrismLibrary/Prism/labels/WPF","name":"WPF","color":"eb6420"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":18,"created_at":"2016-06-19T18:59:52Z","updated_at":"2016-06-21T20:19:18Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/PrismLibrary/Prism/pulls/646","html_url":"https://github.com/PrismLibrary/Prism/pull/646","diff_url":"https://github.com/PrismLibrary/Prism/pull/646.diff","patch_url":"https://github.com/PrismLibrary/Prism/pull/646.patch"},"body":"PR for #118 and #119\r\n\r\n# Changes\r\n\r\nIn addition to `IConfirmNavigationRequest` interface, a new interface `IConfirmNavigationRequestAsync` was added:\r\n\r\n```csharp\r\npublic interface IConfirmNavigationRequestAsync : INavigationAware\r\n{\r\n    Task<bool> ConfirmNavigationRequestAsync(NavigationContext navigationContext);\r\n}\r\n```\r\n\r\nBoth interfaces are supported.  That is, the framework will query the currently active view for implementation of either of these interfaces.  However `IConfirmNavigationRequest` should be considered deprecated and the users are encouraged to implement `IConfirmNavigationRequestAsync` in their view (model)s.\r\n\r\nThe `INavigateAsync` interface has changed and now contains awaitable Task-based methods:\r\n\r\n```csharp\r\npublic interface INavigateAsync\r\n{\r\n    Task<NavigationResult> RequestNavigateAsync(Uri target);\r\n    Task<NavigationResult> RequestNavigateAsync(Uri target, NavigationParameters navigationParameters);\r\n}\r\n```\r\n\r\nOld methods of the interface are provided as extension methods in `NavigateAsyncCallbackExtensions` class.  The `INavigateAsync` interface is implemented by the `Region` and `RegionNavigationService` classes.\r\n\r\nFour methods of the `IRegionManager` interface containing callbacks were replaced by Task-based counterparts:  instead of\r\n\r\n```csharp\r\npublic interface IRegionManager\r\n{\r\n    ...\r\n    void RequestNavigate(string regionName, Uri source, Action<NavigationResult> navigationCallback);\r\n    void RequestNavigate(string regionName, string source, Action<NavigationResult> navigationCallback);\r\n    void RequestNavigate(this IRegionManager regionManager, string regionName, Uri target, Action<NavigationResult> navigationCallback, NavigationParameters navigationParameters);\r\n    void RequestNavigate(this IRegionManager regionManager, string regionName, string target, Action<NavigationResult> navigationCallback, NavigationParameters navigationParameters);\r\n    ...\r\n}\r\n```\r\nnow have\r\n```csharp\r\npublic interface IRegionManager\r\n{\r\n    ...\r\n    Task<NavigationResult> RequestNavigateAsync(string regionName, Uri source);\r\n    Task<NavigationResult> RequestNavigateAsync(string regionName, string source);\r\n    Task<NavigationResult> RequestNavigateAsync(string regionName, Uri target, NavigationParameters navigationParameters);\r\n    Task<NavigationResult> RequestNavigateAsync(string regionName, string target, NavigationParameters navigationParameters);\r\n    ...\r\n}\r\n```\r\nMethods removed from the interface are provided as extensions in `RegionManagerCallbackExtensions` class.\r\n\r\nNavigation methods in `IRegionNavigationJournal` interface were made explicitly asynchronous and returning the result of navigation: instead of \r\n```csharp\r\npublic interface IRegionNavigationJournal\r\n{\r\n    ...\r\n    void GoBack();\r\n    void GoForward();\r\n    ...\r\n}\r\n```\r\nnow have\r\n```csharp\r\npublic interface IRegionNavigationJournal\r\n{\r\n    ...\r\n    Task<NavigationResult> GoBackAsync();\r\n    Task<NavigationResult> GoForwardAsync();\r\n    ...\r\n}\r\n```\r\nOld methods are provided as extensions in the class `RegionNavigationJournalExtensions`.\r\n\r\nThe core navigation functionality is implemented in classes `RegionNavigationService` and `RegionNavigationJournal` which are now using `async`/`await` instead of callbacks technique.\r\n"},"comment":{"url":"https://api.github.com/repos/PrismLibrary/Prism/issues/comments/227559055","html_url":"https://github.com/PrismLibrary/Prism/pull/646#issuecomment-227559055","issue_url":"https://api.github.com/repos/PrismLibrary/Prism/issues/646","id":227559055,"user":{"login":"brianlagunas","id":835562,"avatar_url":"https://avatars.githubusercontent.com/u/835562?v=3","gravatar_id":"","url":"https://api.github.com/users/brianlagunas","html_url":"https://github.com/brianlagunas","followers_url":"https://api.github.com/users/brianlagunas/followers","following_url":"https://api.github.com/users/brianlagunas/following{/other_user}","gists_url":"https://api.github.com/users/brianlagunas/gists{/gist_id}","starred_url":"https://api.github.com/users/brianlagunas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brianlagunas/subscriptions","organizations_url":"https://api.github.com/users/brianlagunas/orgs","repos_url":"https://api.github.com/users/brianlagunas/repos","events_url":"https://api.github.com/users/brianlagunas/events{/privacy}","received_events_url":"https://api.github.com/users/brianlagunas/received_events","type":"User","site_admin":false},"created_at":"2016-06-21T20:19:18Z","updated_at":"2016-06-21T20:19:18Z","body":"Prism hasn't been created just now.  It has been around for nearly 10 years with a huge user based that have built very large and mission critical applications on top of it.  Everything from 911 response software, to offshore drilling, to stock trading and financial apps.  We cannot suddenly say change your app to use this new way.  Yes, we are stuck with supporting the current WPF Prism implementation.  Any feature we add must be \"additive\".  We must not change current implementations.  We should only add to it.  Also, using Async isn't always the best approach.  It is only useful in scenarios where it actually makes sense to use any of the Async features.  Most of the time, async/await is not needed for region navigation.\r\n\r\n> This means that our implementation of awaitable methods in RegionManager and Region (which delegates to IRegionNavigationService) cannot assume that IRegionNavigationService implement the awaitable portion interface and cannot call it.\r\n\r\nExactly my point.  We are introducing a number of breaking changes, some we haven't even considered, that would not only break the actual implementation of the region navigation service, but the current functionlaity of Prism applications.\r\n\r\nThis is not a feature that can be taken lightly.  A lot of due diligence must be done in order to verify backwards compatibility and that all current functionality is left intact."}}
{"actor":{"display_login":"brianlagunas"}}