在WPF中开发交互式应用程序的最佳方法 [英] Best approach to develop interactive application in WPF

查看:107
本文介绍了在WPF中开发交互式应用程序的最佳方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我使用VB.Net在WPF应用程序中为公共(全屏)创建了一个交互式信息应用程序。我正在使用Page.xaml作为我的界面并显示来自本地MySQL的数据/信息。



我有一个问题,即自助服务终端在高内存运行并且在增加时公众使用不停不减,减速慢。我正在使用任务管理器来查看使用情况(是的,我知道我不应该从中查看和进行基准测试,但是当任务管理器的RAM达到最大值时,应用程序将挂起。就这样挂起直到我终止它)。



我实现了IDisposable,Finalize,SetProcessWorkingSetSize,配置内存流,配置rdr(查询),DecodePixelWidth并设置了BitmapScalingMode.LowQuality但是程序将在连续使用后挂起。



还有其他方法可以解决这个问题吗?这些方法能做得更好吗?

1)使用Window.xaml

2)使用Frame并调用其中的每一页

3)使用VirtualStackPanel

4)UserControl?



我也尝试在VS2015上运行这个应用程序,在那里它有DiagnosticTools来查看进程内存。 GC以某种方式击中,直到2GB播放达到2GB并且在闲置5分钟后不会降低到1GB。



我的开发: -

- WPF页面

- .Net4ClientProfile

- VS2010

- Windows 8.1

- 16GB内存

- 2GB DDR5

- 还有别的,请问。



Kiosk: -

- 英特尔i5

- 4GB内存

- 集成高清图形



我想知道的是: -

1.是什么让我的程序没有减少内存

2.使用Arraylist会导致这个

3.动画和拥挤的设计是否导致此问题(客户提议)

4.查询MySQL是否会导致问题

5.是否有窗口后台进程(服务或无效的Windows许可)

6. Windows 8不稳定?

7.使用非页面?

8.写作在VB.Net中也有影响吗?



什么我试过了:



实现IDisposable,Finalize,SetProcessWorkingSetSize,处理内存流,配置rdr(查询),DecodePixelWidth并设置BitmapScalingMode.LowQuality

Hi all,

I have created an application like interactive information application for public (full screen) in WPF Application using VB.Net. I'm using Page.xaml as my interface and display data/information from local MySQL.

I have a problem where the kiosk is running at high memory and increasing when public using without non-stop and slow on decreasing. I'm using a task manager to see the usage(Yes I know I should not look and benchmark from it but when the RAM is at maximum from task manager,the application will be hang. Just hang like that until I terminate it).

I have implement IDisposable, Finalize, SetProcessWorkingSetSize, dispose memorystream, dispose rdr(query), DecodePixelWidth and set BitmapScalingMode.LowQuality but still program will be hang after continuously use.

Any other way to overcome this? Will these approach can do better?
1) Using Window.xaml
2) Using Frame and call every page inside it
3) Use VirtualStackPanel
4) UserControl?

I also try running this application on VS2015 where it got DiagnosticTools to see the Process Memory. GC somehow hit and it achieve until 2GB for 2 minutes play and not decrease to even 1GB after let it idle for 5 minutes.

My development:-
- WPF Page
- .Net4ClientProfile
- VS2010
- Windows 8.1
- Intel i7
- 16GB RAM
- 2GB DDR5
- Any other else,kindly ask.

Kiosk:-
- Intel i5
- 4GB RAM
- Integrated HD Graphic

What I want to know actually is:-
1. What made my program not decrease memory
2. Is using Arraylist can cause this
3. Is animation and crowded design cause this(client's proposal)
4. Does query to MySQL can cause a problem
5. Does windows background process(services or invalid windows licensing)
6. Windows 8 not stable?
7. Using other than page?
8. Writing in VB.Net affect too?

What I have tried:

Implement IDisposable, Finalize, SetProcessWorkingSetSize, dispose memorystream, dispose rdr(query), DecodePixelWidth and set BitmapScalingMode.LowQuality

推荐答案

我们无法告诉你是什么导致了这个问题,除了你正在编写的代码不正确。



列表中没有任何项目是罪魁祸首。这是你的代码中没有妥善管理的东西。



你不是在某处释放对象和/或没有正确处理它们。



您没有正确管理对象列表,即不断向列表添加内容但从不删除它们。你可能会认为你一遍又一遍地使用同一个对象实例,但实际上你可能会在每次使用时创建一个新的对象实例。



有很多可能的原因所以不可能在这里列出所有原因。这真正需要的是对整个应用程序进行代码审查,以确保您正确地执行操作。
We can't tell you what's causing the problem, other than it's your improperly written code that's doing it.

None of the items on your list are the culprit. It's coming down to something in your code that isn't properly managed.

You're not releasing objects somewhere and/or not Disposing of them properly.

You're not managing lists of objects properly, i.e., constantly adding things to a list but never removing them. You may think that you're using the same instance of an object over and over again but you may actually be creating a new instance of the object on every use.

There's a ton of possible causes so it's impossible to list them all here. What this really needs is a code review over your entire application to make sure you're doing things properly.


如果您有许多大型对象(就内存而言)最终会在大对象堆你的内存可能会碎片化,以便你不能再分配另一个大对象,即使总内存足够。

参见:

.net - 为什么选择大型物体堆?我们为什么关心? - 堆栈溢出 [ ^ ]



搜索 - CodeProject:大对象 [ ^ ]
If you have many large objects (in terms of memory) that end up in the Large Object Heap your memory could become fragmented so that you can no longer allocate another large object, even though the total memory is sufficient.
See:
.net - Why Large Object Heap and why do we care? - Stack Overflow[^]
and
Search - CodeProject: "large object"[^]


这篇关于在WPF中开发交互式应用程序的最佳方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆