• 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
  • 相关阅读:
    谈Delphi编程中“流”的应用 (一)
    Ihtmldocument2接口的使用
    TWebBrowser 异常 invalid floating point operation
    万一的 Delphi 博客 (注意 delphi的新功能)
    正则表达式应用(一)
    查询数据库所有表所有字段的某个值,生成更新代码 (VB)
    正则表达式应用(二)
    让程序支持脚本
    查探对方是否加你为好友
    常用的一些批处理,脚本功能(一)
  • 原文地址:https://www.cnblogs.com/luoyaoquan/p/2121858.html
Copyright © 2020-2023  润新知