private void DataInitialize() { if (this.IsHandleCreated) { this.BeginInvoke(new MethodInvoker(() => { var st = new System.Diagnostics.Stopwatch(); st.Start(); RibbonTabManager ribbonMenuManager = new RibbonTabManager(new EventHandler(this.ribbonButton_ClickEventHandler)); ribbonMenuManager.BuildRibbonTab(this.c1Ribbon, SessionContext.MainMenu, SessionContext.UserProfile.DefaultModuleId); st.Stop(); logger.Debug(string.Format("创建主菜单用时 {0} 秒.", st.Elapsed.TotalSeconds)); })); } }
private void Initialize() { this.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint, true); RibbonTabManager ribbonMenuManager = new RibbonTabManager(new EventHandler(this.ribbonButton_ClickEventHandler)); ribbonMenuManager.BuildRibbonTab(this.c1Ribbon, SessionContext.MainMenu, SessionContext.UserProfile.DefaultModuleId); //Thread thread = new Thread(new ThreadStart(DataInitialize)); //thread.IsBackground = true; //thread.Start(); }