private void Window_Loaded(object sender, RoutedEventArgs e) { string[] cmLineArg = System.Environment.GetCommandLineArgs(); ACRoot.SRoot.RootPageWPF = this; ACMenuItem mainMenu; if (ACRoot.SRoot.Environment.User.MenuACClassDesign == null) { ACClassDesign acClassDesign = ACRoot.SRoot.GetDesign(Global.ACKinds.DSDesignMenu); mainMenu = acClassDesign.GetMenuEntryWithCheck(ACRoot.SRoot); } else { using (ACMonitor.Lock(ACRoot.SRoot.Database.ContextIPlus.QueryLock_1X000)) { mainMenu = ACRoot.SRoot.Environment.User.MenuACClassDesign.GetMenuEntryWithCheck(ACRoot.SRoot); } } if (mainMenu != null) { CreateMenu(mainMenu.Items, MainMenu.Items); } InitAppCommands(); InitMainDockManager(); }
private void InitMainDockManager() { if (_RootVBDesign != null) { return; } if (ACRoot.SRoot.Businessobjects != null) { ACClassDesign acClassDesign = ACRoot.SRoot.Businessobjects.GetDesign(Global.ACKinds.DSDesignLayout, Global.ACUsages.DUMain); if (acClassDesign != null) { _RootVBDesign = new VBDesign(); _RootVBDesign.VBContent = "*" + acClassDesign.ACIdentifier; _RootVBDesign.DataContext = ACRoot.SRoot.Businessobjects; } acClassDesign = ACRoot.SRoot.Businessobjects.GetDesign("AppResourceDict"); if (acClassDesign != null) { ResourceDictionary resDict = Layoutgenerator.LoadResource(acClassDesign.XMLDesign, ACRoot.SRoot.Businessobjects, null); if (resDict != null) { resDict.Add("TouchScreenMode", ControlManager.TouchScreenMode); App._GlobalApp.Resources.MergedDictionaries.Add(resDict); } } } if (_RootVBDesign == null) { _RootVBDesign = new VBDesign(); _RootVBDesign.DataContext = ACRoot.SRoot.Businessobjects; } _RootVBDesign.Margin = new Thickness(0, 0, -5, 0); _RootVBDesign.Loaded += new RoutedEventHandler(RootVBDesign_Loaded); SubMainDockPanel.Children.Add(_RootVBDesign); foreach (ACComponent childComp in ACRoot.SRoot.ACComponentChilds) { if (childComp is ApplicationManagerProxy || childComp is ACComponentManager) { IACPropertyNetBase alarmProperty = childComp.GetPropertyNet("HasAlarms") as IACPropertyNetBase; if (alarmProperty != null) { alarmProperty.PropertyChanged += alarmProperty_PropertyChanged; } alarmProperty = childComp.GetPropertyNet("AlarmsAsText") as IACPropertyNetBase; if (alarmProperty != null) { alarmProperty.PropertyChanged += alarmProperty_PropertyChanged; } } } RefreshWarningIcon(); }