prism

How to Mock ILogger / ILoggerService using Moq

这一生的挚爱 提交于 2020-01-03 08:22:21
问题 I'm writing some unit tests for my View Model class. The constructor of this class is injected with an ILoggerService. This interface defines 1 method GetLog which returns an ILogger. Something like below where this represents a class that implements ILoggable:- protected ViewModelBase(ILoggerService loggerService) { Logger = loggerService.GetLog(this); } I'm trying to unit test my CreateNewOrder method that looks like below: private void CreateNewOrder(INewOrderViewModel newOrderViewModel) {

DelegateCommand vs RoutedCommand and gestures - WPF

我们两清 提交于 2020-01-02 09:56:32
问题 is there anyway for DelegateCommand's to support gestures when building a composite WPF app? I'm trying to create a command used by a MenuItem and also a Button, which can be accessed through a keyboard shortcut, but which sits inside a class in a separate assembly. I can use a RoutedCommand, but I want to minimise any code-behind. 回答1: Use InputBindingCollection to map gestures with ICommand. 来源: https://stackoverflow.com/questions/2297321/delegatecommand-vs-routedcommand-and-gestures-wpf

Why implement an interface on viewmodel and view in mvvm

我是研究僧i 提交于 2020-01-02 03:10:08
问题 I am quite new to MVVM pattern so please bear with me. I have seen implemnentations in wpf +mvvm + prism where all the views tend to have an IView as top most interface. Then the views in the respective modules have a view specific interface like IViewA, IViewB etc which implement the IView interface. Even the viewmodel has IViewModel top most interface and the subsequent modules have IViewAViewModel , IViewBViewModel etc that inherit from the IViewmodel. IViewmodel has a reference to Iview

WPF Cloned/Detached object edit problem - what is the standard?

痴心易碎 提交于 2020-01-01 19:47:07
问题 I am using an ObservableCollection to wrap some of my generated entity framework objects. When the user wants to edit some values , i am opening a popup windows that contains fields, and when the user changes and press save - the changes are saved to the database, and the binded controls are changes as it is an observablecollection. To prevent the user from working on the same binded object (it causes the visual change of every binded control on the same time) i want to use some functionality

High Level Modelling Advice for Prism MVVM

只愿长相守 提交于 2020-01-01 06:42:13
问题 I'm beginning modelling an existing application for controlling a cash collection terminal. I'm very new to the Prism / Composite Application Library and would like some advice on how I could begin modelling this application using the Prism library. Basically the application manages a cash terminal that accepts frequent cash drops, counts notes in the deposits, communicates via a 3G/Edge connection with our central server to replicate deposit and other data, and performs cashups. Central to

Prism event aggregator not working from separate module

删除回忆录丶 提交于 2020-01-01 05:18:14
问题 I am having trouble with the prism event aggregator. If I subscribe to, and publish an event in the same module it works fine. Like this - public class InfrastructureModule : IModule { private IEventAggregator eventAggregator; public InfrastructureModule(IEventAggregator eventAggregator) { this.eventAggregator = eventAggregator; eventAggregator.GetEvent<TestEvent>().Subscribe(TestSub); } public void Initialize() { eventAggregator.GetEvent<TestEvent>().Publish("Infrastructure module"); }

Prism 4 - locally scoped RegionManager

萝らか妹 提交于 2020-01-01 03:22:26
问题 I have silverlight 4 application with PRISM 4, I'm using MEF. My Shell defines one main region in which modules are loaded, I want modules to have their own RegionManager, so regions that they define are places in local RegionManager instead of global. And I want this local RegionManager to be resolved by container (for type IRegionManager) when inside the module. However the method from documentation: IRegion detailsRegion = this.regionManager.Regions["DetailsRegion"]; View view = new View()

AvalonDock with Prism Region Adapter

最后都变了- 提交于 2020-01-01 03:17:14
问题 I have seen some questions on SO but none of them seemed applicable for me. I want to be able to use the great Avalondock 2.0 with Prism 4. However, all the sample region adapters for that is for Avalondock 1.x series, that I cannot get it working. Does anyone have sample code on how to create a Region Adapter for AvalonDock's LayoutDocumentPane and LayoutAnchorablePane? 回答1: Unfortunately, to the best of my knowledge, both the "LayoutDocumentPane" and the "LayoutAnchorablePane" do not allow

How to use resource dictionary in prism modules at design time?

我只是一个虾纸丫 提交于 2019-12-31 16:02:21
问题 I am using prism framework in a silverlight app with multiple modules in separate XAPs. I have a resource dictionary defined in my in my shell project. In my modules I can use the resources fine, but since the modules are decoupled from the shell until they are loaded at runtime the designer does not show them or recognize them. Is there a way to make the modules aware of my resources at design time without merging my resource file in every view xaml? My resource files are in a "common"

How to hide the error label in Xamarin forms, when the Entry field is not visible?

丶灬走出姿态 提交于 2019-12-31 05:39:23
问题 I am trying to create a Login page that has validation errors. Right now the validation errors are also appearing if the Entry field is not visible. How would I hide the error labels, when the entry field is not visible? As shown below: The PIN entry field is invisible on the login page but the error message: Pin is required , highlights. Please could anyone suggest a workaround? 回答1: Agree with Jason . You can use the data-binding to binding the IsVisible of labelto the property in your