简体   繁体   English

为MvvmCross插件实施缺少的平台

[英]Implement missing platform for MvvmCross plugin

I want to use an MvvmCross plugin in my project, however one of my platforms is Wpf. 我想在项目中使用MvvmCross插件,但是我的平台之一是Wpf。 Unfortunately there's no Wpf implementation ( https://github.com/brianchance/MvvmCross-UserInteraction ). 不幸的是,没有Wpf实现( https://github.com/brianchance/MvvmCross-UserInteraction )。

What is the proper way of adding WPF platform implementation to my project? 将WPF平台实现添加到我的项目中的正确方法是什么?

More specifically, my questions are: 更具体地说,我的问题是:

  • In the implementation I need to use UI controls and components to display message boxes, thus should it be "WPF Custom Control Library" or can I use just standard "Class library"? 在实现中,我需要使用UI控件和组件来显示消息框,因此它应该是“ WPF自定义控件库”还是仅可以使用标准的“类库”?
  • Do I have to add Nuget packages Mvvm.CrossCore and Mvvm UserInteractionPlugin to my WPF implementation library? 我是否必须将N​​uget包Mvvm.CrossCore和Mvvm UserInteractionPlugin添加到WPF实现库中?

Ideally I'd like to create and test WPF implementation in my own project and then contribute it to plugin repo on github. 理想情况下,我想在自己的项目中创建和测试WPF实施,然后将其贡献给github上的插件仓库。

The simplest would be to clone the original repo. 最简单的是克隆原始存储库。 Then add a new Class Library project for your WPF implementation. 然后为您的WPF实现添加一个新的类库项目。

If you look at the existing Windows Store project, it simply adds a project reference to the UserInteraction (PCL) project. 如果您查看现有的Windows Store项目,则只需将项目引用添加到UserInteraction(PCL)项目。

Create a UserInteraction class that implements IUserInteraction . 创建一个实现IUserInteractionUserInteraction类。 Add your WPF implementation there. 在此添加您的WPF实现。

Include the Plugin class so it will auto-register in MvvmCross. 包括Plugin类,以便它将在MvvmCross中自动注册。

You can then modify the existing .nuspec file to add entries for your WPF assemblies. 然后,您可以修改现有的.nuspec文件以为WPF程序集添加条目。

This is pretty much how all MvvmCross plugins work. 这几乎就是所有MvvmCross插件的工作方式。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM