如何将.NET WPF应用程序转换为Windows窗体?

时间:2021-11-09 20:37:42

We have created a beautifully designed .NET WPF desktop application. We are installing the application with InnoSetup , and if .NET 3.5 is not present, it automatically installs it. However, the package to download .NET 3.5 is huge and we found out that about 30% of users do not finish instalation due to this.

我们创建了一个设计精美的。net WPF桌面应用程序。我们正在用InnoSetup安装应用程序,如果. net 3.5不存在,它会自动安装它。然而,下载。net 3.5的软件包是巨大的,我们发现大约30%的用户因为这个原因没有完成安装。

The obvious solution is to recode everything into .NET 1.1 with Windows Forms but its a major development which would take few weeks. Also, we would then face dilemma if to support both versions (and use innosetup to choose the right one) or just ditch WPF all together.

显而易见的解决方案是,将所有内容重新编码到。net 1.1中,并使用Windows窗体,但这是一个主要的开发过程,需要几个星期的时间。此外,如果支持两个版本(并使用innosetup来选择正确的版本),或者仅仅将WPF放在一起,我们将面临两难的境地。

Is there any easy way how to convert WPF to Windows Forms? Or do we have any alternative options to consider?

有什么简单的方法可以将WPF转换成Windows窗体吗?或者我们有其他的选择可以考虑吗?

Thank you!

谢谢你!

4 个解决方案

#1


6  

Converting WPF to WinForms is not trivial, there is certainly no automated way, and if you want to go back to .net 1.1 as well you'll lose a whole load of other features like generics etc, so it's not just the UI you'll be changing.

将WPF转换为WinForms并非易事,当然也没有自动的方法,如果你也想回到。net 1.1,你将会丢失大量的其他特性,比如泛型等等,所以你要改变的不仅仅是UI。

The best solution would be to target the .net client profile instead. It's a much smaller download.

最好的解决方案是针对。net客户端概要文件。这是一个小得多的下载。

If you can wait a few weeks, the client profile in .net 4.0 has far better offline installation and platform support. See here and here.

如果您可以等待几周,那么。net 4.0中的客户端配置文件将有更好的离线安装和平台支持。看到这里和这里。

#2


1  

You could use the .NET Client Profile introduced in .NET 3.5 SP1 in order to reduce the size of the download required to run the app on computers without the .NET Framework 3.5 installed.

您可以使用. net 3.5 SP1中引入的. net客户端配置文件,以减少在未安装. net Framework 3.5的情况下在计算机上运行应用程序所需的下载数量。

The .NET Client Profile is about 28 MB in size, as described here.

正如这里所描述的,. net客户端配置文件的大小大约为28 MB。

Also, have a look at this site to determine the smallest, easiest download required to get the .NET Framework on your system.

此外,请查看此站点,以确定在系统上获得. net框架所需的最小、最简单的下载。

#3


1  

Since you say "beautifully designed", I'm going to assume that you made extensive use of WPF's UI elements. If this is the case, forget about porting the UI back to WinForms.

既然你说“设计得很漂亮”,我就假设你大量使用了WPF的UI元素。如果是这种情况,请忘记将UI移植回WinForms。

The non-UI parts of your program can be back-ported easily (possibly with no changes at all) IFF (if and only if) they don't reference any post-2.0 stuff (like LINQ, for example).

您的程序的非ui部分可以很容易地向后移植(可能没有任何变化)IFF(如果且仅当),它们不引用任何后2.0的东西(例如LINQ)。

#4


0  

Did you try the Client only framework subset? You just check a box in your project setup and it will use a slimmed down 26 mb version of .net 3.5. It is also known as Client Profile http://blogs.msdn.com/blogfiles/pietrobr/WindowsLiveWriter/.NETFramework3.5ClientProfile_8AF0/clip_image002_thumb.gif

您是否尝试了客户端框架子集?您只需在项目设置中选中一个方框,它将使用一个减少了26 mb的。net 3.5版本。它也被称为客户配置文件http://blogs.msdn.com/blogfiles/pietrobr/WindowsLiveWriter/.NETFramework3.5ClientProfile_8AF0/clip_image002_thumb.gif

#1


6  

Converting WPF to WinForms is not trivial, there is certainly no automated way, and if you want to go back to .net 1.1 as well you'll lose a whole load of other features like generics etc, so it's not just the UI you'll be changing.

将WPF转换为WinForms并非易事,当然也没有自动的方法,如果你也想回到。net 1.1,你将会丢失大量的其他特性,比如泛型等等,所以你要改变的不仅仅是UI。

The best solution would be to target the .net client profile instead. It's a much smaller download.

最好的解决方案是针对。net客户端概要文件。这是一个小得多的下载。

If you can wait a few weeks, the client profile in .net 4.0 has far better offline installation and platform support. See here and here.

如果您可以等待几周,那么。net 4.0中的客户端配置文件将有更好的离线安装和平台支持。看到这里和这里。

#2


1  

You could use the .NET Client Profile introduced in .NET 3.5 SP1 in order to reduce the size of the download required to run the app on computers without the .NET Framework 3.5 installed.

您可以使用. net 3.5 SP1中引入的. net客户端配置文件,以减少在未安装. net Framework 3.5的情况下在计算机上运行应用程序所需的下载数量。

The .NET Client Profile is about 28 MB in size, as described here.

正如这里所描述的,. net客户端配置文件的大小大约为28 MB。

Also, have a look at this site to determine the smallest, easiest download required to get the .NET Framework on your system.

此外,请查看此站点,以确定在系统上获得. net框架所需的最小、最简单的下载。

#3


1  

Since you say "beautifully designed", I'm going to assume that you made extensive use of WPF's UI elements. If this is the case, forget about porting the UI back to WinForms.

既然你说“设计得很漂亮”,我就假设你大量使用了WPF的UI元素。如果是这种情况,请忘记将UI移植回WinForms。

The non-UI parts of your program can be back-ported easily (possibly with no changes at all) IFF (if and only if) they don't reference any post-2.0 stuff (like LINQ, for example).

您的程序的非ui部分可以很容易地向后移植(可能没有任何变化)IFF(如果且仅当),它们不引用任何后2.0的东西(例如LINQ)。

#4


0  

Did you try the Client only framework subset? You just check a box in your project setup and it will use a slimmed down 26 mb version of .net 3.5. It is also known as Client Profile http://blogs.msdn.com/blogfiles/pietrobr/WindowsLiveWriter/.NETFramework3.5ClientProfile_8AF0/clip_image002_thumb.gif

您是否尝试了客户端框架子集?您只需在项目设置中选中一个方框,它将使用一个减少了26 mb的。net 3.5版本。它也被称为客户配置文件http://blogs.msdn.com/blogfiles/pietrobr/WindowsLiveWriter/.NETFramework3.5ClientProfile_8AF0/clip_image002_thumb.gif