mef

MEF WPF - Cancel Application.Current.Shutdown() by plugins

自作多情 提交于 2019-12-30 10:29:28
问题 are there any ways to cancel Application.Current.Shutdown(); background: i played with mef a little bit and put some plugins to my main app. if any plugin call Application.Current.Shutdown(); my main app shutdown too and i got no chance to cancel this. are there any ways? 回答1: It don't look like it. So instead of having your plugins do a shutdown, instead have them call some method in your application class that will handle the shutdown request for them. See below link also for more info.

Visual Studio MEF Extension - Force Margin Glyphs To Be Updated or Redraw

别说谁变了你拦得住时间么 提交于 2019-12-30 08:17:10
问题 The extension I am writing started life from the Walkthrough: Creating a Margin Glyph example provided by Microsoft: https://msdn.microsoft.com/en-us/library/ee361745.aspx Everything works fine, except I am trying to trigger the redrawing or updating of the margin glyphs whenever the data I use for deciding which line to draw a glyph on changes. Basically I have a button in a tool window, when the user clicks the button, I want a glyph to appear in the margin. Right now, it does not appear

mef enum exports and architecture

醉酒当歌 提交于 2019-12-30 07:48:47
问题 I want to make my plugin subsystem using mef but i have few question because i am newbie in csharp and mef ( What i want to do: every plugin can create its own interface IPlugin1, IPlugin2 ... each of these interfaces must have specified functions Load, Unload using mef i want to enum all exports and call Load/Unload The questions: a. Is my solution good and if no how can i improve it (by using something else)? b. How to enum all exports using mef and call specified interface function? I

Using MEF with C#, how do I call methods on the host, from the plugin?

邮差的信 提交于 2019-12-30 06:52:08
问题 I am trying to add plugin extensibility to my C# application using the Managed Extensibility Framework (MEF) framework, and so far it is going ok; I have my main/host application loading plugins from a defined folder, and can call their methods etc. from the main application. Both the host application and the plugins reference a seperate dll assembly which contains the interfaces common to all projects. This is working fine and I can call/interact with the plugins from the main application.

Using MEF with C#, how do I call methods on the host, from the plugin?

牧云@^-^@ 提交于 2019-12-30 06:52:08
问题 I am trying to add plugin extensibility to my C# application using the Managed Extensibility Framework (MEF) framework, and so far it is going ok; I have my main/host application loading plugins from a defined folder, and can call their methods etc. from the main application. Both the host application and the plugins reference a seperate dll assembly which contains the interfaces common to all projects. This is working fine and I can call/interact with the plugins from the main application.

Alternatives to Prism + MEF for modular MVVM apps [closed]

末鹿安然 提交于 2019-12-29 03:10:51
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 6 years ago . My team and I are beginning to plan the development of a modular application which will likely multi-target WPF & Silverlight. I

MVC实用架构设计(二)——使用MEF应用IOC(依赖倒置)

独自空忆成欢 提交于 2019-12-26 09:41:44
MVC实用架构设计(二)——使用MEF应用IOC(依赖倒置) 前言   在《 上篇 》中,基本的项目结构已经搭建起来了,但是有个问题,层与层之间虽然使用了接口进行隔离,但实例化接口的时候,还引入了接口实现类的依赖。如下图:    面向接口编程 ,Controller应该只依赖于站点业务层的接口,而不能依赖于具体的实现,否则,就违背了在层之间设置接口的初衷了。   另外,如果上层只依赖于下层的接口,在做单元测试的时候,就可以用 Moq , Fakes 等Mock工具来按实际需求来模拟接口的实现,就可以灵活的控制接口的返回值来对各种情况进行测试,如果依赖于具体的实现,项目的可测试性将大大减小,不利于进行自动化的单元测试。   要不依赖于具体的实现,就不能使用通常的 T t = new T() 的方式来获得一个类的实例了,需要通过IOC容器来对对象生命周期,依赖关系等进行统一的管理。 MEF的优势   .net中可用的IOC容器非常多,如 CastleWindsor,Unity,Autofac,ObjectBuilder,StructureMap,Spring.Net等,这些第三方工具各不相同,但功能大体都相同,大都需要事先对接口与实现进行配对(通过代码或配置文件),然后由系统自动或手动来通过接口来获得相应实现类的实例,对象实例化的工作由IOC容器自动完成。  

Making MEF plugins work with Rx

和自甴很熟 提交于 2019-12-25 08:14:03
问题 So the current situation is I have a program that is completely utilizing MEF. Now I want to make it utilize Rx as to allow it to scale to larger queries and allow the user to look over results as the various plugins return results. It is currently setup as such: Workflow: Query => DetermineTypes => QueryPlugins => Results Currently the code is all stored on GitHub if anyone needs to reference more than what I post below. ALeRT on GitHub With the help of @Enigmativity the primary portion is

Updating MEF catalog at runtime

浪尽此生 提交于 2019-12-25 06:52:14
问题 I am currently working on an MVC web app with MEF so that a) developers can develop plugins for the website, and users can elect which plugins they want on their account. This means that some of my composition has to happen after the app has already started and the user has logged in (which goes to the database, grabs the assemblies for the plug in and adds them to the current catalog). The way it works is I have a couple of libraries that I store in the database and pull out when the user

Prism and MVVM databinding from modules to main shell datacontext

二次信任 提交于 2019-12-25 04:57:29
问题 Have some experience with WPF and databinding, but completely new to PRISM and MVVM. I'm working on Prism application where I have a shell and multiple modules. In my previous WPF application I had a single window datacontext (with all objects I need) which I could then simply databind from any usercontrol inside my window. In the context of the Prism, what is the proper way to have a single datacontext, let's we call it ShellViewModel and then for all modules to bind to its' objects and