资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

wpf性能问题

1,wpf最好使用通用模板,使用StaticResource引用样式

囊谦网站制作公司哪家好,找创新互联!从网页设计、网站建设、微信开发、APP开发、成都响应式网站建设公司等网站项目制作,到程序开发,运营维护。创新互联成立于2013年到现在10年的时间,我们拥有了丰富的建站经验和运维经验,来保证我们的工作的顺利进行。专注于网站建设就选创新互联

2,释放事件。每个UserControl,Page,Window都实现一个接口

    interface IUIElement : IDisposable
   {
       ///
       /// 注册事件
       ///

       void EventsRegistion();

       ///
       /// 解除事件注册
       ///

       void EventDeregistration();
   }

来注册事件和解除事件

3,定时回收垃圾

DispatcherTimer GCTimer=new DispatcherTimer();
public MainWindow()
{
   InitializeComponent();
   this.GCTimer.Interval= TimeSpan.FromMinutes(10);//垃圾释放定时器 我定为每十分钟释放一次,大家可根据需要修改
 this.GCTimer.start();

   this.EventsRegistion();    // 注册事件
}

publicvoid EventsRegistion()
{
   this.GCTimer.Tick+=new EventHandler(OnGarbageCollection);
}

publicvoid EventDeregistration()
{
   this.GCTimer.Tick-=new EventHandler(OnGarbageCollection);
}

void OnGarbageCollection(object sender, EventArgs e)
{
   GC.Collect();
   GC.WaitForPendingFinalizers();
   GC.Collect();
}

本文标题:wpf性能问题
文章链接:http://cdkjz.cn/article/jjdpgj.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

大客户专线   成都:13518219792   座机:028-86922220