prism-4

Is it possible to write Prism apps such that they can be tested without the UI?

拥有回忆 提交于 2019-12-05 04:13:58
Disclaimer: Prism Novice. I'm reading up furiously to make up for lost time though :) Context: I need to write automated acceptance tests for a WPF application built using Prism. Issues: I find that it is convoluted trying to compose the backing ViewModels and everything that they need without the UI. I may be wrong here... Prism allows you to mark up the shell with named placeholders (regions). Different modules (isolated units) register their Views with the corresponding RegionNames. The Views also have a dependency on the ViewModel (ctor injection) which is injected via MEF/Unity. Showing

Displaying modal dialogs using PRISM 4

…衆ロ難τιáo~ 提交于 2019-12-04 19:07:17
I'm developing a .NET 4.0 application using PRISM and MVVM, as well as WPF. I currently have a shell subdivided in regions, with views inserted in them. When the user clicks on a button in one of the views, I would like a custom-made modal dialog to be displayed on top of all the views, but still within the same shell. I looked at the StockTrader RI example and their implementation of the RegionPopupBehavior. Basically, they created a dependency property which allows them to define regions with a specific, custom-made behavior. The behavior is the one in charge of handling it's associated view

getting error 'Microsoft.Practices.ServiceLocation.ActivationException' occurred in Microsoft.Practices.ServiceLocation.dll

夙愿已清 提交于 2019-12-04 19:07:14
I am Unit Testing MVVM based application that uses prism and using mocking to test view model . I am able to call the constructor of my viewmodel class by passing mock objects of region manager and resource manager but when control goes inside constructor it fails at the following statement : private EventAggregator() { this.eventAggregatorInstance = ServiceLocator.Current.GetInstance<IEventAggregator>(); } It gives error : An unhandled exception of type 'Microsoft.Practices.ServiceLocation.ActivationException' occurred in Microsoft.Practices.ServiceLocation.dll Additional information:

ASP.net like form based authentication in WPF MVVM prism [closed]

て烟熏妆下的殇ゞ 提交于 2019-12-04 10:54:48
Having working on WPF MVVM (prism) application, I would like to implement authentication as it is for ASP.NET form based authentication. I would like to restrict users going to screens where authorization is required. how can this be implemented in WPF application, as I am using PRISM. Assuming you are using Regions to navigate within your application, then your viewModels can implement the IConfirmNavigationRequest interface. There, you can use ConfirmNavigationRequest which takes a callback, to determine if the user has access to the view, and if not, deny it. Samples can be found here Check

How to create a new view every time navigation occurs in PRISM?

喜夏-厌秋 提交于 2019-12-04 07:24:35
I'm using WPF4 and PRISM4 for my new project. There is a single module with several views in it. The DI is done with unity. When I navigate from ViewA to ViewB for the first time, the ViewB is created and its constructor is called. But when I try to navigate to ViewB for the second, third time, the ViewB is not created, but existing instance is reused. I'm using IRegionManager.RequestNavigate for my navigation purposes. I've tried to pass TransientLifeTimeManager to RegisterType Unity methods, but to no avail. Is there a way to configure prism and/or unity to create a new view every time I

Prism 4: RequestNavigate() not working

我的未来我决定 提交于 2019-12-03 22:35:22
I am building a demo app to learn the navigation features of Prism 4. The app has two modules--each one has three Views: A UserControl with a text block ("Welcome to Module A") A RibbonTab (using a Region Adapter), and An Outlook-style Task Button (like Outlook's Mail, Calendar, and so on) The Shell has three named regions: "RibbonRegion", "TaskButtonRegion", and "WorkspaceRegion". The Views load into these regions. To test the basic setup, I registered all three Views with the Prism Region Manager, so that they would load at startup, and all worked as expected. Next, I modified the setup so

Prism / MEF: How to RegisterViewWithRegion Without Hard-Coding the Region Name

别来无恙 提交于 2019-12-03 15:26:30
We are building a WPF Prism application. We have different developers working on different module projects, and multiple modules are injected into the main Application Shell. The main application is also a separate project. We also want to be able to use the modules in different applications. We do not want to have to name the Regions with the same names in every application. For instance, say we have a module to be used in two different applications. In one application, its developer may name the module's region "DetailsRegion," and in the other, its developer may name it "ResultsRegion."

DataTemplate to generate Menu with MVVM

点点圈 提交于 2019-12-03 15:04:37
问题 I'm trying to use a DataTemplate to create a Menu from my ViewModels with respect to MVVM. Basically, I've created several classes which will store information about my Menu structure. I then want to realize that menu stucture as a WPF Menu using a DataTemplate. I have a menu service which allows different components to register new menus and items within the menus. Here's how I've organized my menu information (ViewModel) I have the following classes: MainMenuViewModel - Contains a

PRISM + MEF + MVVM — Not sure where to really start?

佐手、 提交于 2019-12-03 11:56:31
问题 What I'm using: Visual Studio 2010 Microsoft .NET Framework 4 Prism v4 What I am trying to figure out is how to get started with Prism + MEF while maintaining the MVVM pattern. When I go into the Prism Quickstarts, it has a Prism + MEF, but the comments in the project specifically state that the Quickstart example does not implement MVVM. I'm not really sure what to mix/match so that my shell itself follows MVVM (and regions). Basically, I want to use MEF to be able to load Assemblies

Prism v4: Unity or MEF?

与世无争的帅哥 提交于 2019-12-03 05:36:14
问题 I downloaded Prism v4 and ran the installer. I went into the directory and ran the two following batch files: Desktop only - Open Modularity With Mef QuickStart.bat Desktop only - Open Modularity With Unity QuickStart.bat When I compile these applications, I don't see any real difference. I've searched for MEF vs Unity and I've found some pros/cons, but nothing that specifically states whether one is "better" (and I know that is subjective) with use in Prism. I guess perhaps if I list my