zoukankan      html  css  js  c++  java
  • DevExpress controls for WPF load time

    When i use DevExpress controls for WPF-load time of the window on which they are declared-increases. But on second access-it loads fast. Isnt there a way to preload all of needed dll/themes on program startup (let it took 5-10 secs!), but load them fast in overall program? I've searched a bit, found something like this:

        private static void RunTypeInitializers(Assembly a)
        {
            Type[] types = a.GetExportedTypes();
            for (int i = 0; i < types.Length; i++)
            {
                RuntimeHelpers.RunClassConstructor(types[i].TypeHandle);
            }
        }

        private static void PreloadControls()
        {
            ThemeManager.ApplicationThemeName = Theme.Office2007BlueName;

            ThemeManager.SetThemeName(new TextEdit(), Theme.Office2007BlueName);
            ThemeManager.SetThemeName(new TreeListControl(), Theme.Office2007BlueName);

            RunTypeInitializers(Assembly.GetAssembly(typeof(TextEdit)));
            RunTypeInitializers(Assembly.GetAssembly(typeof(TreeListControl)));
            RunTypeInitializers(Assembly.GetAssembly(typeof(BarManager)));

            //GC.KeepAlive(typeof(TreeListControl));
            //GC.KeepAlive(typeof(BarManager));
            //GC.KeepAlive(typeof(TreeListView));
            //GC.KeepAlive(typeof(DevExpress.Xpf.Editors.Settings.MemoEditSettings));
            //GC.KeepAlive(typeof(DevExpress.Xpf.Editors.Settings.TextEditSettings));
        }

    But non of that helps. First load is still long.
    wpf performance controls devexpress
    link|improve this question
        
    asked Jun 1 at 9:34
    0x49D1
    1,122415

    94% accept rate
        
        
    Here such question was answered: devexpress.com/Support/Center/p/B201967.aspx – 0x49D1 Jun 29 at 6:57
    feedback
    1 Answer
    active oldest votes
    up vote 1 down vote accepted
        

    To resolve this issue, I suggest that you ngen our assemblies and use the DXSplashWindow (11.1) or create a similar window manually and show it when the main form opens for the first time.

    This slowdown is caused by JIT and theme loading.

    The RunTypeInitializers simply calls an object constructor. WPF themes are not loaded at this moment because this happens only when a control is about to be shown and the visual tree is generated.

    A possible solution to this problem is to create an invisible window which will contain all our controls, then show and hide it. However, I do not like this approach. In my opinion, it is better to show a splash window.
    link|improve this answer
        
    answered Jun 2 at 9:01
    DevExpress Team
    7,3492413
        
        
    Thank you for the answer. Does DXSplashWindow preload WPF themes when its showed, or i must create own splash window with calls to DX WPF controls to show them first time? – 0x49D1 Jun 2 at 12:52
        
    I have ngen-ed my assemblies and started application again. When i open windows with devexpress controls-it takes lot of time again..So i think that i experience here the problem with WPF themes you described. I'll try invisible window, until you answer about Devexpress's native splash. – 0x49D1 Jun 2 at 13:03
        
    Made the following: added own splashscreen with XtraGrid on it. I show that screen on application start and close after it loads. Still no performance improvements when opening other windows with devexpress components-the first of them starts a bit slowly, but after- even if i close the one-others load really fast! – 0x49D1 Jun 2 at 13:18
        
    The DXSplashWindow cannot improve the application performance. This is just a convenient way to ask the end-user to wait during a long operation. – DevExpress Team Jun 3 at 8:03
  • 相关阅读:
    修改版的jsonView,加入了PHP的反序列化
    CSBlogV2公测发布,欢迎大家下载试用体验.
    C#里使用Oracle提供的Oracle.DataAccess 返回包里的记录集游标,含Oralce里的分页包代码
    用一个示例方法来初始理解ManualResetEvent的用法。
    Head First 设计模式阅读所得:策略模式(Strategy Pattern) 接口的用处(之一)
    延时至调用时获取被反序列化数据的类型的实现
    权限设计中的"依赖颠倒"
    CSCMSV1终于上线内测了[广告贴]
    Windows Service 使用参数安装DEMO,可使用控制台启动方式进行调试,服务安装完后立即启动
    使用assembly.GetExportedTypes();方法时引发动:态程序集中不支持已调用的成员的异常
  • 原文地址:https://www.cnblogs.com/luoyaoquan/p/2121858.html
Copyright © 2011-2022 走看看