简体   繁体   English

如何将GUI dll集成到另一个应用程序(例如Windows或wpf应用程序)

[英]how to integrate a GUI dll into another application (like windows or wpf application)

I am new to dll related concepts. 我是dll相关概念的新手。 I have created a dll which imports data. 我创建了一个导入数据的dll。 Now this dll actually was a console application and it can browse file using openfiledialog and even shows messages using messagebox. 现在,该dll实际上是一个控制台应用程序,它可以使用openfiledialog浏览文件,甚至可以使用messagebox显示消息。 And this message box and openfiledialog was created dynamically.. The application in itself works very fine.. Now I am required to create a dll of it and integrate to another application now this application can be windows or even wpf.. 这个消息框和openfiledialog是动态创建的。该应用程序本身运行良好。现在,我需要创建它的dll并集成到另一个应用程序中,现在该应用程序可以是Windows甚至是wpf。

Is it possible to do so? 有可能这样做吗? Because when I am integrating the dll to windows form I am actually getting IO exception unhandled error.. 因为当我将dll集成到Windows窗体时,我实际上收到了IO异常未处理的错误。

Yes some of you may suggest like executing the exe in other application which works fine but can dll too be created? 是的,你们中的一些人可能会建议像在其他应用程序中执行exe一样工作正常,但也可以创建dll吗?

In Solution Explorer add new project. 在解决方案资源管理器中添加新项目。 Select class library. 选择类库。 Put your code there, create some public methods so other classes (UI) can access the logic/operations there. 将您的代码放在这里,创建一些公共方法,以便其他类(UI)可以访问那里的逻辑/操作。 Thus it should be independent from the view/controller and if the code works independently it should work with wpf or winforms or whatever on top of it. 因此,它应独立于视图/控制器,并且如果代码独立运行,则应使用wpf或winforms或它之上的任何东西。

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

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