mef

Prism: Share data between ViewModels loaded into a region?

◇◆丶佛笑我妖孽 提交于 2019-12-10 02:16:02
问题 I've got a View containing a TabControl bound to a region "CustomerRegion". I've got a few View/ViewModels which are marked as [ViewExport(RegionName = "CustomerRegion")]. These items are loaded successfully into the TabControl. But now I need these TabItems to share some data in this TabControl (can't be global since there might be two or more of these open at one time). Any ideas how these TabItems can share data without leaving MVVM/MEF? 回答1: Prism has the concept of "Region Context" that

Adding an instance to a MEF container

*爱你&永不变心* 提交于 2019-12-09 14:41:44
问题 How can you add an already created instance to a MEF container/cataloge to use when resolving Imports. I want the functionality that Unity gives with the RegisterInstance method on its containers. 回答1: You can use the ComposeExportedValue function for this, like so: var container = new CompositionContainer(); container.ComposeExportedValue<Application>("Application", Application.Current); 来源: https://stackoverflow.com/questions/5191316/adding-an-instance-to-a-mef-container

Register custom file type with custom UI editor in Visual Studio 2010

纵然是瞬间 提交于 2019-12-09 13:19:08
问题 I found old article called LearnVSXNow and part #30 - Custom Editors in Visual Studio. There is sample project The Blog Item Editor which shows how to make custom file type assigned with custom UI editor for this file type extension (.blit) This sample uses project VSXtra, which is written for Visual Studio 2008 . Can someone point me to some tutorial, how-to, or something how to do the same for Visual Studio 2010 ? My goal is to register custom file type extension (e.g. *.myext1) within

VS 2010 mouse processor extension - not working

人走茶凉 提交于 2019-12-09 03:48:48
问题 I am experimenting with a Visual Studio 2010 extension, where I need to work with the events exposed by IMouseProcessor. As far as I can tell from the docs, I should create an IMouseProcessorProvider and export is using MEF, so that it can be automatically picked up by Visual Studio. I created this class: [Export(typeof(IMouseProcessorProvider))] [ContentType("code")] internal sealed class MouseProcessorFactory : IMouseProcessorProvider { public IMouseProcessor GetAssociatedProcessor

Visual Studio Package build and DLLs in private bin path

▼魔方 西西 提交于 2019-12-09 00:19:41
问题 I am using MEF to do a sort of crude plugin architecture. This is working well. However, when I do a deployment using the visual studio package/publish build tasks (which I am calling via NAnt/MSbuild). My unreferenced plugin assemblies are not being included in the package and so are not deployed. Is there a way to tell VS/MSBuild to include these DLLs? They live in /bin/Extensions. Cheers, Rob 回答1: Add the assemblies as links in the project where you want them copied: right lick on the

Visual Studio 2010 with Managed Extensiblity Framework

ε祈祈猫儿з 提交于 2019-12-08 08:18:07
问题 I've been looking into into MEF (Managed Extensibility Framework), but I am not entirely sure if it is something that I need and can help me accommplish what I need to do. Can someone provide an easy to understand description of MEF, provides good resources and tutorials (aside from MSDN), and/or know if it can do the task I am trying to do under Visual Studio? The task I am trying to do is to "log" a string of text to a text file whenever the user selects a string of text. I also need this

Displaying SplashScreen Causing InvalidOperationException

心不动则不痛 提交于 2019-12-08 04:48:43
问题 Problem I have a MVVM application that uses Caliburn.Micro as the MVVM framework and MEF for "dependency injection" (in quotes as I am aware it is not strictly an DI container). The composition process of this large application is starting to take increasingly large amounts of time based on the number of compositions MEF is undertaking during the launch of the application and as such I want to use an animated splash screen. Below I will outline my current code that shows the splash screen on

Winforms with MEF

拥有回忆 提交于 2019-12-08 04:13:40
问题 I have a winforms App that uses different tabs. I would like to use MEF to be able to add more tabs that are imported at startup. I am having a hard time figuring out how to go about doing this. Edit: Here is what I did. I took the main winforms class and striped it down so that there is only a TabControl in it which I expose to each each TabPage through an interface. I then also create a second interface ITab which I use with MEF to get the tabpage and then add it to to the main tabcontrol.

send parameter from view-model to constructor of another view-model

旧时模样 提交于 2019-12-08 04:07:27
问题 I use caliburn micro and MEF in wpf and I have this problem. I create shell-view-model: public interface IShellViewModel { void ShowLogOnView(); void ShowMessengerView(PokecAccount account); } [Export(typeof(IShellViewModel))] public class ShellViewModel : Conductor<IScreen>, IShellViewModel { public ShellViewModel() { ShowLogOnView(); } public void ShowLogOnView() { ActivateItem(IoC.Get<LogOnViewModel>()); } public void ShowMessengerView(PokecAccount account) { //send to constructor of

In ASP.NET Core, does the IoC ASP Startup Class solve what the Managed Extensibility Framework solved with a catalog and container?

六眼飞鱼酱① 提交于 2019-12-08 04:00:08
问题 I have read this, MEF (Managed Extensibility Framework) vs IoC/DI but it is dated. Since then MEF was added to Core. When I look at MEF and the IoC in ASP.NET Core, I cannot tell a lot of differences for a plugin architecture. Both "wire-up" dependencies. If I wanted to create a plugin in a Core application using IoC (the built in IoC), why not just change my ConfigureService methods? Is that the same as decorating imports and exports in MEF? How is composition different here, in 2017 (close