Quantcast
Channel: patterns & practices: Prism
Viewing all articles
Browse latest Browse all 1878

New Post: Prism and Dependency Injection - Unit Testing

$
0
0
Hi Stephan,

Based on my understanding the main reason behind why those were designed as extension methods is because the navigation functionality is not pertinent to the IRegionManager itself, but to each specific region. We could say that the RequestNavigate extension method is a kind of "convenience method" that simply delegates the navigation request to the RequestNavigate method of the corresponding region. The following sentences are equivalent:
regionManager.RequestNavigate("RegionName", uri, callback);
regionManager.Regions["RegionName"].RequestNavigate(uri, callback);
I believe the same applies to the IInteractionRequest interface. Said interface declares an EventHandler which could be invoked directly when needed. The Raise methods of InteractionRequest<T> are again a kind of "convenience methods" which simply raise the aforementioned event. Therefore, I believe that implementing those methods should not be required for a class to be an IInteractionRequest implementation.

Finally, the PopupChildWindowAction is not available in WPF because of a "limitation" within WPF itself: once a Window is closed, it cannot be used again. When you use a PopupChildWindowAction and set its ChildWindow, an instance of that window is created as part of the XAML markup and passed to the PopupChildWindowAction. The first time the corresponding InteractionRequest is raised, the window would be shown correctly. But the following times the window will not be shown, as it was closed and cannot be used again. The action cannot create a new instance of the window either, meaning that in WPF a PopupChildWindowAction could only be used once. This "limitation" is not present with Silverlight's ChildWindows, as they can be reused multiple times without problems.

If you want to use a similar functionality in WPF, I believe you could find the PopupWindowAction portrayed in the following blog post useful. Instead of receiving a Window it receives view which wraps in a new Window each time the InteractionRequest is raised, allowing it to be used multiple times:
I hope this helps to give some light on those topics.

Thanks,

Damian Cherubini
http://blogs.southworks.net/dcherubini

Viewing all articles
Browse latest Browse all 1878

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>