/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ContextOnExtensionChanged(object sender, ExtensionEventArgs e) { if (e.GetState() == ExtensionEventArgs.LOAD) { if (e.GetExtensionData().Name == "WpfLeftMenu.TopMenuExtension") { LeftMenu.TopGroup.Items.Clear(); foreach (XmlNode xmlNode in e.GetExtensionData().ExtensionList) { foreach (XmlNode childNode in xmlNode.ChildNodes) { if (childNode.Attributes != null && childNode.Attributes["Name"] != null) { var item = new NavBarItem { Content = childNode.Attributes["Name"].Value }; item.Click += ItemOnClick; LeftMenu.TopGroup.Items.Add(item); } } } } } else if (e.GetState() == ExtensionEventArgs.UNLOAD) { if (e.GetExtensionData().Name == "WpfLeftMenu.TopMenuExtension") { LeftMenu.TopGroup.Items.Clear(); } } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ContextOnExtensionChanged(object sender, ExtensionEventArgs e) { var stateStr = string.Empty; if (e.GetState() == ExtensionEventArgs.LOAD) { stateStr = "Load"; } else if (e.GetState() == ExtensionEventArgs.UNLOAD) { stateStr = "UnLoad"; } var extensionStr = new StringBuilder(); foreach (var xmlNode in e.GetExtensionData().ExtensionList) { extensionStr.Append(xmlNode.InnerXml); } log.Info(string.Format("{0} {1} {2} Extension {3}", ((IBundle)sender).GetSymbolicName(), stateStr, e.GetExtensionPoint().Name, extensionStr)); }